Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Thoughts on possible parallel-like state? #129

Open
andmish opened this issue Jun 3, 2024 · 2 comments
Open

Thoughts on possible parallel-like state? #129

andmish opened this issue Jun 3, 2024 · 2 comments
Labels
enhancement New feature or request

Comments

@andmish
Copy link

andmish commented Jun 3, 2024

I've used State Charts and LimboAI for a while, making different character controllers, talking just about state management/transitions parts here. I think you can implement all of your intricate ideas and make complex state machines using any of two, but let's say, for some imaginary feature parity, LimboAI is missing "Parallel State" analog.

Personally, I really like LimboAI approach a lot more (initializing transitions using code, handy delegations, BTStates as states, etc.). It's just a pleasure to work with, basically covers everything state/ai related and I don't even want to use anything else now 😊

So, will it be difficult/feasible to add maybe a new node like LimboParallelHSM? Which will updates all its immediate children in "parallel" mode (obviously just from top to bottom and if the child is LimboHSM, that hsm updates its initial state too as usual?). In this case any transitions between children are not necessary and just ignored if you define them?
Maybe I'm missing something, what do you think?


For the example, I come up with this tree (but I bet if there is such functionality users can come up with much better use cases)

Character
┖╴States LimboHSMupdates
  ┠╴Cutscenes LimboState
  ┖╴Gameplay LimboParallelHSMupdates
    ┠╴Abilities LimboHSMupdates
    ┃ ┠╴Off LimboStateupdates
    ┃ ┖╴On LimboHSM
    ┃   ┠╴SomeAbility1 LimboState
    ┃   ┖╴SomeAbility2 LimboState
    ┖╴Movement LimboHSMupdates
      ┠╴Idle LimboStateupdates
      ┠╴Walk LimboState
      ┖╴InAir LimboState

In this tree character can be switched between Cutscenes (where its movement driven by animations from animation player maybe?) and Gameplay (where input is checked and you can control it).
Gameplay will be LimboParallelHSM. Abilities are off for now (and just waiting for input/enabling). Abilities are not tied to character movement (such as they are not affecting its animations/states directly, etc.), maybe one ability creates rotating rocks around character, updates the rotations and check collisions, and another could also overlay/blend different animations on top in animation tree, so it mixes with idle/walk animations nicely. So abilities are really parallel/overlayed things and character movement is fully separated and not depended on them.

I guess it can be achieved by making 2 separated LimboHSM (Abilities and Movement), but then it will need some other node to keep links and making checks? And what if I want 3 or 4 parallel states for some reason? In the example above everything sits nicely in one tree and can be controlled from the main States and its substates. I'd like such simplicity 🙂

@limbonaut
Copy link
Owner

I'd rather call it LimboParallelState - because it's not really an FSM, so this concept is more like a composition of states.
I generally like the idea, and thought about it in the past, but never came to need something like that in practice. Some API would need to change, though. For instance, LimboHSM.get_leaf_state() is not going to return a useful result with a parallel state.

@limbonaut limbonaut added the enhancement New feature or request label Jun 3, 2024
@andmish
Copy link
Author

andmish commented Jun 3, 2024

@limbonaut yeah, LimboParallelState will be the best choice, it's already well-established term and matches State Charts naming too, so some users will already know how it works and what to expect from it

@limbonaut limbonaut added this to the 1.2 milestone Jun 30, 2024
@limbonaut limbonaut removed this from the 1.2 milestone Aug 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants