benreid24 / BLIB

Small organized collection of common code I have accumulated over the years that has amassed into a proper 2d game engine
1 stars 0 forks source link

Create ECS system registry #160

Closed benreid24 closed 1 year ago

benreid24 commented 1 year ago

Base System class with an update method and an init method. Each system will have a bitmask of when it should run. Each Engine::State should have a bitmask of what should run. Systems should be registered with the ECS (or maybe some kind of compile-time mechanism) and should be ran by the engine each update frame.

When the engine is parallelized, each synchronization checkpoint should be named and systems can register themselves to run during certain stages. Maybe something like:

enum EngineStage : std::uint32_t {
    FrameStart = 0,
    Animate = 3, // leave gaps for user-defined stages
    RefreshTransforms = 3, // each stage always waits on previous. run simultaneous by aliasing
    RendererSync = 5,
    EndFrame = 7
}