Struct ServerPopulatePrespawnedGhostsSystem
Responsible for assigning a unique ghostId to each pre-spawned ghost, and and adding the ghosts to the spawned ghosts maps. Relies on the previous initializations step to determine the subscene subset to process.
Inherited Members
Namespace: Unity.NetCode
Syntax
[WorldSystemFilter(WorldSystemFilterFlags.ServerSimulation, WorldSystemFilterFlags.Default)]
[UpdateInGroup(typeof(PrespawnGhostSystemGroup))]
[UpdateAfter(typeof(PrespawnGhostInitializationSystem))]
[BurstCompile]
public struct ServerPopulatePrespawnedGhostsSystem : ISystem
Remarks
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
The Server calculates the prespawn baselines.
The Server assigns runtime ghost IDs to the prespawned ghosts.
The Server stores the SubSceneHash
, BaselineHash
, AssignedFirstId
, and PrespawnCount
inside the the PrespawnHashElement
collection.
The Server creates a new ghost with a PrespawnSceneLoaded
buffer that is serialized to the clients.