Vixen
02b45cc4
csharp
public sealed class Archetype

Every entity that has exactly one particular set of components, and the chunks holding them.

No guide page documents this yet — the page shows what the code says about itself.

Remarks

An archetype is created the first time an entity needs it and lives as long as the world, because a query caches the archetypes it matched and a mask taken before one disappeared would start meaning something else.

The add/remove edges are the single biggest difference between a naive archetype ECS and a good one: Add<Velocity> on an entity that already has Position is a dictionary hit on this archetype, not a hash of a recomputed type set.

Fields and properties (9)

  • public const int ChunkBudget

    How large a chunk is, before an archetype too wide to fit one entity overrides it.

  • public ComponentSignature Signature

    The component types every entity here has, sorted.

  • public BitSet Mask

    The same set as a bit per component id, which is what a query tests against.

  • public int EntityCount

    How many entities are in the archetype.

  • public int ColumnCount

    How many components have chunk storage. Tags do not, so this can be less than the signature.

  • public int ChunkCapacity

    How many entities one chunk holds.

  • public int ChunkBytes

    How many bytes one chunk is.

  • public IReadOnlyList<Chunk> Chunks

    The chunks, in no meaningful order.

  • public World World

    The world this belongs to. An archetype is never shared between worlds.

Methods (3)

  • public int ColumnOf(ComponentTypeId id)

    The chunk column a component occupies here, or -1 if it is a tag or not present.

  • public bool Has(ComponentTypeId id)

    Whether an entity here has the component, including tags.

  • public override string ToString()

    Renders the component set, which is what a diagnostic wants to see.

Used by (23)

  • ChunkVixen.Ecs
  • ChunkSequenceVixen.Ecs
  • CommandBufferTestsVixen.Ecs.Tests
  • EntityInfoVixen.Ecs
  • EnumeratorVixen.Ecs
  • PrefabVixen.Engine
  • QueryVixen.Ecs
  • QueryDescriptionVixen.Ecs
  • QueryTestsVixen.Ecs.Tests
  • RecreateTestsVixen.Ecs.Tests
  • SceneContentVixen.Engine
  • StructuralPropertyTestsVixen.Ecs.Tests
  • WorldVixen.Ecs
  • WorldDigestVixen.Ecs
  • WorldSerializerVixen.Engine
  • WorldTestsVixen.Ecs.Tests
  • ItemVixen.Editor.SceneView
  • SceneCloneVixen.Editor.SceneView
  • SceneSerializerVixen.Editor.SceneView
  • SceneStatisticsVixen.Editor.Profiler
  • SceneTestsVixen.Editor.SceneView.Tests
  • SubtreeSnapshotVixen.Editor.SceneView
  • WorldSnapshotVixen.Editor.SceneView