I am searching about "sub-systems" in ECS but I don't find any article speaking on that. Considers this simple example:
struct Engine
{
MoveSystem move_system;
CollisionSystem collision_system;
RenderSystem render_system;
void PhysicsSystem::update()
{
move_system.update();
collision_system.update();
render_system.update();
}
}
We can make a physics_system
which will be the aggregation of the physics_system
and the collision_system
.
void Engine::update()
{
physics_system.update();
render_system.update(); // No change
}
struct PhysicsSystem
{
MoveSystem move_system;
CollisionSystem collision_system;
void PhysicsSystem::update()
{
move_system.update();
collision_system.update();
}
}
Is it a bad practice? I could not see any drawback since it looks like just a pure change-big-class-into-many-smalls refactoring without logical changes.