systems-with-entity #5

Merged
larssonmartin1998 merged 6 commits from feature/16/systems-with-entity into master 2026-05-10 00:43:26 +00:00

feat: Systems can now optionally receive the entity ID alongside their components

Supporting changes:

  • Entity and generate_unique_entity_id() extracted into their own entity:: namespace (replaces Common.hpp) - Added ICreationBatch/TypedCreationBatch which queues batches of entites per Archetype for creation and reduces heap allocations per queued entity.
  • query/ directory flattened; filter_archetypes() colocated in Utils.hpp
  • Parallel chunk sizing replaced with StaticPartitioner, removes the dead concurrent_systems_estimate path and fix the missunderstanding from cpu usage with taskflow subtasks (long as comment, check diff).
  • Frame spike threshold changed from absolute to dt > avg * 1.35
feat: Systems can now optionally receive the entity ID alongside their components Supporting changes: - `Entity` and `generate_unique_entity_id()` extracted into their own `entity::` namespace (replaces `Common.hpp`) - Added `ICreationBatch`/`TypedCreationBatch` which queues batches of entites per Archetype for creation and reduces heap allocations per queued entity. - `query/` directory flattened; `filter_archetypes()` colocated in `Utils.hpp` - Parallel chunk sizing replaced with `StaticPartitioner`, removes the dead `concurrent_systems_estimate` path and fix the missunderstanding from cpu usage with taskflow subtasks (long as comment, check diff). - Frame spike threshold changed from absolute to `dt > avg * 1.35`
Move the Entity alias and generate_unique_entity_id() from Common.hpp into
their own Entity.hpp/Entity.cpp under atlas::hephaestus::entity. Delete
Common.hpp.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Systems whose callback takes entity::Entity as the first argument now
receive the correct ID alongside their component references.

- Thread WithEntity through SystemTraits (FunctionTraits, TupleElements),
  System, Query, and Archetype::get_entity_tuple/get_entity_tuples
- Extract ICreationBatch/TypedCreationBatch into EntityCreationBatch.hpp;
  flush() takes explicit ArchetypeMap + ent_to_archetype_key params instead
  of Hephaestus& to avoid coupling; replace creation_queue vector-of-lambdas
  with an ArchetypeKey-keyed map and batch_create_entities()
- Flatten query/ directory: move Query.hpp to include root, colocate
  filter_archetypes() in Utils.hpp, delete QueryComponentsPipeline.hpp
- Replace concurrent_systems_estimate + commented-out path with
  StaticPartitioner sized via MIN_PARALLEL_THRESHOLD/MIN_CHUNK_SIZE

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Replace the hardcoded absolute spike threshold with dt > avg * 1.35 so
spikes scale with actual frame budget. EngineClock now seeds avg_frame_time
and fastest_frame_time from the first frame so the running average is valid
from frame 2 onward.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
test: add entity-aware system tests and fix data race in multi-archetype test
Some checks failed
Nix Build Verification / Nix Build - macOS aarch64 (Apple Silicon) (pull_request) Has been cancelled
Nix Build Verification / Nix Build - Linux x86_64 (pull_request) Has been cancelled
Non-Nix Build Test / Ubuntu 24.04 - Clang (pull_request) Has been cancelled
Non-Nix Build Test / macOS 14 - Apple Silicon (pull_request) Has been cancelled
Non-Nix Build Test / Windows 2022 - MSVC 2022 (pull_request) Has been cancelled
vcpkg Dependency Test / Test vcpkg setup on macos-14 (pull_request) Has been cancelled
vcpkg Dependency Test / Test vcpkg setup on ubuntu-24.04 (pull_request) Has been cancelled
vcpkg Dependency Test / Test vcpkg setup on windows-2022 (pull_request) Has been cancelled
e3a0990c2e
Add tests: QuerySpansMultipleArchetypes, PartialCacheAdd,
PartialCacheRemoveEntityIdConsistency, AllEntitiesIteratedPerTick,
WithEntitySystemReceivesCorrectIds. Fix DeletingEntities to capture and
destroy by entity ID. Guard shared seen_x with a mutex to prevent a data
race from Taskflow's inter-bucket parallel execution.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
larssonmartin1998 deleted branch feature/16/systems-with-entity 2026-05-10 00:43:26 +00:00
larssonmartin1998 referenced this pull request from a commit 2026-05-10 00:43:27 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
larssonmartin1998/atlas!5
No description provided.