Fix chunk block changes being sent out of order (#5169)
* Flush out all pending, buffered changes at the end of each tick, after every chunk is ticked. This makes every block update client-side in unison, instead of unlucky ones only being sent 1 tick later.
* Re-add buffer for outgoing network data; IOCP async WSASend has higher overhead than expected... Fixes regression introduced in 054a89dd9
This commit is contained in:
@@ -1339,10 +1339,18 @@ void cChunkMap::SpawnMobs(cMobSpawner & a_MobSpawner)
|
||||
void cChunkMap::Tick(std::chrono::milliseconds a_Dt)
|
||||
{
|
||||
cCSLock Lock(m_CSChunks);
|
||||
|
||||
// Do the magic of updating the world:
|
||||
for (auto & Chunk : m_Chunks)
|
||||
{
|
||||
Chunk.second.Tick(a_Dt);
|
||||
}
|
||||
|
||||
// Finally, only after all chunks are ticked, tell the client about all aggregated changes:
|
||||
for (auto & Chunk : m_Chunks)
|
||||
{
|
||||
Chunk.second.BroadcastPendingChanges();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user