gms_session_join

Usage: gms_session_join ( session_id )

Description

Makes the player join the given session. session_id is a value obtained by using gms_session_id. This function will be executed asynchronously. When the new session-information has been received, the script set by gms_script_set_session_change will be called.

When the player joins a new session, communication with other players is impossible. For more info, see sessions

Replies (18)

Last message on 22 Mar 2017

CurrentCanine on 22 Sep 2016, 00:15:33
Hey Size (or whoever else is reading this =3)
I've been using your extension for a vary long time now, so I'm really familiar with it. But out of all the time I've been using it I've never made a well working game (that was online). I've used it for many things including online, but it was really bad because I didn't do anything with it, all you could do was see other players. You couldn't interact with them or anything of the sort, I've taken a lot of shots at making a online game but none of them ever worked out. So I was wondering if you had a tutorial or something of the sort that I could possibly use to help me understand sessions and other things of the sort better, it doesn't even need to be a video just an example project would be helpful! Thank you for your time and I really hope you can help me (at-least with sessions =3) a little bit. thanks! =)
CurrentCanine on 24 Sep 2016, 16:33:25
OK so now, I finally got sessions to work (I can join and leave sessions in my game) but I can't get instances to sync correctly (maybe it's because I don't fully understand them) I got two people on the game and they both joined the same session, but with one of them it doesn't show the other player at all and with the other one it shows both players but one of them doesn't move unless the first player moves (its like the first player is just using this command in the draw event: draw_sprite(spr_player, x-50, y-50)) please help.
my code:
create event:
if(!gms_instance_created_by_sync()) {
gms_instance_sync(id, is_full);
}
step event:
its just a moving script that is too long to put in this post
thanks!
Size43 (Administrator) on 26 Sep 2016, 19:56:16
Hey, that should work.

Would you mind mailing me your project at gamemakerserver@outlook.com?
CurrentCanine on 28 Sep 2016, 00:21:39
Not a problem =)
Do know that this was just a test game that I made just to see if I possibly could make an online game, so it's not that good =3
CurrentCanine on 7 Oct 2016, 23:47:40
Have you seen the message? I know you don't work on it much I was just making sure you seen the email :)
Size43 (Administrator) on 10 Oct 2016, 18:45:54
Hey,

Apologies for the long delay. I've had an unexpectedly busy week or two.

I'm just now caching up to all the posts on this site. I'll hopefully be able to look at your project by tomorrow.
CurrentCanine on 10 Oct 2016, 19:12:02
Ok thanks!
Size43 (Administrator) on 11 Oct 2016, 17:41:56
Hey,

You were using a slightly older version of GameMaker Server, which I updated to 1.9. I enabled simple mode (gms_settings, I don't think there's ever a case where you would't want the simple mode to be on. Turning it off will kill random features you mignt need), and then installed an older version of GM (1.4.1749). Seems like the latest update will not work correctly with the DLL.

Lastly -- you've got the VS mode enabled, but you're using sessions. Mixing those two can lead to "interesting" situations. You won't need it at all, so you can turn it off without any issues.

Ps. Is there any reason why you're not using the built-in player synchonisation? That should work a lot better for synchronising player instances.
CurrentCanine on 11 Oct 2016, 19:42:00
Ok, thanks for the help, I don't want to use the built-in player synchronization just because I feel more limited when using that so I don't want to use it. The reason why I turned off simple mode was to see if it would disable the "playername" has logged in popup but it didn't and I forgot to turn it back on, is there a way to turn that pop up off?
Size43 (Administrator) on 11 Oct 2016, 20:04:33
Please see gms_message_reporting.
CurrentCanine on 11 Oct 2016, 23:06:29
OK, thanks SO much for your help :)
GameBear6 on 17 Jul 2014, 16:00:51
Hey there, I've some problem! :S
Actually I use the function "gms_session_count" to view the number of sessions opened in the game.
If I create a session, a rectangle shape suddendly appear in the screen with all the session details, such as I established.
BUT, if someone join in that session, it disappear! That's not true cause, by using the command "gms_session_join", I still can join the session... what happened exactly?
Why that session is no more counted by the "gms_session_count" command?
GameBear6 on 17 Jul 2014, 16:31:30
EDIT: I just noticed that all works properly until I log out.
The "gms_session_count" shows me the right number until I log out and log in again.
All the sessions that have more than 1 Player, disappears.
Example:
3 different players have created 3 different sessions.
Then 2 players joins to two different sessions. Only 1 session remains with only 1 player.
I'm logged in and "gms_session_count" shows me 3 sessions (as it should be).
Then I decide to log out and to log in again. Same username, I didn't changed anything.
But "gms_session_count" tells me there is only 1 session...
And the other 2 sessions? Those sessions are still availble and, in fact, I can join them.. so it doesn't count it?
Size43 (Administrator) on 17 Jul 2014, 16:34:53
Hey,

What version of GameMaker and the extension are you using?

Would you be able to provide file that causes the problem, so it's easier for me to reproduce the issue and fix it?

Thanks,
Size43
GameBear6 on 17 Jul 2014, 16:47:07
I uses the GM: Studio - Professional Edition!
I didn't understand what did you mean with "providing the file that caused the problem".
You mean the actual source code I used to see the sessions?
GameBear6 on 17 Jul 2014, 16:48:13
PS: If it's easier for you, I can contact you with PMs on Game Maker Comunity!
Dublann on 15 Mar 2017, 20:56:35
Hi Size,

If I understood correctly, players when connected to the server, automatically they can be connected to different sessions, therefore, some of them cant see the chat of others and cant share variables between them. Am I right?

If so, how can I force to join all players to the same session?

Also, related to this question, if Im matching players depending on the unlocked level, I have to create new sessions for each level. Can I force to create a specific session and join them to it, or the server is giving me a random session and I have to join to it?

Last question, the type of session is defined by code and its purpose is to "clasify" the sessions depending on your need once you have previously define?

THX!
Size43 (Administrator) on 22 Mar 2017, 18:53:43
If vs mode is off, everyone (using the same game version) will connect to the same session.

You can't force a specific session ID, but you can set the session type. For example, you could use one type for every level. Note though that the session type may not be larger than 255