PcoWSkbVqDnWTu_dm2ix

Game Content Streaming

Game Content Streaming

10 min

Game content streaming allows the Roblox engine to dynamically load and unload assets in regions of the world. This can improve the overall game experience in several ways, for example:

  • Faster Load Times — Players can start playing as soon as part of the world is loaded while more of the world loads in the background.
  • Wider Device Support — Games can be played on devices with less memory since content is dynamically streamed in and out.
  • Terrain Level-of-Detail — Distant terrain landmarks will be visible through lower-detail meshes even before they are fully streamed in.

Best Practices

Enabling content streaming is as simple as enabling StreamingEnabled on the Workspace object in Studio. During all phases of game development, however, be mindful of the following:

  • Clients will not typically have the entire Workspace available locally. Because of this, ensure that all LocalScript|LocalScripts function correctly by using Instance/WaitForChild|Instance:WaitForChild() for objects that are necessary within the script.
  • If you move a player’s character by setting its datatype/CFrame|CFrame, doing so from a server-side Script in favor of a LocalScript will let the server more quickly load data around the character’s new location.

  • Avoid parenting a part to another part rather than a model, especially when the parent is far away from the child. This can result in parts not streaming in when expected.

  • Manually setting the player’s Player/ReplicationFocus|ReplicationFocus should only be done in unique cases like in games that don’t use a Player/Character|Player.Character. In such cases, make sure the focus is near the object(s) that the player controls to ensure content continues to stream around the player’s interaction point.

Streaming Properties

The following properties control if and how content streaming will apply to your game. All of these properties are non-scriptable and must be set on the Workspace object in Studio.

StreamingEnabled

The Workspace/StreamingEnabled|StreamingEnabled property controls whether the game should utilize content streaming.

StreamingEnabled
StreamingMinRadius 64
StreamingPauseMode Default
StreamingTargetRadius 1024

At a technical level, a place with Workspace/StreamingEnabled|StreamingEnabled set to true works as follows:

  1. When a player joins, all instances in the Workspace are sent, excluding BasePart|BaseParts/MeshPart|MeshParts and descendants of those instances.
  2. During gameplay, the server streams BasePart|BaseParts/MeshPart|MeshParts (and their descendants) to the client.
 Green indicates what gets sent during the join phase
 Orange indicates things that are sent sometime later
Workspace (Workspace)
Camera (Camera)
Terrain (Terrain)  ← Object sent but regions sent only when needed
Script (Script)
Folder (Folder)
Script (Script)
Part1 (BasePart)  ← Skipped initially
Script (Script)  ← Sent along with Part1
MeshPart1 (MeshPart)  ← Skipped initially
WeldConstraint (WeldConstraint)  ← Sent along with MeshPart1
Model (Model)
MeshPart2 (MeshPart)  ← Skipped initially
Part2 (BasePart)  ← Skipped initially
Script (Script)
Script (Script)
Script (Script)

StreamingMinRadius

Workspace/StreamingMinRadius|StreamingMinRadius indicates the radius around the player’s character (or the Player/ReplicationFocus|ReplicationFocus) in which content will be streamed in at the highest priority.

StreamingTargetRadius

The Workspace/StreamingTargetRadius|StreamingTargetRadius property controls the maximum distance away from the player’s character (or the Player/ReplicationFocus|ReplicationFocus) in which content will be streamed in. Note that the engine is allowed to retain previously loaded content beyond the target radius, memory permitting.

StreamingPauseMode

Your game may behave in unintended ways if a player somehow moves into a region of the world that hasn’t been streamed to them. The streaming pause feature helps manage this by pausing the local physical simulation and normal character movement if content within Workspace/StreamingMinRadius|StreamingMinRadius isn’t yet streamed in. Non-physical systems will continue to run (scripts will continue executing, for example) and gameplay will resume after the engine has loaded enough content to minimize further pauses.

A pre-generated pause screen appears by default, but this can be customized

The Workspace/StreamingPauseMode|StreamingPauseMode property controls the pause behavior as follows:

Option Description
ClientPhysicsPause Client physics will pause until sufficient regions are streamed in.
Default Currently equal to Disabled but the default will become ClientPhysicsPause in the future.
Disabled No change to physical processing even if players are outside streamed-in regions. This may result in players falling through the world if network conditions are poor.

Streaming Requests

If you set the datatype/CFrame of a player to a region which isn’t currently loaded, streaming pause (if enabled) will occur. If you know the player will be moving to a specific area, you can call Player/RequestStreamAroundAsync|RequestStreamAroundAsync() to request that the server sends regions around that location to the client.

The following scripts show how to fire a client-to-server articles/Remote Functions and Events|remote event to teleport a player within a place, yielding at the streaming request before moving the character to a new datatype/CFrame.

Usage Precaution

Requesting streaming around an area is not a guarantee that the content will be present when the request completes, as streaming is affected by the client’s network bandwidth, memory limitations, and other factors.


Customizing the Pause Screen

The Player/GameplayPaused|Player.GameplayPaused property indicates the player’s current pause state. This property can be used with a Instance/GetPropertyChangedSignal|GetPropertyChangedSignal() connection to show or hide a custom GUI.

Tags:
  • streaming
  • performance
  • optimization