Jump to content


Photo

GameMaker Server


  • Please log in to reply
1319 replies to this topic

#201 size43

size43

    GMC Member

  • GMC Member
  • 533 posts
  • Version:GM:Studio

Posted 07 June 2012 - 01:56 PM

I have another silly question, how would I make an " string(player.var) + 'joined the game' "?
of course that would only be run once, so how should I do this?

Create event 'other player':
alarm[0]=30
Alarm 0:
server_chat_local(name + " joined the game")

 

Alternatively:
When logged in (event user 15 or so):
server_chat(" logged in");
(Which will result in a 'Username: logged in' message)

 

GameMaker Server info dump: (Global variables & functions)

Chat
global._chat: ds_list, contains all chat messages
global._chatcol: ds_list, contains nall chatcolors
global._chattime: ds_list, contains the time chat messages were received (ms)

global._viewchat: whether chat should be shown
global._chat_bgcolor: background color
global._chat_fgcolor: text color
global._chat_alpha: alpha
global._chat_cantype: whether typing
global._chat_font: chat font
global._chat_autodraw: whether the chat should be drawn automatically
global._chat_defaultcolor: default color to send chat messages
global._chat_small: whether the small chat is enabled
global._chat_show_lines: Draws a line under every chat message when enabled
global._chat_fade_effect: use ce_* constants
global._chat_visibletime: the time a chat message is visible
global._chat_show_extra: The time a chat message is visible when typing
global._chatkey: Key that should be pressed to open chat
global._chattkey: Key that should be pressed to switch between team chat & normal chat
global._chatconfirmkey: Key that should bepressed to send chat message
global._chatverify: Verify script

Variables
global._me_changed: ds_list, contains all changed variables that aren't sent.
global._me1: ds_list, contains variable names
global._me2: ds_list, contains variable values

global._global1: ds_list, contains global variable names
global._global2: ds_list, contains global variable values
global._globalchanged: ds_list, contains global variable names that aren't sent

General variables
global._launch_time: When the game was opened (ms)

Language
global._lang_login = "logged in";
global._lang_logout = "logged out";
global._lang_team = "[TEAM]";
global._lang_ok = "Ok";
global._lang_cancel = "Cancel";

Teams
global._team[i]: ds_list, all player_id's in team
global._team_score[i]: team scores
global._player_has_account: whether the player has an account

Internal:

(Will show an error in code editor, but still works)
XServer_messagebox("text")
XServer_draw_button(x, y, text, seed)

Edited by size43, 07 June 2012 - 01:57 PM.

  • 0

#202 NeoTalon27

NeoTalon27

    GMC Member

  • GMC Member
  • 220 posts
  • Version:GM:HTML5

Posted 07 June 2012 - 03:07 PM

But how would I add a Chatbox in GM, and allow mutual enemies between players?
  • 0

#203 size43

size43

    GMC Member

  • GMC Member
  • 533 posts
  • Version:GM:Studio

Posted 07 June 2012 - 03:48 PM

But how would I add a Chatbox in GM, and allow mutual enemies between players?

You can use the default chat_* functions, or write your own. What does 'mutual' mean?
  • 0

#204 NeoTalon27

NeoTalon27

    GMC Member

  • GMC Member
  • 220 posts
  • Version:GM:HTML5

Posted 07 June 2012 - 04:30 PM

That if the enemy is hit by any player it takes damage.
like 90% of multiplayer games.

       enemy
       ↑       ↑
Client 1 | Client 2

Edited by NeoTalon27, 07 June 2012 - 04:32 PM.

  • 0

#205 size43

size43

    GMC Member

  • GMC Member
  • 533 posts
  • Version:GM:Studio

Posted 07 June 2012 - 04:46 PM

That if the enemy is hit by any player it takes damage.
like 90% of multiplayer games.

       enemy
       ↑       ↑
Client 1 | Client 2

You can use server_instance_sync And server_instance_variable_add, but it'll work much better in GMS+ ('secret feature') :)
  • 0

#206 NeoTalon27

NeoTalon27

    GMC Member

  • GMC Member
  • 220 posts
  • Version:GM:HTML5

Posted 07 June 2012 - 04:50 PM

Okay, when is it coming?
  • 0

#207 NeoTalon27

NeoTalon27

    GMC Member

  • GMC Member
  • 220 posts
  • Version:GM:HTML5

Posted 07 June 2012 - 04:50 PM

which Object should execute (server_instance_sync ) ? Auto Sync, and in what event?
  • 0

#208 size43

size43

    GMC Member

  • GMC Member
  • 533 posts
  • Version:GM:Studio

