playMaker

Author Topic: FSM Design Question  (Read 1352 times)

samsamm777

  • Playmaker Newbie
  • *
  • Posts: 2
FSM Design Question
« on: March 10, 2018, 06:11:34 AM »
Hey,

I'm a seasoned software engineer, but very much new to FSM design. I'm working on my first game. I'm working on some enemy AI states. I've got a simple FSM which allows the enemy to idle, roam, seek etc. However, i want my enemy to continuously monitor whether the player is in the line of sight. But i want this action to happen no matter which state my FSM is in. I'm not concerned about the specific implementation here, i'm concerned about the design approach and the "right" way to achieve what i want. I don't think it makes sense for all my states to have the same actions in them to check for the player. If someone could point me in the right direction that would be great. Should i be using multiple FSM's?

Fat Pug Studio

  • Beta Group
  • Hero Member
  • *
  • Posts: 1294
    • Fat Pug Studio
Re: FSM Design Question
« Reply #1 on: March 10, 2018, 06:30:13 AM »
Yes, after a while you'll realize it's better to separate behaviours into different FSMs. For example, on enemy ships in my game i got one FSM that handles damage, another one that handles movement etc.

In you example, you should have an FSM listener for line of sight monitoring that will send an event to FSM appointed for controlling movement (when opponent is in range send event seek to movement FSM).

Modular approach can sometimes make it a drag to debug but improves reusability by making components.
« Last Edit: March 10, 2018, 06:34:41 AM by krmko »
Available for Playmaker work

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: FSM Design Question
« Reply #2 on: March 10, 2018, 02:05:47 PM »
Hi,
Maybe this tutorials can help you out :


samsamm777

  • Playmaker Newbie
  • *
  • Posts: 2
Re: FSM Design Question
« Reply #3 on: March 17, 2018, 11:49:19 AM »
Thanks for the info. I decided the right solution for me was to implement my own 'Actions' this way I can use Playmaker for purely the FSM. Then during my states, i can implement multiple behaviours in my custom actions, and achieve what i need to. This is a really good middle ground for me using playmaker.