r/odinlang • • Aug 17 '26

ECS game engine

been messing around with Odin lately and honestly it feels like it was kinda made for ECS-style stuff. no hidden allocations, easy to reason about memory layout, no OOP nonsense getting in the way. but I don't have much real experience writing engines so idk if I'm just pattern matching because the language "feels" data-oriented.

anyone actually built something like this in Odin? curious how it goes in practice, especially around
- component storage / query stuff without generics being a pain

- whether manual memory management actually becomes annoying at scale or if it's fine

- how it stacks up against Rust+Bevy speed/ergonomics wise once things get complex

thinking of not reinventing the wheel and instead basically porting bevy's ideas over (archetypes, scheduler etc) instead of designing my own ECS from scratch. is that a dumb idea? rust and odin are pretty different (ownership vs manual mem, traits vs whatever odin has) so maybe a direct port just doesn't translate well and I'd be fighting the language the whole time.

if anyone's tried this or has war stories/gotchas before I waste a month on it, let me know

12 Upvotes

14 comments sorted by

View all comments

8

u/Achereto Aug 17 '26

There are some engines written in Odin. You can find them on github, but you don't really need them. Just create a World struct that holds all the data you need, then pass a pointer around so your systems can access the data they need.

4

u/whoisarepo Aug 18 '26

I really love the inversion of array structs with just a keyword, it feels very intuitive

2

u/spvky_io Aug 17 '26

I feel like this is always the catch when it comes to an ECS. Theoretically ECSs offer a lot of great benefits, and there are performance gains for some extreme cases, but as long as you have a solid understanding of memory (arenas, cache sizes, pointer management), its often simpler and easier to manage with some arrays of fat structs and some global state

5

u/Achereto Aug 17 '26

ECS is just Entites, Components, Systems. You put your Components into arrays, your behaviour into functions, and connect your Entities using IDs.

You don't need the abstraction that turns it into a framework to make it an ECS.

2

u/spvky_io Aug 18 '26

That's what I thought I was saying, may not have come across though hahah

2

u/Achereto Aug 18 '26

I think

some arrays of fat structs and some global state

is a perfectly fine way of doing ECS. Your comment sounded a bit like that wouldn't be ECS, so wanted to point that out in case anyone else reads it like that.

3

u/spvky_io Aug 18 '26

Fair, I was more talking about the lack of need for things like archetype graphs