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.

Technical Behavior

Streaming In
  • When a player joins, all instances in the Workspace are sent, excluding BasePart|BaseParts/MeshPart|MeshParts and descendants of those instances.
  • During gameplay, the server streams in BasePart|BaseParts/MeshPart|MeshParts (and their descendants) to the client.
 Green indicates what gets sent during the join phase
 Purple 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)
Streaming Out
  • During gameplay a client may stream out (remove from the player’s Workspace) regions and the BasePart|BaseParts/MeshPart|MeshParts contained within them. This can occur when the client determines that insufficient memory is available. The process begins with regions furthest away from the player's character (or the Player/ReplicationFocus|ReplicationFocus) and moves in closer as needed.
  • Regions inside the Workspace/StreamingMinRadius|StreamingMinRadius range will never be streamed out.
  • Any part created locally (created by a LocalScript and not replicated to the server) is exempt from stream out unless it's a descendant of a part that exists on the server.

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

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.

Model Level-of-Detail

When streaming is enabled, models outside of the currently streamed area will not be visible. However, you can tell Roblox to create approximate “impostor meshes” for models that are not present on clients.

Level-of-detail works on a per-model basis and is selectable via the model’s LevelOfDetail property:

Option Description
StreamingMesh Activates the asynchronous generation of an imposter mesh to display when the model is not present on clients.
Disabled / Automatic The model will disappear if outside the streaming radius.
Usage Precautions
  • Imposter meshes are designed to be seen at a considerable distance from the player (1024 studs or higher). If you've reduced Workspace/StreamingTargetRadius|StreamingTargetRadius to a much smaller value like 256, imposter meshes may not be visually acceptable for the model they replace.
  • If a model and its descendant models are all set to StreamingMesh, only the imposter mesh of the top-level ancestor model will be rendered, wrapping all geometries under the top-level model as well as its descendant models. For better performance, it's recommended that you use Disabled for descendant models.
  • Textures are not supported; the imposter mesh will be rendered as a smooth mesh.

Tags:
  • streaming
  • performance
  • optimization