The World

The World ( ecs.World ) is the central data storage in Arche. It manages and stores entities ( ecs.Entity ), their components, as well as Resources. For the internal structure of the world, see chapter Architecture.

Here, we only deal with world creation. Most world functionality is covered in chapters Entities & Components and World Entity Access.

World creation

To create a world with default settings, use ecs.NewWorld :

1world := ecs.NewWorld()
2_ = world

A world can also be configured with an initial capacity:

1world := ecs.NewWorld(1024)
2_ = world

The initial capacity is used to initialize archetypes, the entity list, etc.

For archetypes with an Entity Relation, a separate initial capacity can be specified:

1world := ecs.NewWorld(1028, 128)
2_ = world

Reset the world

For systematic simulations, it is possible to reset a populated world for reuse:

1world := ecs.NewWorld()
2// ... do something with the world
3
4world.Reset()
5// ... start over again