Hrmpth. Trade-offs.
I can either make the game have a high peak frame rate, or have a smooth frame rate. I’ve condensed it down to a single constant number called CHUNK_SIZE.
If it’s set to 32, the game does this while rebuilding chunks (sunrise, sunset, loading a level, walking fast:)
The red bar is how long each frame takes in ms. Huge differences like that means stuttery performance.
And this when finished rebuilding chunks:
A chunk size of 16 looks like this when rebuilding:
And like this when finished:
So while a chunk size of 32 has a peak fps of almost twice that of 16 fps, the time it takes to rebuild a chunk is waaaay longer, causing much more uneven fps, to the point where the bare minimum of one rebuild per frame still causes the average frame rate to drop to a third of the maximum, and causing a lot of stuttering.
With 16 chunk size, the maximum frame rate is almost half that of 32, but the game runs a lot smoother, and more importantly, the difference between rebuilding chunks and not is much less noticeable.
(The regular spikes are the game logic ticks)