Selective character replication

What is the best technique for only replicating specific characters to a client on Roblox? My game works using “levels” and only a few players would be in a level at once, so receiving data from the other potential 195 characters (in a 200 player server) is obviously not efficient

Right now, I have it so when a character loads it gets parented to a folder in workspace on the server, then the client will either keep it in that folder or parent it to nil depending on if it wants that character to be visible. If the other character joins the same level the current player is in, then the character will be reparented to workspace

Does this also disconnect the networking for that character and reconnect it once it gets parented to workspace? If not, is there any way to correctly manage networking for characters?

Bumping this topic. There is not enough documentation on character replication IMO.

Use StreamingEnabled and set a good distance to stop most rendering. However it is limited and doing levels could be better if you could manage Streaming.

Management;

Managing replication is considered an engine feature, as ROBLOX is limited in the extent of engine modifications, you cannot stop replication data from being sent to my knowledge but can stop it being rendered. This would be a great feature if you could selectively choose what descendants are replicated from the server.

I recommend, as an engine enhancement, to add additional support to streaming enabled.

PLAYER:StreamOut(Instance) - Unrenders the instance and it’s descendants
PLAYER:StreamIn(Instance) - Renders the instance and it’s descendants

Would work the same way as PLAYER:RequestStreamAroundAsync(Vector3), however rendered until StreamedOut. Of course no replication data should be sent to the client unless if it’s specified in the Streaming. Also you could “Tag” or add another Class named StreamInstance and it’d be a Instance to signify if the Instance is to be default rendered or not.
The game would use said class to further the simplicity of the game and break it down into levels.

Footnotes

This class could use a ID system so that you can send a request from the Client using the Class’s Instance name PLAYER:StreamIn(InstanceName) or just having the Class Instances replicated but not descendants.
May be easier to make separate world spaces for better management, just an idea, no clue how the engine rendering works to a science

TDLR:
You can delete the characters but it won’t stop the data from being sent in a normal circumstance without StreamingEnabled.

  1. I wouldn’t try doing this. ROBLOX hides a lot of the internals for character replication from you, so it would require a lot of work to get around.

  2. Your best best is probably just to eat the replication cost for other characters and Destroy() the ones you don’t want to be visible (keep a workspace:ChildAdded method around to track respawns as well).

  3. Selectively replicating the levels is pretty straightforward.

  4. If you really wanted to, you could re-implement characters. I don’t suggest it, though. StarterPlayer lets you override a lot of stuff, if you want to go down that path.

1 Like