Will give this a try. I was using claude code to make a small game in love2d, and really hoped for a nice lua ecs lib to help manage the game objects (its my first time playing around with game dev).
> Components are stored in contiguous arrays in a SoA (Structure of Arrays) manner, which allows for fast iteration and processing
Does this actually matter in Lua? Aren’t all array elements going to be pointers to heap allocated objects anyways?
The point of SoA is your likely to be accessed values are adjacent in memory, but if you’re chasing a pointer to get that value then you’re not getting anything out of it.
Yes, organizing components as SoA can provide a significant performance boost in Lua, especially with LuaJIT. Both iteration and element access become faster, and it also reduces memory allocations and GC pressure when creating entities. And yes, Lua tables can be contiguous in memory if you use them carefully.
Lua uses tagged unions so that primitives are stored inline within a table. Some time ago I benchmarked this and the perf gains from SOA were significant. Besides, even if you had to chase pointers, SOA still means you can reduce the number of allocations.
Cool to see a new ECS project! I've been learning and using JECS (https://github.com/Ukendio/jecs) for a project of mine, and some of the core ideas (like Chunks) felt familiar. This project definitely seems to have a more in-depth documentation though and a lot more features especially by having its own scheduler stuff. Would love to try it out on a new project someday
Not yet, but I wrote this library to use in a project of mine. When I finish it, I will add a link to the README. As for a small demo project, I have one in mind, but I haven't started it yet.
Will give this a try. I was using claude code to make a small game in love2d, and really hoped for a nice lua ecs lib to help manage the game objects (its my first time playing around with game dev).
> Components are stored in contiguous arrays in a SoA (Structure of Arrays) manner, which allows for fast iteration and processing
Does this actually matter in Lua? Aren’t all array elements going to be pointers to heap allocated objects anyways?
The point of SoA is your likely to be accessed values are adjacent in memory, but if you’re chasing a pointer to get that value then you’re not getting anything out of it.
Yes, organizing components as SoA can provide a significant performance boost in Lua, especially with LuaJIT. Both iteration and element access become faster, and it also reduces memory allocations and GC pressure when creating entities. And yes, Lua tables can be contiguous in memory if you use them carefully.
Lua uses tagged unions so that primitives are stored inline within a table. Some time ago I benchmarked this and the perf gains from SOA were significant. Besides, even if you had to chase pointers, SOA still means you can reduce the number of allocations.
Cool to see a new ECS project! I've been learning and using JECS (https://github.com/Ukendio/jecs) for a project of mine, and some of the core ideas (like Chunks) felt familiar. This project definitely seems to have a more in-depth documentation though and a lot more features especially by having its own scheduler stuff. Would love to try it out on a new project someday
Hmm! I haven't heard of JECS before. I need to check it out :-) Thanks for the kind words!
One alternatives I like is https://bakpakin.github.io/tiny-ecs/doc/
Yeah, tiny-ecs is good, but it doesn't quite fit my needs. With these thoughts in mind, I started this project.
What makes it an "envolved" ecs?
Honestly, it's just a fancy way of saying I learned a few things from earlier attempts and made some tweaks. I just think "evolved" sounds cool!
Any examples of projects using this?
Not yet, but I wrote this library to use in a project of mine. When I finish it, I will add a link to the README. As for a small demo project, I have one in mind, but I haven't started it yet.