Vixen
02b45cc4
csharp
public sealed class WorldContent

A whole world in bytes: every live entity, what it carries, and where it hangs.

Read the guide page for this →

Remarks

The on-disk sibling of WorldSnapshot, and the difference between them is the whole reason this waited for the scene format. A snapshot copies chunk rows into another world — raw bytes, one memcpy an archetype, no knowledge of what a component is — which is fast, is what makes in-process play mode possible, and is worth nothing outside the process that took it. Bytes with a field order in them are not a format. Naming each component by its [DataContract] alias and writing it through its generated serializer is what makes a world something a save file, a determinism checkpoint or a bug report can hold.

It reuses SceneBlock and SceneColumn rather than declaring a second pair of the same thing. A compiled scene and a captured world differ in what they contain and not in how a run of entities that share an archetype is written down — archetype-major, one column per component, the entity order implied by the block. Two shapes would be two things to keep in step.

⚠ Entity handles are not stored, and this is the one design decision everything else here follows from. Entity is a slot index, a generation and a world id; all three are properties of a running process, and Entity's own remarks say a saved one means nothing when loaded back. So the hierarchy travels as Parents — an index into this content's own order — exactly as a compiled scene's does, and Parent, Child and Sibling are never written at all: they are rebuilt by the link pass from that table. A game component holding an Entity is a different problem and is not solved here; see WorldSerializer.Capture, which reports it.

Fields and properties (5)

  • public int Count

    How many entities it holds.

  • public int[] Parents

    Each entity's parent, as an index into this content's order, or -1 for a root.

  • public SceneBlock[] Blocks

    Its entities, grouped by what they carry.

  • public string[] Dropped

    The components that were on entities in the captured world and are not in here, by CLR type name, sorted and without repeats.

  • public bool IsComplete

    Whether everything on every captured entity is in here.

Methods (1)

  • public void Validate()

    Checks the tables agree with each other before anything is created.

Used by (4)

  • TypeRegistrationVixen.Engine
  • Vixen_Engine_Worlds_WorldContentSerializerVixen.Engine
  • WorldSerializerVixen.Engine
  • WorldSerializerTestsVixen.Engine.Tests