Ark
- title
- Ark
- type
- toolbox
- summary
- Archetype ECS for Go with generic queries, first-class relationships and no mandatory systems layer
- tags
- golang, ecs, game-dev, data-oriented-design
- language
- Go
- license
- MIT / Apache-2.0
- created
- 2026-04-10
- updated
- 2026-04-10
Ark is an archetype-based Entity Component System for Go. It uses Go generics throughout for type safety โ no interface{} casting, no reflection at query time. Zero external dependencies, 100% test coverage, documented benchmarks.
The core API is built around mappers and filters. You create a mapper for a specific component tuple, use it to spawn entities and assign components, then create a filter for the same tuple and iterate over it:
world := ecs.NewWorld()
mapper := ecs.NewMap2[Position, Velocity](world)
filter := ecs.NewFilter2[Position, Velocity](world)
// Spawn an entity with both components
entity := mapper.NewEntity(&Position{X: 0, Y: 0}, &Velocity{DX: 1, DY: 2})
// Iterate over all entities matching the filter
query := filter.Query()
for query.Next() {
pos, vel := query.Get()
pos.X += vel.DX
pos.Y += vel.DY
}
Mappers and filters are meant to be created once and reused โ they're the long-lived handles to the underlying archetype storage. The query.Get() call returns typed pointers directly into the component arrays with no allocation.
What makes Ark interesting beyond a basic ECS:
Entity relationships are first-class. Parent-child, "targets", "owned by" โ relationship types are built into the core, not modeled as tag components or handled in userland. This means the query system can filter on relationships directly, and archetype grouping accounts for relationship topology.
No mandatory systems layer. Unlike Unity DOTS or Bevy, Ark gives you entities, components, archetypes, and queries but doesn't force a systems scheduler. You write your own game loop or simulation tick, calling queries when and how you want. The ark-tools companion library adds optional schedulers and system patterns if you want the structure, but the core doesn't require it.
Batch operations. Mass entity creation, component addition, and deletion are optimized separately from single-entity operations. For agent-based simulations or particle systems where you're spawning/despawning thousands of entities per tick, this matters.
Event system. Extensible events with filtering and custom event types. Components being added, removed, entities being created or destroyed can trigger listeners. This is the hook point for building reactive systems on top of the ECS without polling.
Serialization via ark-serde. Companion library for world serialization โ save/load the entire ECS state. Useful for save games, simulation checkpointing, or debugging by capturing state snapshots.
The ecosystem includes ark-tools (schedulers, system patterns), ark-serde (serialization), and ark-pixel (rendering integration with the Pixel game engine).
Ark pairs naturally with go-bt for per-entity AI decision-making โ Ark handles the data layout and bulk processing, the behavior tree handles individual entity logic. Both are Go libraries with minimal dependencies and similar design taste (small, composable, no framework lock-in).
The project has a DOI for academic citation (Lange, M. & contributors, 2025, doi:10.5281/zenodo.14994239), which hints at its origin in agent-based simulation research rather than game development.
Repo: https://github.com/mlange-42/ark โ 237 stars, MIT/Apache-2.0 dual license, latest v0.8.0 (April 2026).