Posted 07 June 2012 - 04:51 PM

Okay, when is it coming?

http://gamemakerserver.tk/plus/
^^ It'll take at least another 2 months of development. :)
  • 0

#209 NeoTalon27

NeoTalon27

    GMC Member

  • GMC Member
  • 220 posts
  • Version:GM:HTML5

Posted 07 June 2012 - 04:52 PM

Okay, and how would I sync them / where / when?
  • 0

#210 size43

size43

    GMC Member

  • GMC Member
  • 533 posts
  • Version:GM:Studio

Posted 07 June 2012 - 04:53 PM

which Object should execute (server_instance_sync ) ? Auto Sync, and in what event?

It doesn't matter. You need to set argument0 to the instanceID of the object that has to be synced. It'll auto-sync all default variables + the ones you add using server_instance_variable_add :)

Edit:So, use it once. Not every step or so. (Technically you could just do that, as GMS prevents you from syncing one instance multiple times)

Edited by size43, 07 June 2012 - 04:54 PM.

  • 0

#211 NeoTalon27

NeoTalon27

    GMC Member

  • GMC Member
  • 220 posts
  • Version:GM:HTML5

Posted 07 June 2012 - 04:54 PM

who should sync it, the enemy, the Player, or the Server?
  • 0

#212 size43

size43

    GMC Member

  • GMC Member
  • 533 posts
  • Version:GM:Studio

Posted 07 June 2012 - 04:56 PM

who should sync it, the enemy, the Player, or the Server?

The client in which the server_instance_sync script is executed, will sync the instance via the server to the other players. The server just forwards it to the other clients :)
  • 0

#213 NeoTalon27

NeoTalon27

    GMC Member

  • GMC Member
  • 220 posts
  • Version:GM:HTML5

Posted 07 June 2012 - 05:00 PM

I received an error:
___________________________________________
ERROR in
action number 1
of Create Event
for object obj_Roth:

In extension function server_instance_add_var:
Error in code at line 10:
XServer_log("Instance variable "+argument1+" added!");
^
at position 39: Wrong type of arguments to +.


______________________________________________


This is the code I added to the enemy instance( there are multiple enemy instances) :

server_instance_sync(id,1);
server_instance_add_var(id, hp);

Edited by NeoTalon27, 07 June 2012 - 05:01 PM.

  • 0

#214 size43

size43

    GMC Member

  • GMC Member
  • 533 posts
  • Version:GM:Studio

Posted 07 June 2012 - 05:03 PM

I received an error:
___________________________________________
ERROR in
action number 1
of Create Event
for object obj_Roth:

In extension function server_instance_add_var:
Error in code at line 10:
XServer_log("Instance variable "+argument1+" added!");
^
at position 39: Wrong type of arguments to +.


______________________________________________


This is the code I added to the enemy instance( there are multiple enemy instances) :

server_instance_sync(id,1);
server_instance_add_var(id, hp);

You should say:

server_instance_add_var(id, "hp")
Because you don't want the value of hp to be used as variable, but the string "hp" (just like any variable_* function in GM) :)
  • 0

#215 NeoTalon27

NeoTalon27

    GMC Member

  • GMC Member
  • 220 posts
  • Version:GM:HTML5

Posted 07 June 2012 - 05:06 PM

___________________________________________
FATAL ERROR in
action number 1
of Begin Step Event
for object __newobject38:

GameMaker Server - Update 13: To run this script, you need to be connected to the server! A script is executed while you either aren't connected yet or you are disconnected. Server status: Connected
___________________________________________

This is odd because my script goes as follows:

if server_is_connected() && server_get_master()
{
server_instance_sync(id,1);
server_instance_add_var(id, "hp");
}

  • 0

#216 NeoTalon27

NeoTalon27

    GMC Member

  • GMC Member
  • 220 posts
  • Version:GM:HTML5

Posted 07 June 2012 - 05:10 PM

Also, my current script only seems to allow one instance of the enemy object, why / how can I change this?

Edited by NeoTalon27, 07 June 2012 - 05:18 PM.

  • 0

#217 NeoTalon27

NeoTalon27

    GMC Member

  • GMC Member
  • 220 posts
  • Version:GM:HTML5

Posted 07 June 2012 - 05:24 PM

I am still rather confused as how to do this, no matter what method I choose, I still run into trouble.
  • 0

#218 size43

size43

    GMC Member

  • GMC Member
  • 533 posts
  • Version:GM:Studio

Posted 07 June 2012 - 05:31 PM

