Class ServerPopulatePrespawnedGhostsSystem
ServerPopulatePrespawnedGhostsSystem systems is responsible for assign to the pre-spawned ghosts their ghost ids and add add them to the spawn maps. It rely on the previous initialization steps to determine the subscene subset to process.
The server is authoritative and it is responsible for assigning unique id ranges to the each scene. For each section that present prespawn ghosts, the prespawn hash, id range and baseline hash are sent to client as part of the streaming protocol. Clients will use the received subscene hash and baseline hash for validation and the ghost range to assign the ghost id to the pre-spawned ghosts like the server. This remove any necessity for loading order determinism. Finally, clients will ack the server about the loaded scenes and the server, upon ack receipt, will start streaming the pre-spawned ghosts
======================================================================
THE FULL PRESPAWN SUBSCENE SYNC PROTOCOL
Server> calculates the prespawn baselines Server> assign runtime ghost IDs to the prespawned ghosts Server> store the SubSceneHash, BaselineHash and AssignedFirstId, PrespawnCount inside the the PrespawnHashElement collection Server> create a new ghost with a PrespawnSceneLoaded bufffer that is serialized to the clients
Client> will eventually receive the ghost with the subscene list Client> (in parallel or before) will serialize the prespawn baseline when a new scene is loaded Client> should validate that subscene data match Client> will assign the ghost ids to the prespawns Client> will ack the server that the scene has been received and witch sub-set of the scenes must be streamed to him
Namespace: Unity.NetCode
Syntax
public class ServerPopulatePrespawnedGhostsSystem : SystemBase
Methods
OnCreate()
Declaration
protected override void OnCreate()
OnUpdate()
Declaration
protected override void OnUpdate()