Table of Contents

Struct ArchetypeR1

Namespace
Typhon.Engine
Assembly
Typhon.Engine.dll

Persisted archetype schema. One entity per registered archetype. Enables load-time validation: mismatch between persisted and runtime archetype definitions → hard error.

[Component("Typhon.Schema.Archetype", 2)]
public struct ArchetypeR1
Inherited Members

Remarks

Revision 2 (#661) appends ClusterIndexSPI / ClusterString64IndexSPI. Both are appended, so every pre-existing field keeps its id, and an added field is CompatibilityLevel.CompatibleSchemaEvolutionEngine zero-fills it with no migration function, and zero is already the "not persisted, rebuild" sentinel the other SPIs use.

Fields

ArchetypeId

Per-process catalog id (from [Archetype] today; generator-assigned after Phase 5). Identity re-match on reopen is by Name, not this value — it is not stable across processes once the generator owns numbering.

public ushort ArchetypeId

Field Value

ushort

AssemblyId

AssemblyR1 row id (chunkId) of the assembly that declares this archetype. 0 = core engine assembly (implicit, never in the manifest).

public ushort AssemblyId

Field Value

ushort

ClusterIndexSPI

Root page index of this archetype's per-archetype secondary-index segment (default 256-byte node stride); 0 = not persisted, rebuild from cluster data.

public int ClusterIndexSPI

Field Value

int

Remarks

The archetype's index-segment root. Lived in the bootstrap dictionary under clusterindex.{ArchetypeId} until #661 — a key built from a value this very struct documents as not stable across processes (see ArchetypeId), outside CK-10's coverage, and consuming ~22 B of a fixed 8016 B bootstrap page for every archetype.

ClusterSegmentSPI

Root page index of the ClusterSegment (0 = no cluster storage).

public int ClusterSegmentSPI

Field Value

int

ClusterString64IndexSPI

Root page index of this archetype's String64 index segment (wider node stride, #658); 0 = absent or not persisted.

public int ClusterString64IndexSPI

Field Value

int

Remarks

The archetype's String64 index-segment root. Allocated only when the archetype indexes a String64 field.

ComponentCount

Total component count (own + inherited).

public byte ComponentCount

Field Value

byte

ComponentNames

Component schema names in slot order, stored in VSBS.

public ComponentCollection<String64> ComponentNames

Field Value

ComponentCollection<String64>

EntityMapSPI

Root page index of the EntityMap segment (0 = not persisted, rebuild from PK indexes).

public int EntityMapSPI

Field Value

int

Name

Archetype CLR type name (e.g., "Building").

public String64 Name

Field Value

String64

NextEntityKey

Resume entity key counter on reopen (avoids scanning PK indexes).

public long NextEntityKey

Field Value

long

NoParent

Sentinel ParentArchetypeId value meaning "no parent" (a root archetype).

public const ushort NoParent = 65535

Field Value

ushort

ParentArchetypeId

Parent archetype ID (0xFFFF = no parent).

public ushort ParentArchetypeId

Field Value

ushort

Revision

Schema revision from [Archetype(Revision)].

public int Revision

Field Value

int

RoutingId

Per-DB, engine-assigned archetype routing id — the value embedded in every EntityId of this archetype. Assigned monotonically (dense) on first registration into this database, persisted here, and restored by Name match on reopen so existing EntityIds keep resolving. This is the durable per-DB archetype identity used for EntityId routing.

public ushort RoutingId

Field Value

ushort

SchemaName

Fully-qualified schema name of this record ("Typhon.Schema.Archetype").

public const string SchemaName = "Typhon.Schema.Archetype"

Field Value

string

_pad0

Reserved padding to preserve field alignment; unused.

public byte _pad0

Field Value

byte