mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 11:00:32 +00:00
NetworkServer.Broadcast: explain ClearSpawnedDirtyBits better
This commit is contained in:
parent
acebef0e16
commit
20056edc0f
@ -1609,16 +1609,19 @@ static void Broadcast()
|
|||||||
connection.Update();
|
connection.Update();
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO we already clear the serialized component's dirty bits above
|
// TODO this is way too slow because we iterate ALL spawned :/
|
||||||
// might as well clear everything???
|
// TODO this is way too complicated :/
|
||||||
//
|
// to understand what this tries to prevent, consider this example:
|
||||||
// TODO this unfortunately means we still need to iterate ALL
|
// monster has health=100
|
||||||
// spawned and not just the ones with observers. figure
|
// we change health=200, dirty bit is set
|
||||||
// out a way to get rid of this.
|
// player comes in range, gets full serialization spawn packet.
|
||||||
//
|
// next Broadcast(), player gets the health=200 change because dirty bit was set.
|
||||||
// TODO clear dirty bits when removing the last observer instead!
|
|
||||||
// no need to do it for ALL entities ALL the time.
|
|
||||||
//
|
//
|
||||||
|
// this code clears all dirty bits if no players are around to prevent it.
|
||||||
|
// BUT there are two issues:
|
||||||
|
// 1. what if a playerB was around the whole time?
|
||||||
|
// 2. why don't we handle broadcast and spawn packets both HERE?
|
||||||
|
// handling spawn separately is why we need this complex magic
|
||||||
ClearSpawnedDirtyBits();
|
ClearSpawnedDirtyBits();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user