[plugin] rex_gfsm, [behavior] rex_fsm

  • plugin: rex_gfsm

    behavior: rex_fsm

    This plugin could help user describe finite state machine.

    User might see my fsm plugin at bejeweled demo before. Now there are document of these plugin/behavior.

    Behavior trees for AI: How they work

    The blocks could map to "condition: on transfer logic". And the connections to the next blocks is "action: set next state".

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • rexrainbow : it's really great! It makes the process of creating an FSM-based AI much simpler in C2. Thanks much! Gotta get a better hang of FSMs, but I guess I'll use it in an upcoming AI tutorial

  • Thanks rexrainbow for the plugin.

  • Its great! just need to learn it completely. How would i transfer a state from one FSM to another?

  • xanxion

    Call "Action:Request" to trigger current transition logic "Condition:On transfer logic". In this condition, call "Action:Set next state" to change to next state.

    [quote:2k6vfxnz]Action:Request -> Condition:On transfer logic

    Condition:On transfer logic: Action:Set next state

    Or call "Action:Go to state" to change state directly without trigger the transition logic.

  • Hi rexrainbow -- just wondering, what are the primary benefits of this vs. having an instanced variable on the sprite that control what it does? I'm thinking about this in terms of enemy AI.

    Sprite.statevariable = 0 then do X

    Sprite.statevariable = 1 then do Y

    etc.

    Does this result in better performance? Something else?

  • HelmetPIg

    These plugin/behavior all could be implemented in events. Using plugin might have a few performance improvement. (But this improvement could be ignored imo)

    The primary benefit is to describe fsm in event sheet more clearly, which separate logic transfer and entry actions.

  • Thank you rexrainbow!

  • Hi rexrainbow, I know this is an older plugin, but can I ask a question on this please? I'm not sure I see the difference between Go to State and Set Next State. For example, I can't see the difference between these 2 scenarios:

    [quote:lgtjh8hn]Action: FSM Request

    Condition: On FSM Transfer Logic -> Action: Set Next State to "Move"

    [quote:lgtjh8hn]Action: FSM Request

    Condition: On FSM Transfer Logic -> Action: Go to State "Move"

    Does the 'Set Next State' actually do anything differently?

  • SecondDimension

    "Action:Go to State" will change state immediately.

    "Action: Go to State" is used under "Condition: On FSM Transfer Logic".

    The state changing starts from "Action:Request" or "Action:Go to State", the different is

    • The next state comes from the input parameter of "Action:Go to State".
    • The next state comes from the "Condition: On FSM Transfer Logic" -> "Action: Set Next State"
  • OK thanks. I was just curious as I did some tests and this did not work

    "Condition: On FSM Transfer Logic" -> "Action: Wait 3 Seconds" -> "Action: Set Next State"

    But this did work:

    "Condition: On FSM Transfer Logic" -> "Action: Wait 3 Seconds" -> "Action: Go to State"

    I just wanted to understand why the first method didn't work. Perhaps because as you said, the state needs to change on the "Action:Request" and the next state is not immediately available in the first method.

    It's not that important though, thanks for the reply

  • SecondDimension

    Sorry, I made mistake in previous post.

    "Action:Request" and "Action: Go to State" are all used to change state to next state:

    • The next state is in input parameter of "Action: Go to State".
    • The next state of "Action:Request" comes from "Action:Set next state" under "Condition:On transfer logic". i.e

    "Action:Request" -> "Condition:On transfer logic" -> "Action:Set next state -> go to next state

  • Re-wrote document of this plugin, add a flow chart of state changing.

  • Decided to give this a quick go yesterday and now I'm wondering how the heck have I made it this far without using this. It makes my life so much simpler! Thanks for this behavior rex!

  • andreyin

    You are welcome, hope new document will be more clear.

    I feel that my documents are short of flow charts, to describe the relationship between actions and conditions

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)