Discuss Scratch
- Discussion Forums
- » Suggestions
- » Scratch 3.0— Online games— But Wait— I Have a Way it Can Be Done
- turkey3_test
-
1000+ posts
Scratch 3.0— Online games— But Wait— I Have a Way it Can Be Done
Putting ideas into action—please read the whole thing before thinking it's not a good suggestion
Almost every other topic on this website is “how do I make online games” or a suggestion “online gameplay”. But have you ever thought of how putting that all into blocks could be difficult? Therefore, I propose some very simple blocks on how to make it work. Under “More Blocks” could be online blocks.
Okay, you ready for this idea
Using the blocks I showed above, you can figure out which player is you and control a specific sprite from there on. So you can do this:
So if I change the x position of a sprite with the streaming option selected, the x position would switch for the other players, too. However, it I change the x position of a sprite without the streaming option selected, the x position will only change for me. Because the streaming is optional for sprites, that means players can pull up their own individual menus and selection screens without the other players having to see it.
Clones
Clones inherit the streaming option. If the parent sprite streams data, so will the clones be streaming their own data. Eventually if there are about 100 clones streaming data, on a slow internet connection it could lag, but that is up to the project creator to work around.
More Blocks
More Info on Streaming
Almost every other topic on this website is “how do I make online games” or a suggestion “online gameplay”. But have you ever thought of how putting that all into blocks could be difficult? Therefore, I propose some very simple blocks on how to make it work. Under “More Blocks” could be online blocks.
search for (2) players and wait //category=customWhat would this do? The script would wait until it find the specified number of players trying to all connect on the same project. When the players are found, the script will continue, here are some more blocks for this:
(player (1 v)) //category=customThat block would report the name of the player. You can use this block to find out who you are playing with. If no players have been found, it reports blank. The server itself takes the users and assigns each of them a random number, their player #. Each player's username is reported by the block above if their player # is specified in the parameters. Also, if someone has multiple tabs of the same project open, they could play in both tabs as two players.
Okay, you ready for this idea
Using the blocks I showed above, you can figure out which player is you and control a specific sprite from there on. So you can do this:
if <(player (1 v)) = (username)>Now for the great idea. If you click the little “i” by a sprite's thumbnail the settings menu appears. There would be an option in the settings menu to “stream sprite values”. Now what does this mean? It means that the x and y position (and direction, size, etc.) of the sprites with this option on are constantly being sent over to the other players so the x, y pos, and direction can be consistent for all players.
set [player v] to (1)
end
when I receive [play v] //this script is in the sprite car A
if <(player) = [1]>
...
end
when I receive [play v] //this script is in the sprite car B
if <(player) = [2]> //each player ends up with his own sprite
...
end
So if I change the x position of a sprite with the streaming option selected, the x position would switch for the other players, too. However, it I change the x position of a sprite without the streaming option selected, the x position will only change for me. Because the streaming is optional for sprites, that means players can pull up their own individual menus and selection screens without the other players having to see it.
Clones
Clones inherit the streaming option. If the parent sprite streams data, so will the clones be streaming their own data. Eventually if there are about 100 clones streaming data, on a slow internet connection it could lag, but that is up to the project creator to work around.
More Blocks
(mouse x of [player 1 v]) //category=custom
(mouse y of [player 1 v]) //category=custom
turn [off v] streaming locally //category=custom
More Info on Streaming
will use up lots of bandwidth. I have a few ideas to counter that:I would like to elaborate on #3. Only when a sprite's value changes will that value be streamed instead of the same value constantly being streamed over and taking up bandwidth. Streaming all that data likely
- Make sure the user explicitly allows streaming for each project – give them a dialog on projects that stream data, similar to the one for projects that can detect your username. It could say something like: “This project has X sprite(s) that share data between players. Do you want to allow it? If you are on mobile or have poor network speed, we recommend disallowing. The project may not work well without sharing.”
- Have a limit on the number of sprites that can stream. Something like 50, counting clones?
- Only stream diffs. When you connect, receive all the data. After that, only get/send what changes.
Last edited by turkey3_test (March 15, 2014 15:08:01)
- crazykidz
-
26 posts
Scratch 3.0— Online games— But Wait— I Have a Way it Can Be Done
Support, right now I don't even know if there are workarounds. But it's actually not sloppy, it can help especially for the first one. I love it and I want it!
- AonymousGuy
-
1000+ posts
Scratch 3.0— Online games— But Wait— I Have a Way it Can Be Done
This would work, although if they make cloud lists, this will be very easy to workaround (except for the fact that cloud lists will most likely be unstable)
Also, just like the “set rotation style” block, I think there should be a block to set whether it can stream.
Also, just like the “set rotation style” block, I think there should be a block to set whether it can stream.
- turkey3_test
-
1000+ posts
Scratch 3.0— Online games— But Wait— I Have a Way it Can Be Done
The rotation style would stream with the option already. Also, cloud lists will take 2 seconds to update probably like variables, and even using cloud lists would be This would work, although if they make cloud lists, this will be very easy to workaround (except for the fact that cloud lists will most likely be unstable)much harder and unstable than the streaming idea, you know?
Also, just like the “set rotation style” block, I think there should be a block to set whether it can stream.
- shredthe3rd
-
100+ posts
Scratch 3.0— Online games— But Wait— I Have a Way it Can Be Done
Blippin' Awezome.
- AonymousGuy
-
1000+ posts
Scratch 3.0— Online games— But Wait— I Have a Way it Can Be Done
No, I meant that there should be a block that can turn on / off streaming.The rotation style would stream with the option already. Also, cloud lists will take 2 seconds to update probably like variables, and even using cloud lists would be This would work, although if they make cloud lists, this will be very easy to workaround (except for the fact that cloud lists will most likely be unstable)much harder and unstable than the streaming idea, you know?
Also, just like the “set rotation style” block, I think there should be a block to set whether it can stream.
- mathfreak231
-
1000+ posts
Scratch 3.0— Online games— But Wait— I Have a Way it Can Be Done
Oh yesh, this is one of the more thought-out ideas. Support.
- turkey3_test
-
1000+ posts
Scratch 3.0— Online games— But Wait— I Have a Way it Can Be Done
Support that, too! But by turning off streaming, wouldn't you have to stream that you're turning off streaming?No, I meant that there should be a block that can turn on / off streaming.The rotation style would stream with the option already. Also, cloud lists will take 2 seconds to update probably like variables, and even using cloud lists would be This would work, although if they make cloud lists, this will be very easy to workaround (except for the fact that cloud lists will most likely be unstable)much harder and unstable than the streaming idea, you know?
Also, just like the “set rotation style” block, I think there should be a block to set whether it can stream.
- AonymousGuy
-
1000+ posts
Scratch 3.0— Online games— But Wait— I Have a Way it Can Be Done
Well, I guess. But this would allow you to switch between online / offline mode without extra variables.Support that, too! But by turning off streaming, wouldn't you have to stream that you're turning off streaming?No, I meant that there should be a block that can turn on / off streaming.The rotation style would stream with the option already. Also, cloud lists will take 2 seconds to update probably like variables, and even using cloud lists would be This would work, although if they make cloud lists, this will be very easy to workaround (except for the fact that cloud lists will most likely be unstable)much harder and unstable than the streaming idea, you know?
Also, just like the “set rotation style” block, I think there should be a block to set whether it can stream.

