If I knew all of the systems at compile time, I could order them myself. However, I intend on having user-defined mods. This adds a level of complexity, in that I (as the framework developer) don't know which mods will be developed, or installed on a particular user's machine.
I've thought about adding some sort of execution ordering
// within core code
systemRegistrar.register(PhysicsSystem.class).before(RenderingSystem.class);
// within third-party mod
systemRegistrar.register(ModSystem.class).before(PhysicsSystem.class);
I've thought about an incidental ordering using some sort of message or event bus
// within core code
// - PhysicsSystem
public void update() {
// do physics-y stuff
eventBus.send(new PhysicsSystemUpdatedEvent());
}
// - RenderingSystem
public void handle(PhysicsSystemUpdatedEvent event) {
// do rendering stuff
eventBus.send(new RenderingSystemUpdatedEvent());
}
But this blurs the line between what will happen, and what could happen.
Another thought that came into my mind is that we can be a little bit dirty and not care too terribly much about what order the systems get executed in, because even if we render before the physics are applied, the next frame will then render the physics update that was made in the previous frame. It's consistent, but it blurs the line between what happens within a frame.