Story Machine supports multiplayer sessions where two or more players can share a game over the network. This page covers the overall networking model.

Sessions, Hosts, and Clients

When a player hosts a multiplayer game, a session is created. The first player in the session is the host and every other player is a client. Clients send updates to the host, and the host relays those updates to the other players, which makes the host the central authority of the game state. A single session runs for the length of the game and persists across scene changes.

Player Slots

Each player in a session has a slot, a number identifying its role:

  • Slot 0 is always the host.
  • Slot 1 is the first client to join.
  • Slot 2 is the second client to join.
  • …and so on.

Slots are stable for the duration of a session. Story Machine assigns a slot to each player when they join and keeps it until the session ends.

What Gets Replicated

Story Machine ensures that three types of data are replicated across clients.

What How Authored as
Position, rotation, and scale of synchronized objects Network component on a game object Drop a Network component on the root of an object and assign it to a player slot.
Shared variables The Network section of the Variables pane Author variables under the Network section just like Project or Scene variables. Changes to those values will be automatically replicated across all clients.
Shared lists The Network section in the Lists pane Changes to lists under the Network section are automatically replicated to all clients
Trigger events Send Trigger with Search for receivers set to Network Broadcast Sends a trigger locally and also to all clients.

Component fields, animation playback state, sound playback, scene-scope and project-scope variables, and gameplay state outside positional information is not replicated and stays local to each player. To share them, set up network variables that describe the state and have each player watch those variables and make local changes to the scene.

Ownership and Authority

Objects with Network components are owned by a specific player. The owner of an object tells all the other players where that object should be in the scene.

For example, consider a simple game in which four players all have their own mouse cursors. The scene contains four cursor objects, one for each player, and each cursor object has a Network component that assigns each cursor to a particular player. At runtime, the scene considers its own network slot (via the networkPlayerSlot system variable) and sets its cursor object to match the user’s mouse. All the other cursors will be updated by network events from other players.

Network Variables and Lists

The Network sections of the Variables and Lists panes are similar to the Project sessions (game-wide definitions of variables and lists), except the values are automatically replicated across every player in an active session. Writing a Network variable immediately broadcasts the new value to every client. Late-joining clients receive a snapshot of the current state when they join, so they don’t start out of sync.

Since any client can change any list or variable at any time, you may choose to implement rules in your game (e.g. only the host is allowed to change some values, etc).

Network Trigger Broadcasts

The Send Trigger action can send a named trigger out to every client in a session by setting Search for receivers to Network Broadcast. The trigger fires locally on the originating client immediately and remote peers see receive it on a future frame once the network message has arrived.

Starting and Ending Sessions

Sessions are created, joined, and ended from a single action: Network. Drop one on a button or trigger and choose:

  • Host to open a session and become slot 0.
  • Join to connect to an existing host.
  • Leave to disconnect.

Testing Network Games

There are several ways to test network game play in Story Machine. Broadly, they are:

  • Running multiple game instances in the editor
  • Connecting one editor to another remote editor over a Local Area Network
  • Making a Steam build and running it with Steam infrastructure

Each of these methods comes with a few caveats. See below for details.

Testing With Multiple Player Windows

With a Story Machine game running in Play mode in the Editor, choose Run > Start Additional Network Player to open another instance of the game in a window. This is a completely separate copy of the game. You can start up to four instances in the editor, and networking between each instance will be simulated.

Running multiple copies of your game in a single editor is by far the fastest and easiest way to test network play. However, if your game is performance heavy the Story Machine editor may slow down when multiple instances are started.

Connecting Two Editors over a LAN

Using the Network pane in Windows > Network provides settings to help editors connect to each other over a Local Area Network. The pane has a mode toggle and, when connecting over a LAN, a couple of address settings:

  • Multiplayer Testing: Test Local Game Instances (default — for testing several player windows in a single editor) or Connect over LAN (for testing with editors on different machines).
  • Your addresses: the addresses associated with this machine. The host shares one of these with the other player so they can join. Shown only in Connect over LAN mode.
  • Address to join: the ip:port a Join-mode Network action will connect to (e.g. 192.168.1.42:5000). Shown only in Connect over LAN mode.

This pane controls the behavior of the Host and Join commands in the Network Action when running in the editor. Its settings are ignored in exported games, where the platform negotiates connections instead.

To test a networked game between two Story Machine editors on different machines:

  1. Both users open the project in their editor.
  2. Both: Window → Network, switch to Connect over LAN.
  3. Host: read your Your addresses list, pick one the other player can reach, share it.
  4. Other player: paste <host machine's ip>:5000 (or whichever port the game’s Host action uses) into Address to join.
  5. Both: run the game. The player who wishes to be the host should execute the Host command via the Network Action, and the other player should execute the Join command.

Troubleshooting Editor Connections

Story Machine can connect to a computer anywhere over the internet, but generally it is designed to connect to a computer on the same local network. Connecting to other editors over the internet is challenging because it is common for firewalls and NATs to reject connections on ports that they do not recognize. To connect to a computer that is not on the same network as the host, we recommend setting up a VPN like Tailscale or ZeroTier. These services handle the routing of traffic between the two machines and make them appear as if they are on the same local network.

Also note that on some host machines, the operating system may prompt to allow incoming UDP connections on the chosen port the first time you host. This is the operating system’s built in firewall doing its job, and it’s safe to allow the connection.

Networking in Player Builds

Currently only the Steam player supports networking at runtime. More platforms will be added in the future.