Nebula
World partition

ChunkGridDefinition

What one procedural chunk grid is: the cell arithmetic every role must agree on, plus the one chunk that is brought into being with the scope so a client always has somewhere to arrive.

generated from the sources
[Serializable]
public sealed class ChunkGridDefinition

What one procedural chunk grid is: the cell arithmetic every role must agree on, plus the one chunk that is brought into being with the scope so a client always has somewhere to arrive. It is the ScopeDefinition.Payload of a ScopeKind.Grid scope, which is why it is pure C# and carries no Unity asset reference: a matchmaker, the orchestrator and a test activate a grid without a WorldDefinition asset, and every role rebuilds the same grid from the scope row alone. Design of record: docs/scoped-chunk-grids.md.

Fields

CellSize

public Vector3 CellSize = new Vector3(64f, 512f, 64f);

Size of one chunk in metres, per axis. On a Planar grid Y is the column's height.

Planar

public bool Planar = true;

Chunks are columns: one layer at y = 0, centred on absolute y = 0 (see RuntimeGrid.Planar).

Ring

public int Ring;

Chebyshev ring the worker keeps leased around every pawn; 0 takes the role's own interest-derived ring.

RetireSeconds

public float RetireSeconds;

Seconds an unwanted, unoccupied chunk stays leased; 0 or less takes NebulaConfig.ChunkRetireSeconds.

Anchor

public Vector3Int Anchor;

The chunk activation creates: the scope's guaranteed spawn area, and the anchor the allocator keeps.

LeadSeconds

public float LeadSeconds;

Seconds of travel the allocator leases ahead of a moving pawn: besides the ring around the pawn's chunk, a ring around every chunk on the line from the pawn to where its velocity takes it in this many seconds, so a fast vehicle finds its next chunks leased before it gets there without a wider ring all round. 0 (the default) leases the ring alone.

Reach

public float Reach;

A hosted grid only (NebulaChunkedWorld.ActivateHostedGrid): how far outside its host container's box, in metres, a pawn still has chunks leased around it. 0 (the default) leases only for pawns inside the box. The same distance is measured from the box of the cell the pawn is over, so a pawn high over a grid whose cells don't fill the host's box (a sphere's in its bounding cube) leases nothing. A root grid ignores it.

Methods

Validate

public string Validate();

The reason this grid cannot be activated, or null when it is well formed.

NormalizedAnchor

public Vector3Int NormalizedAnchor();

The anchor with the vertical component a Planar grid does not have dropped.

AbsoluteBoundsOf

public Bounds AbsoluteBoundsOf(Vector3Int coord);

Box of a chunk in absolute world coordinates — the frame lease rows and scope parts use.

ToJson

public string ToJson();

FromJson

public static ChunkGridDefinition FromJson(string json);

Read a definition written by ToJson. Null when the payload is empty or not a grid payload.

ToScopeDefinition

public ScopeDefinition ToScopeDefinition();

The scope definition that activates this grid under scopeKey.

Infer

public static ChunkGridDefinition Infer(Vector3Int coord, Bounds absoluteBox);

The grid a single chunk is a cell of, from its coordinate and its box in absolute world coordinates. A role without a control plane — a client — never sees the scope row, only the container rows the gateway sent it, and those are enough: the box's size is the cell size, and a column grid is the one whose boxes are centred on y = 0 whatever the coordinate (AbsoluteBoundsOf), which no volumetric cell ever is. Null when the box is degenerate.

Of

public static ChunkGridDefinition Of(ScopeInfo scope);

The grid a scope row describes, or null when the row is not a grid scope.

On this page