I really wish I could release GMS+ right now :(

Could you PM the gmk? I'll take a look at it :)
 
I want to stress this:
I do not tolerate swearing on my server. And for the most part, this is because I do not want people to insult each other. And if you are flat out insulting other people you don't even know, you'll get a ban. I'm not gonna call names, but I am really upset to what has happened. I don't have the tools to properly ban everyone right now, but by the time GMS+ is released, expect a ban.

Edited by size43, 07 June 2012 - 05:31 PM.

  • 0

#219 Greenhawk911

Greenhawk911

    SHS Drumline

  • GMC Member
  • 696 posts
  • Version:GM:Studio

Posted 07 June 2012 - 05:33 PM

I really wish I could release GMS+ right now :(

Could you PM the gmk? I'll take a look at it :)
 
I want to stress this:
I do not tolerate swearing on my server. And for the most part, this is because I do not want people to insult each other. And if you are flat out insulting other people you don't even know, you'll get a ban. I'm not gonna call names, but I am really upset to what has happened. I don't have the tools to properly ban everyone right now, but by the time GMS+ is released, expect a ban.

You should add to you game maker server and have a D&D that says game lobby which sets up a ga,e lobby with a certain number of people.
  • 0

#220 size43

size43

    GMC Member

  • GMC Member
  • 533 posts
  • Version:GM:Studio

Posted 07 June 2012 - 05:35 PM

You should add to you game maker server and have a D&D that says game lobby which sets up a ga,e lobby with a certain number of people.

Take a look at the VS mode. This enables you to set a minimum and maximum number of players, and start the game when the minimum amount of players is reached :)
  • 0

#221 Greenhawk911

Greenhawk911

    SHS Drumline

  • GMC Member
  • 696 posts
  • Version:GM:Studio

Posted 07 June 2012 - 06:17 PM


You should add to you game maker server and have a D&D that says game lobby which sets up a ga,e lobby with a certain number of people.

Take a look at the VS mode. This enables you to set a minimum and maximum number of players, and start the game when the minimum amount of players is reached :)

how do i get to versus mode or get it?
  • 0

#222 NeoTalon27

NeoTalon27

    GMC Member

  • GMC Member
  • 220 posts
  • Version:GM:HTML5

Posted 07 June 2012 - 06:26 PM

how do i get to versus mode or get it?


take a look at the vs mode variables and functions:
- server_vs_get_status
- server_vs_get_status_string
- server_vs_ready
- server_vs_waiting
  • 0

#223 Greenhawk911

Greenhawk911

    SHS Drumline

  • GMC Member
  • 696 posts
  • Version:GM:Studio

Posted 07 June 2012 - 06:30 PM


how do i get to versus mode or get it?


take a look at the vs mode variables and functions:
- server_vs_get_status
- server_vs_get_status_string
- server_vs_ready
- server_vs_waiting

is that ion the library? where is it located
  • 0

#224 NeoTalon27

NeoTalon27

    GMC Member

  • GMC Member
  • 220 posts
  • Version:GM:HTML5

Posted 07 June 2012 - 06:32 PM



how do i get to versus mode or get it?


take a look at the vs mode variables and functions:
- server_vs_get_status
- server_vs_get_status_string
- server_vs_ready
- server_vs_waiting

is that ion the library? where is it located


those are the GML functions.
  • 0

#225 Greenhawk911

Greenhawk911

    SHS Drumline

  • GMC Member
  • 696 posts
  • Version:GM:Studio

Posted 07 June 2012 - 06:42 PM




how do i get to versus mode or get it?


take a look at the vs mode variables and functions:
- server_vs_get_status
- server_vs_get_status_string
- server_vs_ready
- server_vs_waiting

is that ion the library? where is it located


those are the GML functions.

doe it tell you on the Game maker server website how to do it or..
  • 0

#226 NeoTalon27

NeoTalon27

    GMC Member

  • GMC Member
  • 220 posts
  • Version:GM:HTML5

Posted 07 June 2012 - 06:49 PM

You can find all the gml functions in the first post on the first page, or using the Auto-complete option in GMK- .
  • 0

#227 Greenhawk911

Greenhawk911

    SHS Drumline

  • GMC Member
  • 696 posts
  • Version:GM:Studio

Posted 07 June 2012 - 07:04 PM

You can find all the gml functions in the first post on the first page, or using the Auto-complete option in GMK- .

I accidently deleted the extension but still shows in the extension menu. When i readded it it said, "error couldnot load gamemaker serverlib2" help m,e

EDOT: When i uninstalled it it said list index out of bounds

Edited by Greenhawk911, 07 June 2012 - 07:11 PM.

  • 0

#228 size43

size43

    GMC Member

  • GMC Member
  • 533 posts
  • Version:GM:Studio

Posted 07 June 2012 - 07:11 PM





how do i get to versus mode or get it?


take a look at the vs mode variables and functions:
- server_vs_get_status
- server_vs_get_status_string
- server_vs_ready
- server_vs_waiting

is that ion the library? where is it located


those are the GML functions.

doe it tell you on the Game maker server website how to do it or..

First of all, you should make sure that the checkbox vs mode is enabled on the site. There's also an dnd action to check when the game starts, I could make an example tomorrow or so :)

The error is quite common, which version of gm do you have?
  • 0

#229 Greenhawk911

Greenhawk911

    SHS Drumline

  • GMC Member
  • 696 posts
  • Version:GM:Studio

Posted 07 June 2012 - 07:13 PM






how do i get to versus mode or get it?


take a look at the vs mode variables and functions:
- server_vs_get_status
- server_vs_get_status_string
- server_vs_ready
- server_vs_waiting

is that ion the library? where is it located


those are the GML functions.

doe it tell you on the Game maker server website how to do it or..

First of all, you should make sure that the checkbox vs mode is enabled on the site. There's also an dnd action to check when the game starts, I could make an example tomorrow or so :)

The error is quite common, which version of gm do you have?

i got the one from yur website. I dont know the version it had 2 tabs in game maker
  • 0

#230 size43

size43

    GMC Member

  • GMC Member
  • 533 posts
  • Version:GM:Studio

Posted 07 June 2012 - 07:14 PM

And which game maker version? :)

The download from the site should be ok. It's always the latest.
  • 0

#231 Greenhawk911

Greenhawk911

    SHS Drumline

  • GMC Member
  • 696 posts
  • Version:GM:Studio

Posted 07 June 2012 - 07:15 PM

And which game maker version? :)

The download from the site should be ok. It's always the latest.

Alright could you PM of an that VS mode lobby example you said you were gonna do whenever you can
EDIT P.S it's still not working
it won't uninstall. it's stuck there.

Edited by Greenhawk911, 07 June 2012 - 07:19 PM.

  • 0

#232 size43

size43

    GMC Member

  • GMC Member
  • 533 posts
  • Version:GM:Studio

Posted 07 June 2012 - 07:17 PM


And which game maker version? :)

The download from the site should be ok. It's always the latest.

Alright could you PM of an that VS mode lobby example you said you were gonna do whenever you can

ok, it will come tomorrow, at, like 6 PM gmt :)
  • 0

#233 Greenhawk911

Greenhawk911

    SHS Drumline

  • GMC Member
  • 696 posts
  • Version:GM:Studio

Posted 07 June 2012 - 07:26 PM



And which game maker version? :)

The download from the site should be ok. It's always the latest.

Alright could you PM of an that VS mode lobby example you said you were gonna do whenever you can

ok, it will come tomorrow, at, like 6 PM gmt :)

your gameserver extension wont uninstall. It's says it's out of bounds which I dont get.
  • 0

#234 NeoTalon27

NeoTalon27

    GMC Member

  • GMC Member
  • 220 posts
  • Version:GM:HTML5

Posted 08 June 2012 - 11:44 AM

Any Update on how to add multiple syncing enemies? :thumbsup:
  • 0

#235 size43

size43

    GMC Member

  • GMC Member
  • 533 posts
  • Version:GM:Studio

Posted 08 June 2012 - 01:34 PM

Tell me your GameMaker version. Then I can tell you how to solve this error. :)

VS Mode example: http://updo.nl/file/101e30e0.gmk
^^ Make sure you change the gameID & properly set up the VS Mode on the website

 

You should just be able to sync multiple enemies. The example I PM'ed you, should show everything you need. (it syncs multiple enemies for me...) :)

Edited by size43, 08 June 2012 - 01:36 PM.

  • 0

#236 NeoTalon27

NeoTalon27

    GMC Member

  • GMC Member
  • 220 posts
  • Version:GM:HTML5

Posted 08 June 2012 - 02:10 PM

I think we need an example with many functions, displaying all of them individually.

Also: in your example you used:

- Draw Main Name - Online 1 Tab
- Draw Variable as a HP bar - Online 1 Tab

what are the gml functions for each?

Edited by NeoTalon27, 08 June 2012 - 02:15 PM.

  • 0

#237 size43

size43

    GMC Member

  • GMC Member
  • 533 posts
  • Version:GM:Studio

Posted 08 June 2012 - 02:17 PM

I think we need an example with many functions, displaying all of them individually.

VS mode is somthing that I think should be added. Instance synchronisation I left out deliberately, because it currently works so bad, and I wanted to wait for GMS+ ;)
  • 0

