junkdog / artemis-odb

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

[FEATURE] Allow us to remove Systems #635

Closed Minecraftian14 closed 3 years ago

Minecraftian14 commented 3 years ago

Context: Okay, so there is this library runtime, which uses Ashley. I have been trying to translate the whole thing to Artemis ODB. The runtime manages the WorldConfigurationBuilder and World objects. It also adds in a lot of different IteratingSystem objects by itself.

But in some use cases, the user would prefer replacing one of those systems to gain better control over things. Unfortunately, neither with WorldConfigurationBuilder nor with WorldConfiguration and obviously not with World can one remove a system (to be replaced).

If there exists some existing features for that, or if there are some alternatives please forgive me, and enlighten me about their existance. 👍

genaray commented 3 years ago

Hey there ! If i remember that correctly, we are able to disable systems pretty easily. Even during runtime. Otherwhise you may extend the SystemInvocationStrategy to code your own way of invoking systems every tick. This way you could easily add some methods for replacing, adding or removing certain systems. That SystemInvocationStrategy then needs to be added to the used world.

Minecraftian14 commented 3 years ago

Well there are a few "better" workarounds, like I can instead manage an Array for the systems which the user can modify, before creating the world. But yeah, so far as WorldConfigurationBuilder maybe, if it had an option to also remove the systems, it'll be better and neat.

Minecraftian14 commented 3 years ago

I don't know if anyone reads closed comments.

Just wanted to share what we did finally.

In the end we realised that the array idea for systems plus any additional functionality (like plugins or injections which advanced users may want) will only cause the loader class to gain complexity beyond control. In fact it already has a 3 step Initialisation process.

Therefore we settled on introducing another class (something like loader config) which deals with all these properties.