Pandamonium is, perhaps unnecessarily, implemented using an Entity Component System architecture.
(Caveat: I have only read very surface-level things about Entity Component Systems, my approach has diverged over time, and I suspect it is abnormal and deficient in a bunch of ways. For now, I suspect those ways are ways I don’t care about)
What does that mean, and why? Well, the best way to illustrate that is by example. Much of my game logic is implemented using functions like this:
fn translate(entities: &mut Entities, dt: &Duration) {
entities.apply(|(Velocity(dx, dy), Position(x, y))| Position(x + (dx * dt.as_secs_f64()), y + (dy * dt.as_secs_f64())));
}
What’s going on here? Very simply: we’re applying a function to our entities, that takes a velocity and a position, and returns a new position.