- scratchisthebest
-
1000+ posts
Scratch 3.0— Online games— But Wait— I Have a Way it Can Be Done
If cloud variables/lists take a number of seconds to stream, what is saying a sprite wouldn't?
Insert argument about how Scratch isn't just for games here. Maybe with a little rewording
Insert argument about how Scratch isn't just for games here. Maybe with a little rewording
wait for (2) users //category=controla couple more blocks to extend this idea
(user (2 v) 's name) //category=sensing
pretend this down here is a hat block ;)//category=grey
when (2) users on this project //category=events
(user (2 v) 's id) //category=sensing
(user (2 v) 's [mouse x v]) //category=sensing
- turkey3_test
-
1000+ posts
Scratch 3.0— Online games— But Wait— I Have a Way it Can Be Done
Great ideas! I guess the Scratch Team would set up powerful servers so it would only take milliseconds. When you play online games, you are in constant connection with the server, but only when a cloud variable changes does the computer connect to the server, which is why, I think, it takes a couple seconds. Correct me if wrong. If cloud variables/lists take a number of seconds to stream, what is saying a sprite wouldn't?
Insert argument about how Scratch isn't just for games here. Maybe with a little rewordingwait for (2) users //category=controla couple more blocks to extend this idea
(user (2 v) 's name) //category=sensingpretend this down here is a hat block ;)//category=grey
when (2) users on this project //category=events
(user (2 v) 's id) //category=sensing
(user (2 v) 's [mouse x v]) //category=sensing
- AmayaCreates
-
100+ posts
Scratch 3.0— Online games— But Wait— I Have a Way it Can Be Done
This would take so much effort and time to code. For nowI vote no.
- crazykidz
-
26 posts
Scratch 3.0— Online games— But Wait— I Have a Way it Can Be Done
Good, that's the point, they have to work hard. It might take long to code, but it is worth it. This would take so much effort and time to code. For nowI vote no.
- ProdigyZeta7
-
1000+ posts
Scratch 3.0— Online games— But Wait— I Have a Way it Can Be Done
Definitely support. Now you need to elaborate on how it will detect all users currently using a project.
Does it exclude anonymous users? What if one user has two tabs open for the same project? How will it tell who gets to be first player, second player, and so on? How reliable will this be for fast-paced games?
Does it exclude anonymous users? What if one user has two tabs open for the same project? How will it tell who gets to be first player, second player, and so on? How reliable will this be for fast-paced games?
- turkey3_test
-
1000+ posts
Scratch 3.0— Online games— But Wait— I Have a Way it Can Be Done
When creating an online game, it's not meant to be easy to code with. Personally, I think this would be pretty easy to code with. This would take so much effort and time to code. For nowI vote no.
1. Non-logged in users will not be able to play unless Scratch decides to start giving them a random username with the username block, because you could not detect which offline user is who. The creator of the project could program the online capabilities to be disabled if the user is offline. Definitely support. Now you need to elaborate on how it will detect all users currently using a project.
Does it exclude anonymous users? What if one user has two tabs open for the same project? How will it tell who gets to be first player, second player, and so on? How reliable will this be for fast-paced games?
2. If the user has open multiple tabs, I'm not quite sure. Maybe your player # can be not only linked to your username but IP address, too, so you cannot play as two players from the same IP.
3. The server itself will tell who is which player. It'll take each user and give them each a number randomly.
4. For fast-paced games, it depends on how much data needs to be streamed. With my internet I can download files online at about 3 megabytes per seconds, so unless the project needs to stream over about 2 megabytes of data per second, speed should be fine. Sending over x, y positions, costume #s, direction, etc. should not exceed a small number of bytes. If about 100 sprites were streaming, your computer would probably be reading 1mb of data every second (remember each frame). As for sending out data, when you change the value of a streaming sprite, your computer streams out the data which the server will change and send back to each computers.
Last edited by turkey3_test (Dec. 24, 2013 14:54:06)
- Photoguy77
-
100+ posts
Scratch 3.0— Online games— But Wait— I Have a Way it Can Be Done
I support!!!
- MCAnimator3D
-
500+ posts
Scratch 3.0— Online games— But Wait— I Have a Way it Can Be Done
This is what @relrel's multiplayer system does. I used this in my "Parkour" multiplayer game
Last edited by MCAnimator3D (Dec. 24, 2013 15:06:07)
- scimonster
-
1000+ posts
Scratch 3.0— Online games— But Wait— I Have a Way it Can Be Done
This happens to be a pretty well-thought-out idea, i like it! And it doesn't have to be only for games, you could also do realtime art, or watch animations together….
EDIT: Streaming all that data likely will use up lots of bandwidth. I have a few ideas to counter that:
No, you wouldn't. It would unstream locally.Support that, too! But by turning off streaming, wouldn't you have to stream that you're turning off streaming? No, I meant that there should be a block that can turn on / off streaming.
EDIT: Streaming all that data likely will use up lots of bandwidth. I have a few ideas to counter that:
- Make sure the user explicitly allows streaming for each project – give them a dialog on projects that stream data, similar to the one for projects that can detect your username. It could say something like: “This project has X sprite(s) that share data between players. Do you want to allow it? If you are on mobile or have poor network speed, we recommend disallowing. The project may not work well without sharing.”
- Have a limit on the number of sprites that can stream. Something like 50, counting clones?
- Only stream diffs. When you connect, receive all the data. After that, only get/send what changes.
Last edited by scimonster (Dec. 24, 2013 15:27:30)
- Chainmanner
-
100+ posts
Scratch 3.0— Online games— But Wait— I Have a Way it Can Be Done
No support. I'm pretty sure it can be done with current standards.
- turkey3_test
-
1000+ posts
Scratch 3.0— Online games— But Wait— I Have a Way it Can Be Done
Thanks! The real-time art gave me an idea: This happens to be a pretty well-thought-out idea, i like it! And it doesn't have to be only for games, you could also do realtime art, or watch animations together….
turn pen streaming [on v] //category=pen
- Discussion Forums
- » Suggestions
-
» Scratch 3.0— Online games— But Wait— I Have a Way it Can Be Done