Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » Making an online game with a lobby system
- Apfellord
-
100+ posts
Making an online game with a lobby system
Hello everyone,
so recently, I have been working on a 2-player online game using the scratch wiki's example of online multiplayer and that's great and all.
But what if I wanted more than just two people to play together in different “rooms” at the same time?
I'm guessing there's not a way to make infinite rooms, but how would you people go about scripting something like that? (Without making a ton of Player 1 and Player 2 Cloud Variables and their corresponding position-cloud variables)
Could you stuff a lot of people's coordinates into one variable and have them somehow know at which point in the variable their coordinates stand? But how would the person on the other end know at which point their opponents coordinates are?
I know this is some pretty advanced stuff and I hope someone is the genius I'm looking for that has maybe done something like this already or has seen it in another project somewhere already.
Thank you all and have a great day!
so recently, I have been working on a 2-player online game using the scratch wiki's example of online multiplayer and that's great and all.
But what if I wanted more than just two people to play together in different “rooms” at the same time?
I'm guessing there's not a way to make infinite rooms, but how would you people go about scripting something like that? (Without making a ton of Player 1 and Player 2 Cloud Variables and their corresponding position-cloud variables)
Could you stuff a lot of people's coordinates into one variable and have them somehow know at which point in the variable their coordinates stand? But how would the person on the other end know at which point their opponents coordinates are?
I know this is some pretty advanced stuff and I hope someone is the genius I'm looking for that has maybe done something like this already or has seen it in another project somewhere already.
Thank you all and have a great day!

- deck26
-
1000+ posts
Making an online game with a lobby system
Unless it's a turn-taking game I personally wouldn't have more than one player per cloud variable which limits you to 10. Then it's just a case of including in that player's data some indicator of which room they are in.
- Koopakid6000
-
100+ posts
Making an online game with a lobby system
You could have a character that acts as a separator. Hello everyone,
so recently, I have been working on a 2-player online game using the scratch wiki's example of online multiplayer and that's great and all.
But what if I wanted more than just two people to play together in different “rooms” at the same time?
I'm guessing there's not a way to make infinite rooms, but how would you people go about scripting something like that? (Without making a ton of Player 1 and Player 2 Cloud Variables and their corresponding position-cloud variables)
Could you stuff a lot of people's coordinates into one variable and have them somehow know at which point in the variable their coordinates stand? But how would the person on the other end know at which point their opponents coordinates are?
I know this is some pretty advanced stuff and I hope someone is the genius I'm looking for that has maybe done something like this already or has seen it in another project somewhere already.
Thank you all and have a great day!
- deck26
-
1000+ posts
Making an online game with a lobby system
But if several players are updating the same cloud variable at around the same time you could hit problems. That's why I prefer one cloud variable per player.You could have a character that acts as a separator. Hello everyone,
so recently, I have been working on a 2-player online game using the scratch wiki's example of online multiplayer and that's great and all.
But what if I wanted more than just two people to play together in different “rooms” at the same time?
I'm guessing there's not a way to make infinite rooms, but how would you people go about scripting something like that? (Without making a ton of Player 1 and Player 2 Cloud Variables and their corresponding position-cloud variables)
Could you stuff a lot of people's coordinates into one variable and have them somehow know at which point in the variable their coordinates stand? But how would the person on the other end know at which point their opponents coordinates are?
I know this is some pretty advanced stuff and I hope someone is the genius I'm looking for that has maybe done something like this already or has seen it in another project somewhere already.
Thank you all and have a great day!
For turn-taking games that isn't a problem but you have to introduce management of whose turn it is next and ensure that if someone disconnects everything doesn't just grind to a halt.
- Apfellord
-
100+ posts
Making an online game with a lobby system
But if several players are updating the same cloud variable at around the same time you could hit problems. That's why I prefer one cloud variable per player. You could have a character that acts as a separator.
For turn-taking games that isn't a problem but you have to introduce management of whose turn it is next and ensure that if someone disconnects everything doesn't just grind to a halt.
It actually is a turn-taking game. I'm currently building an engine for a Hearthstone-esque card game (of course without collecting cards and not nearly as gigantic and complex as Hearthstone). The “MP Test” project I linked above was just to give an example.
I've also been thinking about the “character as a seperator”. One way I could implement this is by having a sprite called “reader” that simply goes through
the cloud variable one character at a time, until it detects that special “seperator”.
But that's probably too slow or not enough to solve the problem.

- deck26
-
1000+ posts
Making an online game with a lobby system
If the names aren't changing you don't need to keep decoding them. So if the same 4 players are in the game for a while you know who they are and only need to use a variable to prompt for and retrieve data from the player whose turn it is.But if several players are updating the same cloud variable at around the same time you could hit problems. That's why I prefer one cloud variable per player. You could have a character that acts as a separator.
For turn-taking games that isn't a problem but you have to introduce management of whose turn it is next and ensure that if someone disconnects everything doesn't just grind to a halt.
It actually is a turn-taking game. I'm currently building an engine for a Hearthstone-esque card game (of course without collecting cards and not nearly as gigantic and complex as Hearthstone). The “MP Test” project I linked above was just to give an example.
I've also been thinking about the “character as a seperator”. One way I could implement this is by having a sprite called “reader” that simply goes through
the cloud variable one character at a time, until it detects that special “seperator”.
But that's probably too slow or not enough to solve the problem.
A custom block to decode the user list shouldn't take long but certainly makes sense to reduce the work required where possible.
- mspellman7464
-
38 posts
Making an online game with a lobby system
Last edited by mspellman7464 (Nov. 20, 2020 19:54:02)
- SpeedyCatfish2
-
100+ posts
Making an online game with a lobby system
i hate my picture i change it
- Vaibhs11
-
1000+ posts
Making an online game with a lobby system
i hate my picture i change it
please don't necropost
- AksharPremnath
-
500+ posts
Making an online game with a lobby system
There is a game that does this with three maps which is trending. It is this one.
Edit: Sorry, I just realised the date of the post lol
Edit: Sorry, I just realised the date of the post lol
Last edited by AksharPremnath (Feb. 24, 2021 11:56:51)
- denhaerynckjonathan
-
18 posts
Making an online game with a lobby system
I'm making an online game with a lobby system! When the game is ready, I'll give you the link! Okay?
- Harakou
-
1000+ posts
Making an online game with a lobby system
This topic is very old, so I don't think they need it anymore. Check the date before posting - thanks. I'm making an online game with a lobby system! When the game is ready, I'll give you the link! Okay?

- Discussion Forums
- » Help with Scripts
-
» Making an online game with a lobby system