ecs-guide
/ecs-guide
Prowadzi przez projektowanie Entity-Component-System zorientowanego na dane: magazyn archetypów, ciągłe tablice komponentów, systemy filtrujące i synchronizację stanu z rendererem lub fizyką.
- Autor
- xonovex ↗
- Repozytorium
- platform ↗
- Licencja
- MIT
- Ostatnia zmiana repozytorium
- 08.10.2026
Ocena i bezpieczeństwo
- Pliki w paczce
- 10
- Skrypty
- 0
- Komentarze HTML
- 0
- Adresy URL w SKILL.md
- 0
Brak sygnałów. Repozytorium zmienione 08.10.2026, bez odwołań do wycofanych modeli i API.
MIT, otwarta: można używać i zmieniać, z zachowaniem informacji o autorze.
Co robi i kiedy
Prowadzi przez projektowanie Entity-Component-System zorientowanego na dane: magazyn archetypów, ciągłe tablice komponentów, systemy filtrujące i synchronizację stanu z rendererem lub fizyką.
Wyzwalacze z opisu
Oryginalny opis (EN)
Use when designing or implementing a data-oriented Entity-Component-System: archetype/bitmask storage, contiguous per-type component arrays, filter-and-batch systems, change tracking, and syncing ECS state into stateful external systems (renderer, physics). Triggers on entities, components, archetypes, systems, world iteration, component bitmasks, mirroring transforms to physics, even when the user doesn't say 'ECS'.
Jak działa
- Requirements
- Essentials
- Gotchas
- Example
- Progressive Disclosure
Podgląd SKILL.md
---
name: ecs-guide
description: "Use when designing or implementing a data-oriented Entity-Component-System: archetype/bitmask storage, contiguous per-type component arrays, filter-and-batch systems, change tracking, and syncing ECS state into stateful external systems (renderer, physics). Triggers on entities, components, archetypes, systems, world iteration, component bitmasks, mirroring transforms to physics, even when the user doesn't say 'ECS'."
---
# Entity-Component-System Guidelines (Data-Oriented)
Architecture for a data-oriented ECS: how entities and components are stored, how systems iterate them, and how to bridge the ECS to stateful external systems (renderer, physics) without losing parallelism or cache locality. For the underlying cache/layout reasoning see **data-oriented-design-guide**; for the renderer the ECS feeds, see **gpu-rendering-guide**; for the allocators behind component storage see **memory-management-guide**.
## Requirements
- A component is plain data (POD-ish struct); behavior lives in systems, not components.
- Storage groups entities by their set of components, so a system can walk matching components linearly.
## Essentials
- **Entity type = component bitmask** - Group entities of identical component sets contiguously; iterate by type, see [references/storage-and-archetypes.md](references/storage-and-archetypes.md)
- **One component instance per type** - Model "many of a thing" with child entities or a list-component, not duplicate components, see [references/single-vs-multiple-components.md](references/single-vs-multiple-components.md)
- **Systems are filter-and-batch loops** - Select types matching a bitmask, walk co-located arrays in a tight loop, go wide across cores, see [references/systems-and-iteration.md](references/systems-and-iteration.md)
- **Default to brute-force sync** - Re-push matching entities each frame; add dirty flags / change lists only when profiling proves it, see [references/change-tracking-and-sync.md](references/change-tracking-and-sync.md)
- **Never propagate via callbacks** - Observer callbacks bypass declared read/write deps and break the parallel scheduler; reserve them for lifecycle, see [references/change-tracking-and-sync.md](references/change-tracking-and-sync.md)
- **Feed renderers through interfaces + visibility bitmasks** - Components expose render/shader interfaces; cull once per viewer into a bitmask, see [references/rendering-integration.md](references/rendering-integration.md)
## Gotchas
- Mirroring ECS state to an external system in a batch pass leaves a one-frame out-of-sync window: a 100 km/h car moves a full meter at 30 Hz, so a raycast fired before the mirror pass misses it. Order dependent passes accordingly.
- Adding or removing a component moves the entity's data to a different type bucket: cheap per entity, but doing it every frame (e.g. a "Changing" tag component) churns memory and shrinks batches.
- Cross-component lookups by id in a hot loop defeat the whole point; co-locate the data instead so the match needs no indirection.
- The render graph can only be extended _before_ execution; extra viewers (shadows, reflections) are generated _during_ execution and fold into the viewer array: don't try to register them up front.
## Example
```c
// A system selects entity types whose bitmask includes (transform, velocity),
// then walks the co-located component arrays with no per-entity lookup.
void velocity_system(transform_t *td, const velocity_t *vd, uint32_t n, float dt) {
while (n--) {
td->pos = vec3_mul_add(td->pos, vd->vel, dt);
++td, ++vd;
}
}
```
## Progressive Disclosure
- Read [references/storage-and-archetypes.md](references/storage-and-archetypes.md) - Load when deciding how to lay out entities/components in memory or how to group them for iteration
- Read [references/single-vs-multiple-components.md](references/single-vs-multiple-components.md) - Load when tempted to attach two of the same component, or representing collections (multiple lights, etc.)
- Read [references/systems-and-iteration.md](references/systems-and-iteration.md) - Load when writing the system loop, filtering by components, or parallelizing across cores
- Read [references/change-tracking-and-sync.md](references/change-tracking-and-sync.md) - Load when an external system (physics, renderer, audio) must mirror ECS state and you need to know what changed
- Read [references/rendering-integration.md](references/rendering-integration.md) - Load when feeding the renderer from ECS data: culling, viewers, visibility bitmasks, render-graph injection
Pliki w paczce (10)
- SKILL.md 5 KB
- SOURCES.md 2 KB
- eval-queries.json 5 KB
- evals.json 4 KB
- moon.yml 1 KB
- references/change-tracking-and-sync.md 3 KB
- references/rendering-integration.md 2 KB
- references/single-vs-multiple-components.md 2 KB
- references/storage-and-archetypes.md 2 KB
- references/systems-and-iteration.md 2 KB
Wersje
W bazie nie ma innych skilli o nazwie ecs-guide.
Migawka bazy z 13.11.2026 · wersja paczki 856c83c30e31 (skrót SHA-256 całej paczki)
Pobrania w ostatnich 30 dniach: 0 · ranking
Zgłoś problem z tym skillem: szkodliwa treść, błędny opis albo prośba autora o usunięcie.
Podobne skille
- 100ecs-system-and-component-design
Pomaga projektować systemy i komponenty w Arch ECS: zapytania, czyszczenie, singletony, testy oraz przegląd użycia World, Entity i komponentów. - 100gecs
Opisuje API frameworka ECS gecs dla Godot 4.x: Entity, Component, System, World, QueryBuilder, Relationship, Observer, CommandBuffer i SystemTimer oraz zapytania po składzie komponentów. - 100ecs-architecture
Porównuje i projektuje modele przechowywania ECS, czyli archetypy i sparse sets, z harmonogramem systemów i wyborem, kiedy ECS się opłaca. - 100bevy-ecs
Układa aplikację Bevy wokół Entity Component System: plugins, komponenty i zasoby, systemy z Query, Res i Commands, filtrowanie i kolejność systemów oraz zasób Time. - 100cross-world-ecs-access
Opisuje dostęp między światami ECS: świat globalny z systemów sceny, propagację, komponenty mostowe, PersistentEntities i ISceneIsCurrentListener. - 90entity-component-system
Modeluje obiekty gry jako encje z komponentami danych przetwarzanymi przez systemy i pokazuje, kiedy złożoność ECS się opłaca, przy architekturze gier i ucieczce od głębokich hierarchii dziedziczenia.