States and plugins are badly designed? #10950
feelingsonice
started this conversation in
General
Replies: 1 comment 1 reply
-
See #2160 for previous thoughts along these lines. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
The way that states and plugins have been designed in Bevy have me scratching my head. Although I'm quite new to Bevy so if there's something I'm misunderstanding please let me know.
In my mind, the point of states is so that systems/functions can be isolated into their corresponding states. Ofc, there's all sorts of state machine design patterns but the general idea stays the same. i.e. system
S
within stateA
can make certain assumptions about the current circumstance so that it can avoid the organizational hellholes.Plugins, on the other hand, also kind of does this, but more from a code organization perspective. It isolates ECSs into their respective "chunk" of code.
All this is fine when your code is nice and simple, but when trying to create a more complexgame, there's going to be multiple plugins, states, and perhaps even nested states. It feels like the concept of "plugin" and "states" don't mix well.
To illustrate this, consider the
bevy_asset_loader
plugin, which uses states to separate out the "loading" state:Notice how
my_setup
andmy_system
had to be manually defined under a state when added. Now, if I want to create a new plugin calledRunMyGamePlugin
, it now needs to be aware of theMyStates
state (even though they have nothing to do with each other). If I want to add a system namedjump
toRunMyGamePlugin
, it now has to import theMyStates
state. If I want aJumpAttack
nested state, I would need to first check it's in theMyStates ::Main
state, and then theJump
state. You can see how this can get complicated if you have more plugins and need more nested states.Ideally, plugins and states are not aware of other parts of the app. Instead, the parent user is context aware and defines their relationships.
Beta Was this translation helpful? Give feedback.
All reactions