Client Data
A message not to the screen but into the client's program: a channel, a value and a choice between «reliable» and «fast»
hardYou need: Broadcast a variable, What a world processor is
clientdata "score" points 1| Field | What is in it |
|---|---|
| first | the channel: a name-string by which a client tells one from another |
| second | the value: a number or an object |
| third | whether to deliver reliably |
How it differs from sync
Section titled “How it differs from sync”sync broadcasts a processor’s variable: the client receives its value into that same
variable and can read it as usual.
clientdata is not tied to any variable. It sends a value to a channel — to a name the
script invented — and it arrives not in the client’s logic but in their game: mods and
client-side add-ons use this.
sync |
clientdata |
|
|---|---|---|
| what it sends | a variable’s value | an arbitrary value on a channel |
| where it arrives | into the same variable on the client | into a channel handler |
| limit | 20 times a second per variable | none of its own |
| what for | showing a client a number | connecting a script to a mod |
Reliable or fast
Section titled “Reliable or fast”The third field chooses how it is delivered:
- reliably (
1): the packet will arrive, and arrive in order — like an ordinary message. More expensive; - unreliably (
0): send and forget. It may be lost, but it is cheap — that is how things are sent that update constantly and can afford to lose a frame.
Unofficial fan project, not affiliated with Anuke. Mindustry sprites, fonts and translations © Anuke, used under GPL-3.0; Fira Code under OFL-1.1. Site code is GPL-3.0.