Discuss Scratch

vincent0917
Scratcher
18 posts

How to make cloud games?

okay so I have no multiplayer games and I need help. if you want you can give me some ideas with codes like this:
when green flag clicked
say [Pls can anyone help me???]
Dakota_The_Coder
Scratcher
100+ posts

How to make cloud games?

Griffpatch has a series of tutorials on the subject. Look up “griffpatch cloud multiplayer” on Youtube and you should see it. But keep in mind the cloud variables are down right now, so it won't work.
Scyth3d
Scratcher
500+ posts

How to make cloud games?

Dakota_The_Coder wrote:

Griffpatch has a series of tutorials on the subject. Look up “griffpatch cloud multiplayer” on Youtube and you should see it. But keep in mind the cloud variables are down right now, so it won't work.
Would like to make it more obvious

CLOUD IS DOWN
eurokid4
Scratcher
37 posts

How to make cloud games?

Scyth3d wrote:

Dakota_The_Coder wrote:

Griffpatch has a series of tutorials on the subject. Look up “griffpatch cloud multiplayer” on Youtube and you should see it. But keep in mind the cloud variables are down right now, so it won't work.
Would like to make it more obvious

CLOUD IS DOWN
Cloud isn’t down.
Here’s a link to that griffpatch video: https://youtu.be/-KoHaz7ZPvo?si=yP_yW0IgKpJkyZ9r
NMario84
Scratcher
1000+ posts

How to make cloud games?

Pretty sure that cloud data IS in fact DOWN!

So what you “CAN” do for the moment is to work using an alternative like turbowarp, which has a different server for cloud data.
eurokid4
Scratcher
37 posts

How to make cloud games?

NMario84 wrote:

Pretty sure that cloud data IS in fact DOWN!

So what you “CAN” do for the moment is to work using an alternative like turbowarp, which has a different server for cloud data.


I tried it but it works?
The_Cool_Test_Alt
Scratcher
100+ posts

How to make cloud games?

There are some main concepts you should understand when you're dealing with cloud variables, especially for games:

  1. Encoding and Decoding:

    This is to make your text turn into a number so that it can be used for the cloud variables, since cloud variables can only use numbers. The main way of doing this is to have a list of characters which are in your text, usually number, letters, a delimiter (character for joining different data together), and any other special characters your game might need (usually underscore _ and hyphen - for usernames). You convert each character to a two digit number based on its position in the list to encode, and use the list to find that number character for each 2 digits to decode. When encoding, you should encode all of your player's data at once by joining them with the delimiter, and use the delimiter to split the data when you decode.. Alternatively, you can use costumes as a list if you want case detection, more info on that here.

  2. Maximization:

    Scratch lets you use up to 10 cloud variables. Use all 10. When you encode, it is a good idea to set it to whichever of your 10 cloud slots at random so that some are not more overloaded while others sit unchanged. Encoding and decoding can take your code some time, so to speed things up (primarily for decoding, encoding needs to be delayed anyway), you should make your cloud code in its own sprite (hidden or blank costumes) and take advantage of all 300 clones. When you detect that a cloud variable has changed (use a list to keep track of your cloud variables), create a new clone to decode it. If the clone count reaches the limit of 300, the clone won't be created and that is absolutely fine - as long as your clones are deleted once their job is done, as this frees up space for more clones. If feasible for your game, make this sprite go to the front layer as this will make it execute its code first.

  3. Special Handling for Critical Info:

    Remember I said some clones won't get made? If your game requires critical info that can't be missed or updated later (like the state of the game or the number of people playing, etc.), you must take a step back from maximization: use one of your 10 cloud slots dedicated to this important information, and keep track of your clone count so you only make an ordinary clone if it is less than 299 so you have one left to decode the important variable in a pinch.

  4. Predictive movement

    I said that encoding was delayed, right? That's because cloud variables can only be set once every 0.1 seconds. On top of which it can take even longer from lag depending on your internet connection and distance from the data center. On top of which not all data might get decoded. This means your player on the screen could lag about half a second behind where they actually are. It may seem small, but it can be the difference between winning and losing the game, which is not what you want. So to compensate, store the players data from the last two updates for each clone of your on-screen sprite. (Use -for-this-sprite-only lists so each clone has their own.) A timestamp is important here, make sure that the days since 2000 block is packaged with the player's other data when encoding and setting. Use the timestamp to figure out the time difference, then use that to figure out how fast the rest of the player's data was changing. Use this to predict the player's data until you get new data, when you can add the new data to the lists and get rid of the oldest ones.

  5. Using Lists Effectively

    Given the complex nature of working with cloud variables, knowing how to use lists the right way is key. The best tip I can give you is to use a for-this-sprite-only list when dealing with individual clones or players, and using a for-all-sprites list when the data is broader or shared. Othere than that, exactly how you will use lists is up to you and the needs for your game.

  6. RECAP:

  • Encode and decode your data to use cloud variables properly.
  • Maximize the resources that scratch gives you.
  • Handle important data carefully.
  • Predict movement for a less laggy feel.
  • Use lists effectively to get the most out of them.


That's it! I hope you have a fun journey with the cloud. I happen to be working on a cloud game right now that you might take inspiration from, and it follows these same rules. I'll line it with comments and tell you when I'm done!
vincent0917
Scratcher
18 posts

How to make cloud games?

thx y'all
when green flag clicked
say [you guys are the BEST!!!]
vincent0917
Scratcher
18 posts

How to make cloud games?

I tried griffpatch tutorial but it doesn't work. mabye cloud vars are down
AquaKelpie53
Scratcher
100+ posts

How to make cloud games?

Scyth3d wrote:

Dakota_The_Coder wrote:

Griffpatch has a series of tutorials on the subject. Look up “griffpatch cloud multiplayer” on Youtube and you should see it. But keep in mind the cloud variables are down right now, so it won't work.
Would like to make it more obvious

CLOUD IS DOWN

vincent0917 wrote:

I tried griffpatch tutorial but it doesn't work. mabye cloud vars are down
This was already stated earlier in this thread. (in #3 and #2 and #5)

Last edited by AquaKelpie53 (Sept. 16, 2025 03:36:46)

Powered by DjangoBB