Knödel-ECS - Bevy’s API in Zig
Today I want to present my pet project ‘Knödel’, which is another ECS abstraction.
I have been working for about 4 years with the popular rust ECS bevy, before discovering my passion for Zig. I wanted something similar in Zig, especially the scheduler, access patterns and auto concurrency. And that is, what I did.
For the last year, this has been become the foundation of my game engine, and it is at the state, where I feel confident enough to share it with the community.
- Bevy’s plugin and systems API in Zig
- Lock free auto concurrency
- Queries, resources and system locals
- Component hooks and Bevy’s ‘Required Component’ equivalent
- Event and State extension
- Archetype based storage
- Relations/Hierarchy
- Manual control
- Can run inside a dylib (re-add plugins after reload)
- A user defined scene codec interface for export/import
The first light test of my engine was a mini space survivor you can play in the browser:
Play space survivor game
(Uses an old version of the ECS)
For anybody interested: Sokol is used as platform layer.
Today I am working on an isometric colony sim / tycoon hybrid. Here are some of the debug API capabilities: A view, showing all schedules and system, color coded on what runs in parallel and how long it takes on average.
The lowest level API is type erased and allows for runtime manipulation. This is great for external tooling and bindings. For example, I also have a detailed debugging web interface, which gives me searchable live view into the running world with live component data.
Zig version
0.16.0
LLM disclosure
Knödel’s code is handwritten. LLMs are used for analyses and read-only purposes.
