Fast Sync Variables Lib
-
I have made a project that uses the multiplayer blocks to sync any amount of (positive whole) numbers tied to labels pretty fast.
It’s like a library (coding libraries are files that you import into a project containing pre-programmed general purpose functions to make coding easier), you drag two custom blocks that don’t take up too much space into any sprite where you need to use it.
You can add any number of labels that will be across all clients in the sprite you backpack.
Everything you need to touch is in the upper left corner of the workspace.I plan on making more projects that act as libraries, provide any feedback in replies! (if somebody wants to understand what it doing I can add comments to the project and explain in replies, but you would only need them if you want to understand how it works, you don’t need comments if you just wanna use it)
https://play.creaticode.com/projects/67320febbf68856fe984969b
“Did you mean for it to say “Lib”?” - Catty
”Yes, lib is the standard abbreviation for library across all programming languages” - Tyller -
This is a great idea. Thank you for sharing.
Can you explain a bit more how it works internally? Most people are not familiar with the multiplayer blocks, and this can be a good example for learning about them.
-
@info-creaticode well it’s an iffy example for learning, I use the synchronously set direction block (because it’s the only multiplayer block where you directly set the value of the block, and multiplayer blocks use web sockets I believe, which i know are the fastest communication method) to set the direction of several clones precisely.
I use some math to turn the value that is supposed to be synced to several directions and vice versa.
(The person using the lib manually sets how many extra clones there are for each value, though 2 are likely only ever needed because 2 clones alone is 12600 max value)edit: Ig I’ll add comments because if people want to learn more technical details (or they know how technical stuff works and just need some explaining)
-
Yes, comments would be helpful. Also, you might want to clean up the blocks so it’s easier to read.
BTW, your code does not create or join any multiplayer game. Is that done separately?
-
@info-creaticode it does that in the backdrop, the lib is intended to have the setup ran after the user has joined a game, everything in backdrop is for demonstration purposes