ECS
ECS module API reference: 11 headers · 20 types · 263 symbols.
- Build name
MowoEngine.ECS- Source
Engine/Source/Runtime/ECS/Public- Category
- Runtime
- Contents
- 11 headers · 20 types · 263 symbols
ECS/Archetype.h
| Kind | Type | Summary |
|---|---|---|
| struct | BitsetHash | bitset<MAX_COMPONENTS> has no built-in std::hash, so the archetype map keys on this: 64-bit chunks mixed boost-style. Runs on archetype lookup only, never in the GetComponent hot path. |
| class | IComponentColumn | Type-erased column: one per ComponentID an Archetype tracks. Components are stored contiguously and matched 1:1 with the archetype's entity list by row index, so World can hold heterogeneous columns in one map without lo |
| class | ComponentColumn | One per (Archetype, ComponentID) pair. |
| struct | Archetype | Entities sharing a component signature. Every entity with signature S lives in exactly one Archetype keyed by S, and its columns are the only storage for those components. AddComponent / RemoveComponent migrate the entit |
ECS/Component.h
| Kind | Type | Summary |
|---|---|---|
| struct | ComponentBase | Optional — components are plain structs and need not derive from this. |
ECS/ComponentOps.h
| Kind | Type | Summary |
|---|---|---|
| class | FComponentOps |
ECS/Entity.h
| Kind | Type | Summary |
|---|---|---|
| class | Entity | Lightweight entity handle. |
ECS/EntityCommandBuffer.h
| Kind | Type | Summary |
|---|---|---|
| class | FEntityCommandBuffer | Structural changes recorded now and applied later, on the main thread, in one go — the Mass command buffer. A worker or a ForEach that needs to add, remove or destroy records here instead of submitting one std::function |
ECS/EntitySlotMap.h
| Kind | Type | Summary |
|---|---|---|
| class | FEntitySlotMap | EntityID → World slot: open addressing with linear probing over a power-of-two table kept at most half full. std::unordered_map paid a node allocation per entity and a pointer chase per lookup; an entity id is a random 6 |
ECS/Query.h
| Kind | Type | Summary |
|---|---|---|
| class | Query |
Free functions
| Signature | Description |
|---|---|
template<typename... Ts> inline auto World::MakeQuery() | The World.h declaration returns auto because it can't name Query yet, so this definition must deduce too — spelling Query<Ts...> as the return type is a declaration mismatch under MSVC. |
ECS/SceneSystemRegistry.h
| Kind | Type | Summary |
|---|---|---|
| struct | FModularSceneSystem | One world system contributed by a plugin (or a below-Game module). Mirrors Scene's internal SceneSystemEntry: which registration set the system belongs to (base = edit mode, simulation, runtime), where it ticks outside W |
| class | FSceneSystemRegistry |
ECS/System.h
| Kind | Type | Summary |
|---|---|---|
| enum | SystemPhase | World::Update runs systems phase by phase in this order, preserving registration order within a phase. Mirrors AActor::ETickGroup. The default is PrePhysics, so systems that don't opt into a later phase keep their relati |
| struct | FSystemResources | World state that lives outside the component arrays. A system that declares its component access declares these too, so two systems that both reach the physics world (or a shared navmesh query) never share a batch; befor |
| class | System |
Free functions
| Signature | Description |
|---|---|
using ComponentMask = std::bitset<MAX_COMPONENTS> | Same bitset the world uses for entity signatures, indexed by FComponentRegistry::GetComponentID<T>(). |
ECS/Types.h
| Kind | Type | Summary |
|---|---|---|
| struct | FEntityHandle | Runtime handle into a World's dense slot table: no hash on the way to the components. The UUID stays the identity that is saved, sent and compared; a handle is valid only in the World that issued it and only until that e |
| class | FComponentRegistry | Registration lives in the ECS DLL so ids stay consistent across DLL boundaries. |
Free functions
| Signature | Description |
|---|---|
using EntityID = uint64_t | Random 64-bit UUID that survives save/load. Zero means invalid. |
constexpr EntityID INVALID_ENTITY = 0 | |
using ComponentID = uint32_t | |
constexpr std::size_t MAX_COMPONENTS = 512 | Distinct component *types*, not instances — sizes World's per-entity signature bitset (64 bytes) and every archetype's dense column index. The engine registers ~120 reflected types plus unreflected ones before a game or plugin adds any, so 256 left too little room; registration past the cap is a fatal error at the type that crosses it, not a later out_of_range. |
static_assert(MAX_COMPONENTS % 64 == 0, "MAX_COMPONENTS must stay a whole number of 64-bit words for BitsetHash") | |
static_assert(MAX_COMPONENTS < 0x1000, "component ids must stay below the RPC wire-id range (FReplicatedComponentRegistry::kRpcWireFirst)") | |
constexpr std::size_t MAX_ENTITIES = 100000 | Advisory only: archetype columns grow on demand and never preallocate a slot pool of this size. |
ECS/World.h
| Kind | Type | Summary |
|---|---|---|
| struct | WorldArchetypeSnapshot | |
| struct | WorldSnapshot | |
| class | World |
Free functions
| Signature | Description |
|---|---|
template<typename T, typename... Args> T& World::AddComponent(EntityID entity, Args&&... args) | |
template<typename T> void World::RemoveComponent(EntityID entity) | |
template<typename T> T* World::GetComponent(EntityID entity) | |
template<typename T> const T* World::GetComponent(EntityID entity) const | |
template<typename T> T* World::GetComponent(FEntityHandle handle) | |
template<typename T> const T* World::GetComponent(FEntityHandle handle) const | |
template<typename T> T* World::GetComponentHinted(EntityID entity, uint32_t& slotHint) | |
inline FEntityHandle World::GetHandle(EntityID entity) const | |
inline bool World::IsHandleValid(FEntityHandle handle) const | |
inline EntityID World::GetEntityID(FEntityHandle handle) const | |
template<typename... Ts> void World::GetComponents(EntityID entity, Ts*&... out) | |
template<typename... Ts> void World::GetComponents(FEntityHandle handle, Ts*&... out) | |
template<typename... Ts> void World::GetComponentsHinted(EntityID entity, uint32_t& slotHint, Ts*&... out) | |
template<typename T> bool World::HasComponent(EntityID entity) const | |
template<typename T> bool World::HasComponent(FEntityHandle handle) const | |
template<typename T> bool World::HasComponentHinted(EntityID entity, uint32_t slotHint) const | |
template<typename T, typename... Args> T* World::AddSystem(Args&&... args) | |
template<typename T> T* World::GetSystem() | |
template<typename T> void World::RemoveSystem() | |
template<typename T, typename... Args> T& Entity::AddComponent(Args&&... args) | |
template<typename T> void Entity::RemoveComponent() | |
template<typename T> T* Entity::GetComponent() | |
template<typename T> const T* Entity::GetComponent() const | |
template<typename T> bool Entity::HasComponent() const | |
inline void Entity::Destroy() | |
inline const std::vector<Archetype*>& World::GetMatchList(const ComponentID* ids, size_t count) | The cache clear/build races only with itself (two iterations starting concurrently after a structural change), never with a live consumer: the version can only move via structural ops, which MOWO_CHECK !IsIterating(), so an in-flight pass pins the version and no concurrent GetMatchList can clear the entry it iterates. Mapped vectors are reference-stable across inserts, so the returned reference survives other lists being cached. |
template<typename T, typename Func> void World::ForEach(Func&& func) | |
template<typename... Ts, typename Func> void World::ForEachWith(Func&& func) | |
template<typename... Ts, typename Func> void World::ForEachChunk(Func&& func) | |
template<typename... Ts, typename Func> void World::ParallelForEachWith(uint32_t rowsPerJob, Func&& func) | |
template<typename Func> void World::ForEachEntity(Func&& func) const | |
template<typename Func> void World::ForEachMatchingArchetype(const std::bitset<MAX_COMPONENTS>& required, Func&& func) const |