0 Favourites

State Machine

This forum is currently in read-only mode.
  • The only reason I was looking in to making it is because I'm taking a c++ class and im kind of bored in it so I wanted to try some more in depth things so i figured i would make a plugin since i havent really contributed anything recently.

  • i havent really contributed anything recently.

    [quote:ajo57782]read posts before you reply.

    [quote:ajo57782]actually contribute something to the topic

    How about not doing that anymore? that would be an appreciated contribution.

    Now, back on topic and disregarding needlessly aggressive replies:

    An FSM differs from boolean if/else logic in the same way if/else logic differs from a switch statement in C, just its organization. But then again, you don't really need any organizational logic except compares and jump, you could do that in Assembler and there's no limitation there... only it's really tedious.

    Mipey: if you use a private var instead of a global var for your FSM, you'd have a private FSM. To have hierarchy within a FSM, you do something like this:

    FSM1(A,B,C) has a child FSM2(X,Y,Z) in state B. All of FSM2 events would then be as a subevent of "FSM1 On State B".

    Having interruptions is about the same deal, all a plugin would do is make it really easy to read (and as I explained before in my unread "actual contribution to the topic", provide the On Leave event which is really messy without an FSM condition)

  • Thread approaching lock unless you turn down the passive aggressiveness.

  • For an on leave condition, you can simply check for the state again. Like:

    If value 'mode' = "standing"

    (subevents)

    • Trigger once (on start)
    • on jump pressed, set mode to "jumping"
    • if mode does not equal standing (on leave)
  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • Ash,

    It would be a shame to lock such an interesting thread.

    I'd prefer to see the people getting out of hand dealt with.

    I've always found Aeal5566's views interesting, but it seems Madster would prefer to tell rather than being told.

    Anyway, I've almost always used a state machine when programming in C++.

    Maybe not what "some" people would call a State Machine, but there's a lot of power in using a system based on variable states.

    Krush.

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