Improve client scanning for unloaded chunks to request
Potential improvements (some may conflict):
- Use a bitmap to record which chunks are loaded in order to avoid a hashmap lookup when checking if a chunk is loaded (such as https://github.com/myrrlyn/bitvec).
- There could be space at the edges of the bitmap such that it doesn't need to be shifted every time the player moves to a new chunk.
- Store a list of offsets ordered by distance for iterating through chunks in an expanding circle (they are only needed for a single quadrant or maybe even an octant).
- We already iterate in an expanding circle but the code is hard to follow, and it's only roughly in the order of closest to furthest.
- This could allow remembering what the last offset was that was checked to immediately pick up where the scan stopped once new chunks are loaded instead of restarting the scan (potentially an alternative to the first bullet point?).
- Don't scan if the limit for ongoing chunk requests has already been reached (currently 4).
- Stretch scan over multiple ticks