.:[STICKY]:. Synchronization of variables

Tutorials and guides for Plazma Burst and community features.

.:[STICKY]:. Synchronization of variables

Postby Nyove » 29 May 2020, 05:39

A lot of people have been asking me about synchronization of variables. Here's a detailed explanation on how it works.
It seems complicated, but once you get it it's really just 3 triggers and 2 timers.

For an map example, refer to laserguide-sync.
(laserguide also has other unique tutorials ranging from basic like command system to advanced like angular machines, do check it out!)

We will be mainly using the trigger action that syncs according to maximum value, as this is the most reliable so far.
(You can experiment with other trigger actions if you wish)

---

Concept of how this trigger action works
The player who executes the sync trigger action, causes OTHER players to have their variables get synced. (but not himself.)

Laserguide-sync explanation
Imagine P1 and P2.
P1 is currently in a match, with a variable that contains 5, while P2 is not in the match yet.

This map has a trigger, #syncDelay, that is executed whenever a player joins a match.
This trigger contains a timer which activates another trigger #sync after a delay. The #sync trigger runs the sync trigger action.

This map also set that variable to contain -1 at the very start of the match.

When P2 joins the match, his variable is first set to -1.
Then, in P1's screen, #syncDelay is executed, which executes #sync after a delay.

Because P1 runs the trigger action, he causes P2's variable to sync. Since P1's variable is 5, while P2's variable is -1, the sync action will change P2's variable to 5.

When P3 or any other further players connect to the match, the existing players in the match (having their variable synced) will run #syncDelay again - causing future players' variables to get synced as well.

NOTE : The delay used for #syncDelay must be longer than map loading time (in HIGH DISPLAY MODE). If your map takes 10 seconds to load, the sync delay should be 11 seconds. No map will load longer than 15 seconds, so the highest possible sync delay is >15 seconds. (>450)

--

Common syncing issues
1. Missing "Enable Var Sync" engine mark
2. Timer delay not set to be longer than map loading time.

If you still have any enquiries feel free to PM me in discord.
Nyove#4623

--

Not important but if you want to know - explanation for timer delay needing to be longer than map delay

Whenever a player joins a match, he is considered connected to the match even when the map starts to get loading.
So, if we don't include a #syncDelay and run #sync immediately when a player connects, the #sync trigger effect will take place and *attempts* to sync the connecting player. However, since the player's map is still loading, his variable's are not even set yet and therefore the sync failed.
Proud to be part of something meaningful.
Need any assistance? Join the PB2 discord server at https://discord.com/invite/Bhe9rNz or raise a support ticket at https://www.plazmaburst2.com/support

Contact me on discord for quickest reply possible.

User avatar
Nyove
Moderator
 
Posts: 255
Joined: 7 July 2016, 10:26
Location: Cicada 3301

Return to Tutorials

Who is online

Users browsing this forum: No registered users