playMaker

Author Topic: Multiple FSM Canvas  (Read 318 times)

Thore

  • Sr. Member
  • ****
  • Posts: 344
    • View Profile
Multiple FSM Canvas
« on: June 30, 2019, 11:27:58 AM »
I am about to hit some limits of Playmaker, which concern when you have a ton of FSMs on a game object that are all supposed to talk to each other. It's begins to become complicated to keep track of it, and the benefits of the visual graph begins to falter. For example, for a 2D character, I got about a dozen. I try to keep them small and separated, but not too separated and disjointed (e.g. movement and flipping is done in one).

It would be amazing if several FSMs that belong together could sit on a large canvas, each inside their own "box" doing their thing. But now you could also see how they interact with global events. Or maybe there would be a special type of 'regional event' that can be used for global event style transitions within this canvas.


djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 4615
    • View Profile
    • jinxtergames
Re: Multiple FSM Canvas
« Reply #1 on: June 30, 2019, 01:23:14 PM »
Hi.
Have you tried using Runfsm action.
it can reduce fsm usage.

on Playmaker beta i have seen the the run fsm gets an update where it will have input AND output, which will significantly improve the action.

at the moment you need to place the object that the action is in as a input and the use set fsm actions.

it works also tho :)

Also i have most "Data" on a separate fms, then i get/set it from other fsms using get/set fsm actions

i also do this to minimize using global variables.

Thore

  • Sr. Member
  • ****
  • Posts: 344
    • View Profile
Re: Multiple FSM Canvas
« Reply #2 on: June 30, 2019, 02:02:03 PM »
I used RunFSMs for things like debuffs, but haven't found a good grip on them. But now that you bring them up again, I think I could offload some of the FSM to RunFSMs. However, I still would like to see multiple FSMs on a big canvas to see their interrelations.

daniellogin

  • Full Member
  • ***
  • Posts: 167
    • View Profile
Re: Multiple FSM Canvas
« Reply #3 on: June 30, 2019, 09:08:46 PM »
I thought it was normal to have heaps of FSM's and confusion. I have a project which I come back to on and off, and I actually put together a quick 'manual' to refer to.. because when I look at it again it's like someone else made it and I can't remember how it's all hooked together. This waits for that, that needs an int from this, etc. I normally spend some time just following each FSM back and forward to see where they are sending events to and who is sending an event to kick them back in to action again.

I think I gravitated towards what djaydino said about 'data'. For example last night I made a score system for a mini-game, which is handled by an FSM which owns the int but does nothing (other than reset that int on start). Then each individual thing that adds points gets that fsm int, adds to the copy it made of it, then sends the modified copy back to the score keeper FSM. I figure this avoids situations like when the score keeper may be half way through a process and gets interrupted by another score update or etc.

I had a quick look at the RunFSM page, but I don't get what you would do with it or how it related to confusion about FSMS working together. It's like a prefab/template system, but that's all I can make of it. Wouldn't that be just like using an actual gameobject prefab with an FSM in it?

Thore

  • Sr. Member
  • ****
  • Posts: 344
    • View Profile
Re: Multiple FSM Canvas
« Reply #4 on: July 01, 2019, 02:11:08 AM »
My setup is fine, it’s not confusing. :) It’s just that the benefits of graphs start to collapse after a certain number of FSMs, because global events aren’t part of the graph.

I handle data with custom scripts that can hold scriptable objects.

The other issue is that you often need those FSMs to be all part of an object, but there is no good way (I know about) to set them all up correctly. You can chunk them together with a prefab or something, but it’s unwieldy. With scripts, stuff that belongs together can be all thrown into a single script.