1
0

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:
Tiger Wang
2021-03-28 14:44:20 +01:00
committed by GitHub
parent 125df19477
commit 2687f2df30
5 changed files with 91 additions and 51 deletions

View File

@@ -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();
}
}