junkdog / artemis-odb

A continuation of the popular Artemis ECS framework
BSD 2-Clause "Simplified" License
779 stars 112 forks source link

[Question] Is there a limit for Systems ? #605

Closed genaray closed 3 years ago

genaray commented 4 years ago

Im using artemis odb for the serverside of my little mobile mmorpg... due to the complexity of the game we require tons of systems... We barely have the basics and already count about 20 systems.

We are aiming for a pure ECS approach featuring a high flexibility with less to no OOP.

Heres a list of our current systems... the world is processing at a tickrate of 13.3 ms ( 60 times per second )... of course not all of those systems are running over all entities in game...

Picture of our systems

The biggest amount of systems are required for our "Spawn" system... consisting of "Recipes" and "Recipe" aswell as Conditions... to keep it flexible we basically have a "Condition" Component which determines if a entity is allowed to spawn... every condition ( Spawn during Night e.g. ) has its own system checking the condition and setting stuff...

The main question here is... is there a limit for the amount of systems ? Is it a good idea to go for pure ecs in artemis odb ?

DaanVanYperen commented 4 years ago

Artemis should only take a fraction of your tick. I've had projects with 50+ systems and components without issues, You can check with https://github.com/DaanVanYperen/artemis-odb-contrib/wiki/Profiler-Plugin to see if any systems are eating your cycles.

The main question here is... is there a limit for the amount of systems ?

I want to say no, but I've never gone hundreds of systems myself.

If you plan to target web (GWT) you might hit a roadblock with too many systems and classes, as the compile time generated reflection class will be too big to compile.

Is it a good idea to go for pure ecs in artemis odb ?

Artemis is very well optimised and it will take some punishment, but if you plan to go crazy with the condition/effects I'd personally consider if multiple components are required, or if I could do something like:

class Condition extends Component {
           ConditionType type;
}

/** Extendable condition handling. delegate conditions to the right strategy based on a type -> strategy hash. */
new ConditionSystem(
             new NightConditionStrategy(),
             new AmbushConditiomStrategy(),
             ..
)```