Portfolio
MODECS
An Entity Component System library written in Odin to explore data-oriented game development.
Mouse to move. Dodge red balls and eat blue food. Your personal best is saved in this browser.
The project
The demo uses MODECS for movement, collisions, food collection, and timed effects. The library handles entity identities and component storage; each game defines its own components, systems, and execution order.
How the ECS works
Entities are lightweight handles with an index and generation counter, so an old handle can be distinguished from a new entity reusing the same index. Components are plain data stored in generic sparse-set pools. Dense arrays keep active data together, while a sparse array maps entity indices to component slots. Components can be added and removed at runtime, with swap-removal keeping the dense arrays packed.
Systems and lifecycle
Systems are ordinary procedures called in an explicit order from the game loop. A movement system, for example, iterates Velocity components and looks up Position components for the same entities. Destruction can be marked during updates and processed afterward, removing components before recycling the entity index.
Running on this website
The Odin game is compiled to WebAssembly and linked with raylib using Emscripten. Raylib supplies graphics, input, and audio, while WebGL renders the game in the browser. A small HTML and JavaScript page schedules frames and saves the personal best using localStorage. It is served as static files through GitHub Pages without a game server.