한국어English日本語简体中文繁體中文DeutschไทยTiếng ViệtРусскийPortuguês (Brasil)EspañolBahasa Indonesia

Game Lag White Paper › Problems only some players hit

Entity ID reuse mix-up Entity ID reused without a generation counter

Cause ID pt-id-reuse · Primary owner Game team (Server development) · Also Game team (Client development)

Open the interactive card with figures and simulations →

If the server reuses the same entity ID when a dead NPC respawns, a client that missed the despawn message in between mistakes the new NPC for the old one.

Why An NPC dies and respawns with the same entity ID → Effect A client that missed the despawn message ignores the spawn message as an “already known entity,” or leaves the entity in its dead state → On screen The NPC is missing on one screen only or appears lying dead, and sometimes shows up looking like a different NPC

Symptoms
Invisible / ghost entities
Factors
Packet loss
Who’s affected
One client on the same PC, Just me
When
Randomly, When crowds gather
Owner
Primary owner Game team (Server development) · Also Game team (Client development)
Game team action items
Server: add a generation number to entity IDs to tell reuses apart. Client: when a spawn message arrives for a known ID, delete the existing entity and create a new one.
On the graph
Random spikes · Spawn messages for already known IDs
Where to look
Server log of creation and deletion times per entity ID (with generation number if any), plus the count of spawn messages the client received for known IDs and of delete-and-recreate cases treated as “no change” during AOI updates
Confirmed if
The invisible or dead-looking NPC has the same ID as an NPC that just died, and in between the client didn’t receive the despawn message or the server sent neither the despawn nor the spawn message
Ruled out if
IDs carry a generation number that is also used in comparisons: not this cause. Invisible even though the ID wasn’t reused: points to a lost spawn message
Check with
Game server or client logs and metrics
Learn more
It happens on the server side too. If the list of entities in view is compared by ID only, an NPC that died and respawned with the same ID between two AOI updates looks like “no change,” and neither the despawn nor the spawn message is sent. If AOI update timing differs from player to player, only the clients whose update lands on that moment are affected.

Sources

  1. Entity struct (Entities 1.3) Unity
    An Entity consists of an Index and a generation number (Version), which tells whether a reused Index is still valid
  2. NetworkConfig class (Netcode for GameObjects 2.5) Unity
    RecycleNetworkIds and NetworkIdRecycleDelay: network IDs are reused only after sitting unused for a set time

See also

Same layer: Problems only some players hit

Same symptom (Invisible / ghost entities), other layers

View the interactive card with figures and simulations