Skip to content

NateTheGreatt/YggECS

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 

Repository files navigation

YggECS

A simple and efficient FLECS-inspired Entity Component System (ECS) implementation in Odin.

Usage

world := ecs.create_world()

entity := ecs.add_entity(world)
ecs.add_component(world, entity, Position{x = 0, y = 0})
ecs.add_component(world, entity, Velocity{x = 1, y = 1})

archetypes := ecs.query(world, Position, Velocity)
for archetype in archetypes {
    positions := ecs.get_table(world, archetype, Position)
    velocities := ecs.get_table(world, archetype, Velocity)
    for i := 0; i < len(positions); i += 1 {
        // Update position based on velocity
        positions[i].x += velocities[i].x
        positions[i].y += velocities[i].y
    }
}

About

A simple, modern ECS built in Odin

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages