Skip to main content

Module chunk_sender

Module chunk_sender 

Source
Expand description

This module is responsible for sending chunks to the client.

Chunk sending runs on its own independent tick loop, separate from the game tick. The three-phase design (prepare โ†’ encode โ†’ commit) minimizes lock hold time on the per-player ChunkSender mutex so that game-tick operations like mark_chunk_pending_to_send and drop_chunk are never blocked for long.

Structsยง

ChunkSender
This struct is responsible for sending chunks to the client.
EncodedChunk
Encoded chunk packet plus the holder and readiness generation it was built from.
PreparedBatch
Data collected during the prepare phase, used to encode and then commit.
PreparedChunk
One chunk selected during the prepare phase.

Constantsยง

MAX_CHUNKS_PER_TICK ๐Ÿ”’
Maximum chunks per tick (vanilla: 64.0, we use 500.0 for faster loading)
MAX_UNACKNOWLEDGED_BATCHES ๐Ÿ”’
Maximum unacknowledged batches after first ack (vanilla: 10)
MIN_CHUNKS_PER_TICK ๐Ÿ”’
Minimum chunks per tick (vanilla: 0.01)
START_CHUNKS_PER_TICK ๐Ÿ”’
Starting chunks per tick (vanilla: 9.0)