6.8 KiB
| title | description |
|---|---|
| Client-server runtime | An overview of the client-server model in Roblox. |
Server
Roblox experiences are multiplayer by default and run in a client-server model. The Roblox server is the ultimate authority for maintaining the experience's state, and is responsible for keeping all connected clients in sync with the server.
Client
When an experience runs, Roblox copies a version of the "edit" data model that you built and published from Studio and runs it on Roblox servers as the "runtime" data model.
Connected clients also receive a copy of the runtime data model and any
initialization of the player occurs, such as initializing a player's backpack
(inventory) or local user interface. When an experience has
Class.Workspace.StreamingEnabled set to true, the server initially only sends
a subset of content under Class.Workspace that is closest to the client. The
client then renders the 3D world and begins running any
applicable scripts.
Replication
The server constantly updates connected clients, keeping everything in sync across the server and clients through a process called replication, which synchronizes the data model, physics simulation, and chat messages. Replication logic exists on both the client and server to ensure synchronization.
Data model changes can occur in a variety of cases, such as when something in the 3D world is created or a property of the 3D world changes. This typically occurs when a script on the server or client makes a change that needs to be reflected on the other side of the client-server boundary. The following diagrams show common scenarios for data replication.
Roblox replicates physics simulation data between the server and clients when necessary. To assist with simulation performance, Roblox can assign ownership of assemblies to a specific client or server. This means that the client or server can be responsible for simulating the physics of that assembly. Other clients receive updates about the assembly's position and movement from the owning client or server. Ownership typically happens automatically, but you can assign it directly for fine-tuned responsiveness.
Most players on Roblox experience between 100–300 milliseconds of network latency. [Roblox Studio](../studio/index.md) playtesting runs with a default of no latency, but you can change **Incoming Replication Lag** in the **Network** section of Studio's settings (AltS on Windows; ⌥S on Mac) to `0.1`–`0.3` to better simulate how replication latency will affect your experience.