Table of Contents

Class ChunkStreamer

Namespace
Shard.Gameplay.Universe.World.Chunks
Assembly
Shard.Gameplay.Universe.dll

Selects the cubic chunks to send a player, streaming per (x,z) column so the client has each column's SetColumn container before its SetChunk sections (otherwise the client buffers the sections waiting for the column). Walks a horizontal square of radius horizontalRadius chunks, nearest column first (Chebyshev rings), across chunk-Y in [minChunkY, maxChunkY]; a column fully outside the world bounds is skipped. Streaming policy (how much, how paced) is the caller's; this is the pure selection.

public static class ChunkStreamer
Inheritance
ChunkStreamer
Inherited Members

Methods

ChunkRadius(int)

Convert a block view radius (as the client reports it) to a chunk radius (≥1).

public static int ChunkRadius(int viewRadiusBlocks)

Parameters

viewRadiusBlocks int

Returns

int

Column(ChunkStorage, int, int, int, int, short)

One column's packets: its SetColumn then a SetChunk per cube. Empty if any cube-Y is out of bounds (the whole column is dropped for now). Used for both the initial region and the follow-on stream.

public static IEnumerable<IToClientPacket> Column(ChunkStorage storage, int chunkX, int chunkZ, int minChunkY, int maxChunkY, short environmentId)

Parameters

storage ChunkStorage
chunkX int
chunkZ int
minChunkY int
maxChunkY int
environmentId short

Returns

IEnumerable<IToClientPacket>

ColumnsInRadius(ChunkPos, int)

The (x,z) columns of the region around center, nearest ring first.

public static IEnumerable<(int X, int Z)> ColumnsInRadius(ChunkPos center, int horizontalRadius)

Parameters

center ChunkPos
horizontalRadius int

Returns

IEnumerable<(int X, int Z)>

Region(ChunkStorage, ChunkPos, int, int, int, short)

The column packets for the region around center, nearest column first. Each in-bounds column yields its SetColumn followed by one SetChunk per cube (an all-air cube's Data is null).

public static IEnumerable<IToClientPacket> Region(ChunkStorage storage, ChunkPos center, int horizontalRadius, int minChunkY, int maxChunkY, short environmentId)

Parameters

storage ChunkStorage
center ChunkPos
horizontalRadius int
minChunkY int
maxChunkY int
environmentId short

Returns

IEnumerable<IToClientPacket>