#238 NeoTalon27

NeoTalon27

    GMC Member

  • GMC Member
  • 220 posts
  • Version:GM:HTML5

Posted 08 June 2012 - 02:20 PM

so what are the gml functions for the two?
  • 0

#239 size43

size43

    GMC Member

  • GMC Member
  • 533 posts
  • Version:GM:Studio

Posted 08 June 2012 - 02:22 PM

so what are the gml functions for the two?

server_vs_get_status
server_vs_get_status_string

server_instance_sync
server_instance_add_var
server_instance_sync_once
server_instance_remove_var
server_instance_* (less improtant functions; See the autocorrect)

 
GMS+ will get a full help file on the site, including all D&D actions and scripts :)
  • 0

#240 NeoTalon27

NeoTalon27

    GMC Member

  • GMC Member
  • 220 posts
  • Version:GM:HTML5

Posted 08 June 2012 - 02:28 PM

Error:


___________________________________________
ERROR in
action number 1
of Draw Event
for object obj_other_player:

Error in code at line 9:
d3d_draw_wall(x - 4 * (hp / hp_m) * global.camsin, y - 4 * (hp / hp_m) * global.camcos, 12,
^
at position 27: Unknown variable hp
___________________________________________


I used this in obj_other_player's Create Event:

server_instance_add_var(id, "hp_m");
server_instance_add_var(id, "hp");

I am not sure what I did wrong, should they be synced by the Player object, instead of the other_player object?
  • 0

#241 size43

size43

    GMC Member

  • GMC Member
  • 533 posts
  • Version:GM:Studio

Posted 08 June 2012 - 02:31 PM

By using the variable id, you'll sync the instance it's executed in.

You should set the variable hp even though you sync it, because it takes time to send all the variables. (And due to GameMaker's speed limitations, the sync code is just executed 10 times a second)
  • 0

#242 NeoTalon27

NeoTalon27

    GMC Member

  • GMC Member
  • 220 posts
  • Version:GM:HTML5

Posted 08 June 2012 - 02:33 PM

You should set the variable hp even though you sync it,

what do you mean set it?
  • 0

#243 size43

size43

    GMC Member

  • GMC Member
  • 533 posts
  • Version:GM:Studio

Posted 08 June 2012 - 02:34 PM

You should set the variable hp even though you sync it,

what do you mean set it?

In create
hp = 100
or so ;)
  • 0

#244 NeoTalon27

NeoTalon27

    GMC Member

  • GMC Member
  • 220 posts
  • Version:GM:HTML5

Posted 08 June 2012 - 02:36 PM

for the Player object, or for the other_player object?
  • 0

#245 size43

size43

    GMC Member

  • GMC Member
  • 533 posts
  • Version:GM:Studio

Posted 08 June 2012 - 02:38 PM

for the Player object, or for the other_player object?

The enemy ;)
(You got the error in the enemy-object, i thought)
  • 0

#246 NeoTalon27

NeoTalon27

    GMC Member

  • GMC Member
  • 220 posts
  • Version:GM:HTML5

Posted 08 June 2012 - 02:44 PM

Well, the hp bar is showing up now, but the value (hp) does not appear to sync, do I have to sync it manually? If so, how would I do that?
  • 0

#247 size43

size43

    GMC Member

  • GMC Member
  • 533 posts
  • Version:GM:Studio

Posted 08 June 2012 - 02:46 PM

Well, the hp bar is showing up now, but the value (hp) does not appear to sync, do I have to sync it manually? If so, how would I do that?

It should sync automatically, but it can take up a long time since GMS is only checking one of the instances every 0.2 seconds or so (otherwise your game would be in 'powerpoint mode').
  • 0

#248 NeoTalon27

NeoTalon27

    GMC Member

  • GMC Member
  • 220 posts
  • Version:GM:HTML5

Posted 08 June 2012 - 02:53 PM

I checked again, they don't sync.
I am now adding this in the create event of the Player:

server_instance_add_var(Player, hp);
  • 0

#249 size43

size43

    GMC Member

  • GMC Member
  • 533 posts
  • Version:GM:Studio

Posted 08 June 2012 - 02:54 PM

I checked again, they don't sync.
I am now adding this in the create event of the Player:

server_instance_add_var(Player, hp);

Don't forget the " on both sides of hp ;)
  • 0

#250 NeoTalon27

NeoTalon27

    GMC Member

  • GMC Member
  • 220 posts
  • Version:GM:HTML5

Posted 08 June 2012 - 02:57 PM

I figured something out.
if I change obj_other_player's hp value it changes correctly, I guess I have to now add damage on both sides?
  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users