Table of Contents

Class ClusterEntityRecordAccessor

Namespace
Typhon.Engine
Assembly
Typhon.Engine.dll

Static accessor for cluster entity records stored as raw bytes in the per-archetype RawValueHashMap.

public static class ClusterEntityRecordAccessor
Inheritance
ClusterEntityRecordAccessor
Inherited Members

Remarks

Base record layout: [EntityRecordHeader (14B)] [ClusterChunkId (4B)] [SlotIndex (1B)] = 19 bytes.

For archetypes with Versioned components, the record extends with per-Versioned-slot compRevFirstChunkId (4B each): [Base (19B)] [CompRevFirstChunkIdâ‚€ (4B)] ... [CompRevFirstChunkId_{V-1} (4B)]

Total: 19 + 4 * versionedSlotCount bytes.

The EntityRecordHeader is identical to the legacy format (same BornTSN/DiedTSN/EnabledBits).

Fields

BaseRecordSize

Base cluster entity record size (no Versioned slots): Header(14) + ClusterChunkId(4) + SlotIndex(1) = 19.

public const int BaseRecordSize = 19

Field Value

int

ClusterChunkIdOffset

Byte offset of ClusterChunkId within the record.

public const int ClusterChunkIdOffset = 14

Field Value

int

CompRevOffset

Byte offset where compRevFirstChunkId array starts (immediately after SlotIndex).

public const int CompRevOffset = 19

Field Value

int

HeaderSize

Size of the EntityRecordHeader in bytes (same as legacy).

public const int HeaderSize = 14

Field Value

int

SlotIndexOffset

Byte offset of SlotIndex within the record.

public const int SlotIndexOffset = 18

Field Value

int

Methods

GetClusterChunkId(byte*)

Read the cluster chunk ID (the cluster's chunkId in the ClusterSegment).

public static int GetClusterChunkId(byte* record)

Parameters

record byte*

Returns

int

GetCompRevFirstChunkId(byte*, int)

Read the compRevFirstChunkId for the given versioned index (0-based within Versioned slots only).

public static int GetCompRevFirstChunkId(byte* record, int versionedIndex)

Parameters

record byte*
versionedIndex int

Returns

int

GetHeader(byte*)

Get a reference to the header at the start of the record.

public static ref EntityRecordHeader GetHeader(byte* record)

Parameters

record byte*

Returns

EntityRecordHeader

GetSlotIndex(byte*)

Read the slot index within the cluster (0..63).

public static byte GetSlotIndex(byte* record)

Parameters

record byte*

Returns

byte

InitializeRecord(byte*, int)

Zero-initialize an entire cluster entity record (base + versioned extensions).

public static void InitializeRecord(byte* record, int versionedSlotCount)

Parameters

record byte*
versionedSlotCount int

RecordSize(int)

Compute the total record size for a cluster archetype with versionedSlotCount Versioned components.

public static int RecordSize(int versionedSlotCount)

Parameters

versionedSlotCount int

Returns

int

SetClusterChunkId(byte*, int)

Write the cluster chunk ID.

public static void SetClusterChunkId(byte* record, int chunkId)

Parameters

record byte*
chunkId int

SetCompRevFirstChunkId(byte*, int, int)

Write the compRevFirstChunkId for the given versioned index.

public static void SetCompRevFirstChunkId(byte* record, int versionedIndex, int chunkId)

Parameters

record byte*
versionedIndex int
chunkId int

SetSlotIndex(byte*, byte)

Write the slot index within the cluster.

public static void SetSlotIndex(byte* record, byte slotIndex)

Parameters

record byte*
slotIndex byte