Arch-ECS
💬 Join the discord!☕ Buy us a coffee!
  • 🌄Why Arch?
  • 📖Documentation
    • Concepts
    • World
    • Entity
    • Query
    • Archetypes & Chunks
    • Optimizations
      • Query-Techniques
      • Pass on data
      • Batch and Bulk
      • PURE_ECS
      • Multithreading
      • EntityData
    • Utilities
      • Component Registration
      • Non-generic API
      • CommandBuffer
      • Events
      • Dangerous Extensions
  • 🧩Extensions
    • Arch.Extended
      • Arch.System
      • Arch.System.SourceGenerator
      • Arch.EventBus
      • Arch.AOT.SourceGenerator
      • Arch.LowLevel
      • Arch.Persistence
      • Arch.Relationships
  • 💡Examples & Guidelines
    • Arch.Samples
    • Entities in Query
    • Structural changes
  • Unity
  • 🎮Projects using Arch
    • Skylandkingdoms
    • Cubetory
    • SS14
    • EquilibriumEngine-CSharp
    • Rougelite-Survivor
  • ✏️Misc
    • Roadmap
    • FAQ
Powered by GitBook
On this page
  • Lifecycle
  • Customize
  • Good to know

Was this helpful?

Edit on GitHub
  1. Documentation

World

The World, the place where all Entities live.

PreviousConceptsNextEntity

Last updated 2 months ago

Was this helpful?

The world stores all its , it contains methods to create, destroy and query them and handles all the internal mechanics. Therefore it is the most important class, you will use the world heavily. Time to play God.

Lifecycle

var world = World.Create();  // Creating a world full of life
world.TrimExcess();          // Frees unused memory
world.Dispose();             // Clearing the world like God in the First Testament
World.Destroy(world);        // Doomsday

Multiple worlds can be used in parallel, each instance and its entities are completely encapsulated from other worlds

Best of all, you can create any number of worlds with almost infinite entities. You rarely have so much life and freedom. To be precise,2,147,483,647 worlds with 2,147,483,647 entities each are possible.

Customize

You can also customize the world a little to suit your needs, for example the initial capacity or how big the should be:

var customizedWorld = World.Create(
    chunkSizeInBytes: 16_382,              // The base size of each chunk
    minimumAmountOfEntitiesPerChunk: 100,  // The base amount of entities per chunk
    archetypeCapacity: 8,                  // The initial size of the archetype array
    entityCapacity: 64                     // The initial amount of entities
);

Adjusting this is not absolutely necessary, but can be quite helpful. These are always initial values that Arch uses as a guide. It may well be that Arch deviates upwards in some cases, especially with the chunkSizeInBytes or the minimumAmountOfEntitiesPerChunk.

Good to know

Now we have a world. A world with all the prerequisites for creating life, changing it and destroying it.

The world has the rudimentary methods on which everything in Arch is based. If you only want to work with them, this is possible and offers one less level of abstraction.

We'll go into more detail later. But now enough talk, go on. Something is lurking behind the next bush.

As an alternative, you can also work ONLY with the world. Without abstraction of entities and co. This principle is called and will be looked at later. The following documentation refers further to the abstracted entity API.

📖
entities
chunks
PURE_ECS

And much more...

Working with Events, the CommandBuffer or several other features directly!

Lifecycle Management

Creating and destroying Entities.

Structural Changes

Adding/Removing components on Entities

Modification

Accessing and modifying components on Entities.

Enumeration

Enumerating/Filtering/Matching Entities.

Bulk/Batch Operations

Executing operations on Entities in Bulk/Batches.

Lowlevel

Working with Archetypes, Chunks and Entities directly without any wrappers.

Multithreading

Acessing the JobScheduler to run querys or your own Jobs in parallel.