Re-implemented chunk sending (#304)

Re-implement chunk sending, send chunks inside a radius instead of below a count

This sends chunks in concentric squares around players. When the radius is hit, it will pad out the radius until a full circle of chunks is loaded around the player.
TODO: implement radius-per-tick, send chunks in concentric circles, use radius for player spawning.

To set your server chunk radius, change `view-distance` in server.properties. Values are intended to be the same as MCPE render distance values. With matching client and server render distances the chunks should reach the horizon.

NOTE: You may notice significantly increased memory usage per player when increasing these values to something respectable. This is normal and expected.
A player with render distance 14 for example will cause loading of 600+ chunks. A player cannot however exceed the render distance limit set in server.properties - the server will simply not send any more chunks.

Render distance of 8 chunks is approximately 200 chunks. This is roughly equivalent to the original default max-chunks of 192 in pocketmine.yml, but sent in a circle instead of a square.

Wait for client to request a chunk radius before ordering chunks

Use 8 for default maximum radius (roughly matches old setting of 192)

Calculate spawn chunk count from chunk-sending.spawn-radius
This commit is contained in:
Dylan K. Taylor
2017-03-02 10:30:30 +00:00
committed by GitHub
parent d588222e84
commit 4fbc5738e3
4 changed files with 99 additions and 58 deletions

View File

@ -58,8 +58,8 @@ memory:
low-memory-trigger: true
max-chunks:
#Limit of chunks to load per player, overrides chunk-sending.max-chunks
trigger-limit: 96
#Maximum render distance per player when low memory is triggered
chunk-radius: 4
#Do chunk garbage collection on trigger
trigger-chunk-collect: true
@ -117,12 +117,11 @@ level-settings:
always-tick-players: false
chunk-sending:
#To change server normal render distance, change view-distance in server.properties.
#Amount of chunks sent to players per tick
per-tick: 4
#Amount of chunks sent around each player
max-chunks: 192
#Amount of chunks that need to be sent before spawning the player
spawn-threshold: 56
#Radius of chunks that need to be sent before spawning the player
spawn-radius: 4
#Save a serialized copy of the chunk in memory for faster sending
#Useful in mostly-static worlds where lots of players join at the same time
cache-chunks: false