Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

TOZ State Machines

Discussion in 'Assets and Asset Store' started by aubergine, Oct 31, 2011.

  1. aubergine

    aubergine

    Joined:
    Sep 12, 2009
    Posts:
    2,878
    EDIT: UPDATED FOR UNITY3D - 2017.3

    This package includes State Machines to mimic artificial decision making through a finite or infinite amount of supplied states in a deterministic or non-deterministic way.

    There is NO Visual Editor, so a good understanding of C# concepts is needed to use this package.

    Buy From:
    ASSETSTORE

    HOW TO USE:
    1. Create one of the two supplied machines as desired
    2. Set the state Selection event (which actions will be performed for the current state)
    3. Initialize the machine by adding different states and by connecting them as needed.
    4. Balance every connection weights and set the initial state.
    5. Write your selection action functions per state.
    6. Fire up the machine, and it will run through automatically.
     
    Last edited: Feb 13, 2019
  2. fixitchris

    fixitchris

    Joined:
    Mar 16, 2011
    Posts:
    21
    bump bump.

    hey, I don't think the demo really shows multiple states. How do you handle state transitions and latent functions? I will need a FSM since I love the built in UDK FSM, but I would need more info.
     
  3. aubergine

    aubergine

    Joined:
    Sep 12, 2009
    Posts:
    2,878
    Hello, and thanks for bumping :p

    Yeah i need some better demo there to show what it does. I will look into it.

    First of all, there are no visual aids in this package. You need to put in all states and transitions by coding. The machine does the rest depending on defined randomized timers.

    Forexample;
    You set 3 states
    "idle" between 5-10 seconds
    "walk" between 10-20 seconds
    "run" between 2-5 seconds
    then you set transitions:
    idle to walk with a chance of 30%
    idle to run with a chance of 40% (machine automatically balances the percentages with the sum of all transitions, so you dont need to worry about that)
    walk to idle...
    walk to run...
    run to idle...etc
    And then you fire the machine and forget it, and it goes into an endless loop doing all the states randomly with defined values.

    But, you also can manually set states if necessary or make a state run infinitely.

    I hope that helps.
     
  4. fixitchris

    fixitchris

    Joined:
    Mar 16, 2011
    Posts:
    21
    I don't enjoy visual aids, I played around with UDK and wasn't a fan of Kismet. I enjoy the code...mmm. So understanding the basics of Unrealscript built in state machine, does your asset allow popping and pushing state stacks? Are there entry and exit points of each state? You talk about automatic transitions, I'm assuming that there are manual transitions like 'Gotostate(state_name)' ...

    I would like to see some kind of documentation describing the API... If you care to show me something offline then that's cool too.

    thanks
    -chris
     
  5. fixitchris

    fixitchris

    Joined:
    Mar 16, 2011
    Posts:
    21
  6. fixitchris

    fixitchris

    Joined:
    Mar 16, 2011
    Posts:
    21
  7. aubergine

    aubergine

    Joined:
    Sep 12, 2009
    Posts:
    2,878
    1. Yes you can add and remove(pop push?) new states (and transitions) to the stack. And it will automatically consider those and recalculate the odds. (This recalculation speed is completely dependent on how complicated your FSM is)
    2. No there are no built in entry and exit points as you are used to in other fsmachines, BUT the property is imitated as one shot events in another way.
    3. Yes you can manually force transitions.

    I added some sort of documentation to the first post, you can see what properties and methods are exposed there.

    And i must remind again, that this package is just the FSM itself. And in my opinion, fsm can not be so generic to fit every need out of the box. It is your duty to fit it to your needs.
    Just dont expect an equal or better FSM than UDK's Kismet now :p
     
  8. tr1stan

    tr1stan

    Joined:
    Jan 23, 2009
    Posts:
    150
    How to use your FSM to generate the fighting game AI? In my case the enemy AI simply attack in fixed combo sequences, e.g. right hook...wait 2s...left hook...wait 1s...jab...wait 1s...right hook. But we player perform a hit I want it forced to block state, and then resume the attack sequence. Is your package capable to achieve it?

    I'm a newbie to AI scripting so please help to know how this FSM mechanism can make my AI development easier so I can get a point to start.
     
    Last edited: Jan 10, 2012
  9. aubergine

    aubergine

    Joined:
    Sep 12, 2009
    Posts:
    2,878
    My FSM is capable of anything that you can think off. But at the end, its up to you.
    You can setup your computer fighter as follows:
    getready (1sec, 1sec)
    right hook(1sec, 2sec)
    left hook(1sec, 2sex)
    right uppercut(1sec, 2sec)
    BLOCK(1sec, 2sec)
    kick...etc

    And equal transition weights to to the next move from all states like
    getready to right hook %10 chance
    getready to kick %10 chance...etc

    When you fire up the above, your fighter will just attack, move, run randomly depending on your setup smiliar to above.

    And finally you put a variable where your enemy tracks the players movement and if it attacks it should force change FSM state to BLOCK immediately and then gets back to its own routine.
    There you can also randomize it alittle bit to change enemy easiness level or otherwise it would be impossible to beat him.

    Hope it helps.
     
  10. tr1stan

    tr1stan

    Joined:
    Jan 23, 2009
    Posts:
    150
    Thanks for the help. I think it's the right solution to me to so I will get your FSM and start using it tomorrow.
     
  11. artzfx

    artzfx

    Joined:
    Apr 28, 2008
    Posts:
    572
    This and your A Star kit are $25 in the Asset Store. Is that correct?
     
  12. aubergine

    aubergine

    Joined:
    Sep 12, 2009
    Posts:
    2,878
    I may have mistyped there in the forum post. The price is 25$
     
  13. Dreamora

    Dreamora

    Joined:
    Apr 5, 2008
    Posts:
    26,601
    Why is it called Finite State Machine when it is non deterministic which characterizes it as Fuzzy State Machine instead?
    Thats quite missleading (though none the less pretty interesting for AI usage)
     
  14. aubergine

    aubergine

    Joined:
    Sep 12, 2009
    Posts:
    2,878
    Uhh, alittle late reply but i will revive this package back soon so i should reply here a well.
    It is a Finite state machine because "It is an abstract machine that can be in exactly one of a finite number of states at any given time." as described on wikipedia. Also it is as default a Non-deterministic algorithm, but if you set the seed value to same as previous run, it acts deterministic.

    Anyways, this package will be back to the assetstore soon with lots of improvements and will work with TOZ Planet Renderer
     
  15. aubergine

    aubergine

    Joined:
    Sep 12, 2009
    Posts:
    2,878
    Package updated and re-released for 2017.3 and up versions.
    Major overhaul on every aspect, and it is much faster and simpler to use now.