Component
In one line: a plain blittable struct of data — the atom of the Typhon data model.
A component is just data: public, blittable value-type fields, no base class, no interface. The [Component("stable.name", revision)] attribute makes it storable — the name is its schema identity, the revision its version (bumped when you evolve it). Each component type also picks a storage mode, which decides its ACID guarantees and write cost.
You never touch a component through the engine directly — you refer to it by its typed handle, a Comp<T>, obtained when an archetype registers it (Unit.Health). That handle is how you set values on Spawn, and Read/Write on an opened entity.
How it relates
- Archetype — a fixed set of components; the archetype hands you each component's
Comp<T>handle. - Storage mode — chosen per component; decides isolation, durability, and cost.
- Index / Spatial index — a component field can be indexed for fast lookup.
- Schema evolution — changing a component's fields is a versioned, migrated operation.
- Component collections — a component field can hold a per-entity variable-length list (the one exception to fixed-size).
In the API
- Comp<T> — the typed component handle you register and reference slots with.
[Component("name", revision, StorageMode = …)]— the attribute that makes a struct storable (declaration-only, not in the API reference).
Learn & use
- Narrative: Guide ch.1 — components are plain structs · ch.2 — modeling
- Feature detail: component field declaration · storage modes