News for hackers. Stuff that matters.
Re:Entity/Component Game Design: A Primer (2011) by wtetzner on Monday April 03, 2017 @04:24PM (#14026792)
I've written an entity/component "system", but it's mostly just a macro that generates structs and some useful functions on them :)

Basically, I started out just writing structs, then realized I was writing a lot of boilerplate, and now I can specify components like this, and use a custom derive to generate the actual structs and helper functions:

    #[derive(Entities)]
    pub enum Component {
        Position { x: f64, y: f64, z: f64 },
        Direction { x: f64, y: f64, z: f64 },
        Velocity { x: f64, y: f64, z: f64 },
        PlayerControlled
    }

There are no comments on this comment yet.