Skip to content

Optional C++ ECS Experiments: Identity and Storage

These experiments answer additional requirements, not gaps that every main-course reader must fill. Finish the design decision first; return when slot reuse or storage layout matters.

Choose by Requirement

Requirement Experiment Extra rules
Recycle storage slots safely Generations Owner, generation, free chain, retirement
Inspect dense component iteration Bounded sparse store Sparse/dense mapping, swap repair, invalidation

Slot reuse is about identity. Sparse storage is about placement. Combining them requires validating the full handle before slot lookup and cleaning all component data before releasing a slot.

Build Explicitly

The default main build excludes these files. From the repository:

1
2
3
4
cmake -S docs/data-oriented-design/examples -B /tmp/pi-design-extensions -DCMAKE_BUILD_TYPE=Debug -DDESIGN_LAB_BUILD_EXTENSIONS=ON
cmake --build /tmp/pi-design-extensions
ctest --test-dir /tmp/pi-design-extensions --output-on-failure
/tmp/pi-design-extensions/optional/optional_demo

For downloads, keep the same relative layout: the eight main-project files under examples/, and these under advanced/examples/:

The extra test groups are optional_generations and optional_storage. They test isolated mechanisms, not a new full ECS replacing the earlier worlds.

What These Experiments Do Not Claim

No Pi benchmark, cache result, memory ranking, or production allocator is supplied. The generation Pool manages metadata only. The sparse store supports bounded, simple value components and invalidates borrowed references on structural changes.

Return to the main course.

Donate