A snapshot of a world can be taken via a new method, world.snapshot(), which returns a serializable representation of the world at the time the snapshot was created. Updates to the world do not modify the snapshot and vice-versa.
The snapshot can be used to create a world with the same entity and component data as the original snapshot. This is made possible via a new option to createWorld:
const worldA = createWorld(...)
// some time later...
const worldB = createWorld({ snapshot: worldA.snapshot() })
Creating a world from a snapshot will not copy over other unserializable resources like component types. However, a world created using a snapshot will validate that newly registered component types' schemas match those of the original world's.
This snapshot can also be useful for testing, e.g. to snapshot testing determinism in a large physics simulation, etc.
Documentation Updates
Navigation updates, prettier <asides>, and a better intro. Fixes syntax highlighting.
World Snapshots
A snapshot of a world can be taken via a new method,
world.snapshot()
, which returns a serializable representation of the world at the time the snapshot was created. Updates to the world do not modify the snapshot and vice-versa.The snapshot can be used to create a world with the same entity and component data as the original snapshot. This is made possible via a new option to
createWorld
:Creating a world from a snapshot will not copy over other unserializable resources like component types. However, a world created using a snapshot will validate that newly registered component types' schemas match those of the original world's.
This snapshot can also be useful for testing, e.g. to snapshot testing determinism in a large physics simulation, etc.
Documentation Updates
Navigation updates, prettier
<asides>
, and a better intro. Fixes syntax highlighting.