public static class WorldSerializerTurns a whole world into WorldContent and back.
Remarks
The item [14](../../../docs/plan/14-roadmap.md) parks behind the scene format, and the dependency was real rather than administrative. A world is entities and the bytes in their chunks; what it is not is anything that knows what those bytes mean. Naming a component and finding its serializer is SceneComponentRegistry's job, and until that existed a world serialiser could only have written raw chunk memory — which is WorldSnapshot, is the right answer for play mode, and is not a format.
It lives here and not in Vixen.Ecs because the pieces do. The ECS references no serializer by design; the binders and the transforms are the engine's. A seam in the ECS filled from here would be a second way to say the same thing, and the layer boundary is what would have to hold it up.
⚠ Three components are never written, and are rebuilt instead: Parent, Child and Sibling. All three hold Entity handles, which are slots in a running process. Storing them would mean either remapping bytes nothing can identify as handles, or promising to hand back the same slot numbers — and the second is a promise a fresh world cannot keep. The hierarchy travels as a table of indices and the links are made by SetParent, which is the same bargain SceneContent struck and for the same reason.
⚠ A game component holding an Entity is not solved by that, and cannot be from here: nothing generic knows which of a component's fields are handles. World.CopyComponentsFrom says the same and leaves the fix-up to its caller. What this does is give a caller what it needs to do the fix-up — Capture fills an optional list with the entity at each index and Restore returns the same thing, so zipping the two is the translation table.
Fields and properties (1)
public const string BuiltInPrefixThe prefix a built-in column's name carries, and a contract alias may not.
Methods (2)
public static WorldContent Capture(World world, IList<Entity>? order = null)Writes every live entity in a world.
public static IReadOnlyList<Entity> Restore(WorldContent content, World world)Makes the captured world again, in place of whatever the target holds.
Used by (2)
- LocalTransformColumnVixen.Engine
- WorldSerializerTestsVixen.Engine.Tests