astei / krypton

A Fabric mod that optimizes the Minecraft networking stack and entity tracker.
GNU Lesser General Public License v3.0
367 stars 34 forks source link

Send chunks closest to player first #69

Closed solonovamax closed 2 years ago

solonovamax commented 2 years ago

Currently, krypton iterates through chunks and begins sending chunks to the player beginning in the negative x and negative z corner, then moving along the z axis, before wrapping up to the x. The pattern in which the chunks are sent to the client is illustrated here, where the green dot is the player and the red numbers are the order the chunks load in:

The cause for this can be found in the ThreadedAnvilChunkStorageMixin class, in the method updatePosition.

This causes the further chunks from the player to be sent first, which feels as if the server is performing slowly for high ping players. Thus, players with a slow connection will perceive servers with krypton as performing worse than those without. Further, this breaks vanilla behaviour, as vanilla minecraft sends chunks closest to the player first.


It would be much better if the closest chunks were the ones that were sent first, as shown in this illustration here:

Thus allowing for slower clients to begin playing without having to wait for roughly half of the chunks to be sent.

Kichura commented 2 years ago

Can confirm this on my own linux machine here as the chunks would always begin rendering from the right of 0 degrees instead of the suggestion below - wonder what astei can pull off with this.