Discuss Scratch
- Discussion Forums
- » Questions about Scratch
- » How Can I Make A Multiplayer Game Wtih 8 Players?
- stickmanstudios404
-
43 posts
How Can I Make A Multiplayer Game Wtih 8 Players?
one im trying to make this game
scratch.mid.edu/projects/31107402/#player
And I Want it for 8 players Somone Help?
scratch.mid.edu/projects/31107402/#player
And I Want it for 8 players Somone Help?
- Mrcomputer1
-
500+ posts
How Can I Make A Multiplayer Game Wtih 8 Players?
try using cloud variables
remember that you can only use number in cloud variables
also wrong forum this should be in Help With Scripts
remember that you can only use number in cloud variables
also wrong forum this should be in Help With Scripts
- MegaApuTurkUltra
-
1000+ posts
How Can I Make A Multiplayer Game Wtih 8 Players?
Multiplayer games are pretty complicated. They use cloud data, which has the limitations of only numbers, and about 22k for each one. Another thing to keep in mind is that cloud var updates could take up to 2 secs.
Basically, each player gets their own cloud var. In the var, they provide updates to the other players. Depending on what your game is, you will need to make an encoding system for your update messages. For example, if you are making a simple game that only sends positions, you can do something like
The random single digit number at the end is like a signal that the player is still online. (You'll see later)
To decode people's positions, split the cloud var and discard the random digit at the end (make sure it's different from the last one, otherwise the player might have left)
To join a game, check all the cloud vars, save them to local vars, wait for a couple of updates (like 2 or 4 secs), then see if the cloud vars are different from the local ones. If one is the same, the player can take that var to use, because no one seems to be using it.
With this system, even if someone suddenly leaves or something happens, cloud variables can't get “locked” so that no new players can use them.
Things to keep in mind here are:
- A system like this won't be very good, especially for real time games like FPS games. There is a lag of up to 2 secs.
- It could be very buggy/unstable, you'll have to test it extensively.
In any case, you'll need to decide whether or not this project is too big for you right now. If it seems too complicated, it may be better to practice programming more and do this later, or maybe use a cloud multiplayer engine (I don't really recommend that though).
I hope this helps a bit…!
Basically, each player gets their own cloud var. In the var, they provide updates to the other players. Depending on what your game is, you will need to make an encoding system for your update messages. For example, if you are making a simple game that only sends positions, you can do something like
For both x and y position:
Pad them with leading zeros until they are the same length (like 3 or 4)
Join x, y, and a random single digit number, then set the cloud var to that
To decode people's positions, split the cloud var and discard the random digit at the end (make sure it's different from the last one, otherwise the player might have left)
To join a game, check all the cloud vars, save them to local vars, wait for a couple of updates (like 2 or 4 secs), then see if the cloud vars are different from the local ones. If one is the same, the player can take that var to use, because no one seems to be using it.
With this system, even if someone suddenly leaves or something happens, cloud variables can't get “locked” so that no new players can use them.
Things to keep in mind here are:
- A system like this won't be very good, especially for real time games like FPS games. There is a lag of up to 2 secs.
- It could be very buggy/unstable, you'll have to test it extensively.
In any case, you'll need to decide whether or not this project is too big for you right now. If it seems too complicated, it may be better to practice programming more and do this later, or maybe use a cloud multiplayer engine (I don't really recommend that though).
I hope this helps a bit…!
- icrsonicfan
-
18 posts
How Can I Make A Multiplayer Game Wtih 8 Players?
when flag clicked
set Yvelocity▼
to 0
forever
if touching color #black
?
then
set Yvelocity▼
to 0
set Yvelocity▼
to 0
forever
if touching color #black
?
then
set Yvelocity▼
to 0
- Discussion Forums
- » Questions about Scratch
-
» How Can I Make A Multiplayer Game Wtih 8 Players?