Page 1 of 1

Nata - OOP/ECS style entity management

Posted: Thu Nov 16, 2017 6:54 am
by Tesselode
https://github.com/tesselode/nata

Hello o/

I've been working on a library called Nata. It make entity pools, and it uses a hybrid OOP/ECS approach.

Systems looks like this:

Code: Select all

verticalMovementSystem = {
    filter = function(e) return e.yspeed end,
    update = function(e, dt)
        e.y = 300 + 200 * math.sin(uptime * e.yspeed * .5)
    end
}

drawSystem = {
    filter = function(e) return e.color end,
    draw = function(e)
        love.graphics.setColor(e.color)
        love.graphics.circle('fill', e.x, e.y, e.radius, 64)
    end
}
But you can also use plain old classes and have them integrate neatly.

The library is still very much a WIP; I've been going back and forth on a lot of design decisions. But I'd like to get more feedback on it!