Nebula
World partition

ChunkContext

What a game is told about one chunk of a chunked world.

generated from the sources
Struct in namespace Nebula.World · Packages/com.1by3.nebula/Runtime/World/NebulaChunks.cs
public readonly struct ChunkContext

What a game is told about one chunk of a chunked world. Passed by in reference so a content callback that runs for every chunk entering and leaving a role's window costs no allocation.

Fields

Coord

public readonly Vector3Int Coord;

Grid coordinate of the chunk. In a planar world y is always 0.

Id

public readonly ulong Id;

The chunk's stable 64-bit id (RuntimeGrid.IdOf), and the control-plane lease key.

Seed

public readonly int Seed;

A deterministic seed for procedural content, derived from Id alone: every role, every process and every run generate the same chunk without replicating a byte of it. Two scopes' chunks at the same coordinate have different ids, so they also have different seeds — a scoped copy of a world is a different world, not the same one twice.

Container

public readonly Container Container;

The Nebula runtime container this chunk is. Entities are spawned into it; it is leased by one worker.

Root

public readonly Transform Root;

Where the game parents its content. A child of Container, destroyed with the chunk, so a game that only parents under it never has to clean up in NebulaChunks.Unloading. It also keeps content out of Container.Entities' way: Nebula detaches networked objects when a chunk retires, and unnetworked content should simply go with it.

Role

public readonly NebulaRoles Role;

The roles this process runs. Content that only matters to a viewer checks IsHeadless instead.

IsHeadless

public readonly bool IsHeadless;

No one is looking: strip renderers and keep colliders. True on workers and on batchmode clients (bots).

ScopeKey

public readonly string ScopeKey;

The scope this chunk belongs to: "" for the public world, otherwise the key the grid was activated under. Content that is per-world (a seed offset, a biome table) keys off this.

Grid

public readonly RuntimeGrid Grid;

The grid this chunk is a cell of.

Properties

Center

public Vector3 Center { get; }

Centre of the chunk in the current floating-origin frame.

On this page