The s&box networking API is split across three layers: theDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/facepunch/sbox-public/llms.txt
Use this file to discover all available pages before exploring further.
Networking static class for session management, the Rpc static class and its nested attributes for remote procedure calls, and the [Sync] attribute for automatic property synchronization. This page covers all three layers with their real signatures taken from source.
Networking.IsHost returns true even in a local single-player session.
Use Networking.IsActive to check whether a real multiplayer session exists.Networking static class
Session state
true if this peer is the host of the current session, or if no networked session exists (local play).true if this peer is connected to a server and is not the host.true when a NetworkSystem instance is active — i.e. a real multiplayer session exists.true while the initial connection handshake is in progress.The maximum number of players allowed in the current session. Set by the host via
LobbyConfig.The display name of the server. Setting this on the host propagates the new name to all connected clients.
The name of the map currently in use on the server.
Live statistics from the host including bandwidth usage and frame rate. Returns
default when not connected.Lobby management
Creates a Steam lobby using the provided configuration. Throws if called outside a game context or if the session is already active.
Queries available lobbies for the given game ident and connects to the most-populated one. Returns
true on success.Connects to a server.
target can be a Steam ID (as a ulong string), an IP address, or "local" for a local TCP connection.Connects directly to a peer by Steam ID.
Attempts to connect to a Steam lobby or peer, retrying up to
retries times.Disconnects from the current session and tears down the
NetworkSystem.Server data
Sets a key/value pair on the server that other players can query when browsing lobbies. Keep keys and values short — Steam enforces a character limit on server tags.
Gets a server data value set by
SetData. Returns defaultValue if the key is not set.RPC attributes
RPCs let you call a method on one peer from another. Decorate a method with one of theRpc.* attributes — the engine code-generates the network dispatch automatically.
Rpc.Broadcast
The method runs on all connected clients (and the host). Use for events that every client needs to react to — sound effects, score updates, particle spawns.
Rpc.Host
The method runs only on the host. Use this when a client needs to ask the host to perform an authoritative action (picking up an item, spending currency, validating a move).
Rpc.Owner
The method runs on the owner of the
GameObject, or on the host when the object is unowned. Use this to send authoritative state to the client who controls a particular object.RPC context
Inside an RPC method you can inspect who invoked it:The
Connection that triggered this RPC call. Read this inside an RPC method to identify the sender.The
Guid of the calling connection. Equivalent to Rpc.Caller.Id.true when the current execution context is inside an RPC callback from a remote connection.Filtering recipients
UseRpc.FilterInclude or Rpc.FilterExclude to narrow the recipient set for any Rpc.Broadcast call within the scope:
Restricts RPC recipients to the provided connections for the duration of the
using block.Restricts RPC recipients to connections that satisfy the predicate.
Restricts RPC recipients to a single connection.
Excludes the provided connections from receiving the RPC.
Excludes connections that satisfy the predicate.
Excludes a single connection from receiving the RPC.
[Sync] attribute
[Sync] marks a property on a networked component for automatic synchronization from the owner to all other clients. The engine intercepts the property setter and getter at compile time via code generation.
Synchronizes the property from the owner to all other clients.
SyncFlags
The host owns the value and propagates it to all clients. Use this for game-state properties that only the host should write, such as team assignments or round timers.Previously done with the now-obsolete
[HostSync] attribute.Tells the network system to poll the property getter every tick rather than relying on the setter being called. Use this when the property value can change without an explicit setter call — for example a computed property.
Smoothly interpolates the value between network ticks on proxy clients. Supported types:
float, double, Angles, Rotation, Transform, Vector3.NetworkFlags
NetworkFlags is a flags enum that configures how the transform of a NetworkObject is synchronized. Set it on GameObject.Network.Flags.
| Flag | Value | Effect |
|---|---|---|
None | 0 | Default: all transform components are synchronized. |
NoInterpolation | 1 | Disables network interpolation for this object. Transform changes snap immediately on proxy clients. |
NoPositionSync | 2 | Position is not synchronized over the network. |
NoRotationSync | 4 | Rotation is not synchronized over the network. |
NoScaleSync | 8 | Scale is not synchronized over the network. |
NoTransformSync | 14 | Combines NoPositionSync, NoRotationSync, and NoScaleSync. No transform data is sent. |
Usage examples
Related pages
Networking overview
Host/client model, NetworkObject ownership, and lifecycle events.
Sync vars guide
Detailed walkthrough of
[Sync], SyncFlags, and ownership-aware sync.RPCs guide
Step-by-step guide to writing and calling RPCs safely.
Game class
Global session state and
Game.ActiveScene.