ACSUtils Wiki

An ACS library for ZDoom-based ports

User Tools

Site Tools


functions:syncvariable

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
Last revision Both sides next revision
functions:syncvariable [2017/07/16 17:12]
korshun created
functions:syncvariable [2017/07/16 17:26]
korshun
Line 1: Line 1:
 ====== SyncVariable ====== ====== SyncVariable ======
 +{{tag>zandronum}}
 ''void SyncVariable(int tid, num value)'' ''void SyncVariable(int tid, num value)''
  
Line 5: Line 6:
  
 ===== Description ===== ===== Description =====
-Synchronizes an arbitrary numeric variable from server to all clients. The synchronized value can be retrieved using [[GetSyncVar]] and [[GetSyncVarDefaut]]. If SyncVariable is called twice with the same value, no network traffic happens.+Synchronizes an arbitrary numeric variable from server to all clients using an unused tid. The synchronized value can be read clientside using [[GetSyncVar]] and [[GetSyncVarDefaut]].
  
-This function works by spawning an undetectable indestructible actor and using its Speed property to synchronize the value.+SyncVariable optimizes network traffic to only send packets if the synchronized variable is different.
  
-<note important>You can't synchronize strings this way. To synchronize strings, use a custom serverside string cvar in CVARINFO.</note>+This function works by spawning an undetectable indestructible actor the first time it's called and using its Speed property to synchronize the value. 
 + 
 +<note important>You can't synchronize strings this way because dynamic string indices are different between the server and the client. To synchronize strings, use a custom serverside string cvar in CVARINFO.</note>
  
 ===== Examples ===== ===== Examples =====
functions/syncvariable.txt · Last modified: 2018/02/19 23:01 by korshun