Skip to content

GuilHartt/muninn

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Muninn ECS Logo

Testing Status License Language GitHub Sponsor

muninn is a lightweight, high-performance, archetype-based Entity Component System (ECS) written in Odin.

“Muninn” — Norse for “memory”, the raven that flies over Midgard to bring information to Odin.

——

Installation   •   Usage   •   Roadmap   •   Documentation


A cache-optimized ECS implementing archetype-based SoA storage. By packing entities with identical component signatures into contiguous memory blocks, muninn maximizes data locality and enables high-throughput linear iteration, minimizing CPU cache misses.

Important

muninn is developed as the core ECS for Sweet Engine. The API is experimental and subject to change as the engine's requirements evolve.

Installation

Clone the repository directly into your project's shared or libs directory:

git clone https://github.com/GuilHartt/muninn libs/muninn

Usage

package main

import ecs "libs/muninn/ecs"

Position :: distinct [2]f32
Velocity :: distinct [2]f32

main :: proc() {
    world := ecs.create_world()

    e := ecs.create_entity(world)
    ecs.add(world, e, Position{0, 0})
    ecs.add(world, e, Velocity{1, 1})

    ecs.each(world, proc(it: ecs.Iter, pos: ^Position, vel: ^Velocity) {
        pos.x += vel.x
        pos.y += vel.y
    })

    ecs.destroy_world(world)
}

Roadmap

The goal is to provide a robust foundation for data-oriented games in Odin.

  • Archetype Storage: Contiguous SoA memory layout for maximum cache locality and SIMD-friendliness.
  • Entity Relationships: First-class support for Pairs (e.g., ChildOf, Parent) and Wildcard matching.
  • Queries: Efficient filtering with With, Without, and cached archetype iteration.
  • Iterators: High-level syntax wrappers to reduce boilerplate in query loops.
  • Component Toggling: Enable or disable components without triggering structural changes, preserving archetype stability and performance.
  • Observers: Event-driven hooks for component lifecycle events (Add, Remove, Set).
  • Resources: Singleton storage for world-scoped data (e.g., Camera, PhysicsWorld), avoiding global state.
  • Command Buffer: Queue deferred operations to safely modify world structure during system execution.

Documentation

Comprehensive documentation is currently being written and will be hosted on GitHub Pages.

License

This project is licensed under the zlib License.

See the LICENSE file for the full legal text.


Credits: Created by Guilherme Avelar (GuilHartt)

About

Fast archetype-based ECS for Odin with support for relationships.

Topics

Resources

License

Stars

Watchers

Forks

Sponsor this project

 

Contributors

Languages