Graphs
Online sides
When several machines play together, each runs its own copy of every graph. So every node says where it runs:
| side | runs | for |
|---|---|---|
| Authority | only where the game is decided: single player, the host, the server | anything that changes the game: giving items, hurting, spawning, starting quests, orders |
| Everywhere | on every machine | looks and sounds, maths, text, lists, the log, flow |
| Local | on the machine of the player it concerns | a note on a player's screen, the camera |
Every node's page says its side under Runs. On the bench, an action or event that doesn't run where the game is decided has a small all or local chip in its head.
What happens on each machine
- An event fires only where its side allows.
- An Authority action reached on a guest's machine is skipped: the run goes on through its
then, with its outputs empty. - Flow, maths, text, lists and variables run everywhere.
- So the Bells at Prime give bread once, on the server, while every player's own game shows them the note.
Offline and on a host, the machine that decides the game is also a player's, so everything runs there.
Sending to players
Graphs send nothing over the network by themselves. Where something decided on the server must reach players' machines (a note only the server can word, news picked at random once), three nodes send it:
| node | goes to |
|---|---|
| Send to everyone (name, value) | every player |
| Send to a player (player, name, value) | that player's machine |
| Send near (at, metres up to 500, name, value) | the players within the distance |
They run where the game is decided. Each player's machine hears it as When the server sends: its name, its value, and this machine's own player, on the Local side. Offline and on a host, the player hears it at once.
- A message is one value: yes or no, a whole number, a number, text (at most 512 bytes), a position, a colour, a person, a thing or an item by address, or a list of up to 32 of those. At most 1,024 bytes in all.
- A graph sends at most 20 a second; the rest are dropped and the graph is told once.
- Only the sending mod's graphs hear its messages, whatever names another mod uses.
- A client never makes the server run anything.
The town crier in Examples/graphs picks a piece of news where the game is decided and sends it to everyone, so every player hears the same one.
Showing a note to players
Show note is Local: it shows on the machine where it runs, for that machine's player. Show note to players runs where the game is decided and reaches the players named (or every player when none is), so a note can be put up from a server-side run directly. Both are choices of the Show a note node.
What can't reach a guest
An event the game raises only on the host can't drive looks on a guest's machine by itself: forward what is needed with a Send node.
Modding