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();
|
||||
}
|
||||
|
||||
// TODO we already clear the serialized component's dirty bits above
|
||||
// might as well clear everything???
|
||||
//
|
||||
// TODO this unfortunately means we still need to iterate ALL
|
||||
// spawned and not just the ones with observers. figure
|
||||
// out a way to get rid of this.
|
||||
//
|
||||
// TODO clear dirty bits when removing the last observer instead!
|
||||
// no need to do it for ALL entities ALL the time.
|
||||
// TODO this is way too slow because we iterate ALL spawned :/
|
||||
// TODO this is way too complicated :/
|
||||
// to understand what this tries to prevent, consider this example:
|
||||
// monster has health=100
|
||||
// we change health=200, dirty bit is set
|
||||
// player comes in range, gets full serialization spawn packet.
|
||||
// next Broadcast(), player gets the health=200 change because dirty bit was set.
|
||||
//
|
||||
// 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();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user