playMaker

Author Topic: Ai Example, and should I use 1 FSM or multiples?  (Read 2684 times)

Bovine

  • Playmaker Newbie
  • *
  • Posts: 2
Ai Example, and should I use 1 FSM or multiples?
« on: October 01, 2011, 02:53:33 PM »
Hi There

One of the things that playMaker is advertised as being useful for is AI. I've largely bought it for that purpose but I've yet to see a working AI example.  Are there any plans to create one?

At present I've roughly follows the animation graph example, though as stated on that example, my graph looks different - has the UI been altered since the video was shot? What isn't clear to me, is that can I have multiple FSMs on the same entity, so can have this animation graph for movement on my enemy and have other graphs active at the same time or is that not a good practise?  Currently I have the movement animation graph and another graph that cycles idle anims while the player isn't moving - which clearly isn't going to work at other times!

Ideally I'd like to see one or more graphs that cover the basics of enemy AI, even if in the simplest of state machines. Covering the typical idle, suspicious and aggro/attack states.

So, in the first instance, failing any kind of tutorial + sample project, should I be using one FSM to control a char or multiple or is it really up to me? Or should one FSM call other FSMs - if that's even possible!?

Thanks, sorry if it's a bit rambly :)

Cheers
Bovine



Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 4000
  • Official Playmaker Support
    • LinkedIn
Re: Ai Example, and should I use 1 FSM or multiples?
« Reply #1 on: October 04, 2011, 06:54:08 PM »
Generally dividing functionality into multiple FSMs is a good idea. The goal is to keep each FSM as simple as possible, so it's function is clear and is easy to maintain and expand... You can then send events between FSMs and/or get/set FSM variables.

I know a bunch of people are using Playmaker for AI. We'll try to get some simple AI samples/tutorial videos out soon...

A couple of quick tips:
- Embed smarts into the level where possible. E.g., trigger volumes that cause state changes.
- Some random branching in state transitions can keep the AI interesting. E.g., an idle state with random idle animations/behaviours.
- Look into Raycast for AI perception, and investigate layers and tags to keep things organized.