playMaker

Author Topic: Share FSMs Between Prefabs [accepted]  (Read 4627 times)

FelixDraconis

  • Playmaker Newbie
  • *
  • Posts: 5
Share FSMs Between Prefabs [accepted]
« on: September 29, 2011, 06:22:32 PM »
This might be the main complaint in our studio with PlayMaker.

We're exploring various workarounds to this problem, but none of them have proved effective yet.  It's enough that most teams are gravitating away from using PlayMaker altogether, which is a shame as it would otherwise save time.  It's good for one-offs but makes it very hard to envision how to construct reusable AI.

One possibility posted is to construct FSMs dynamically, but there's a lot of limitations with that.  You have to go in and assign all the variables again manually.  As well, it makes it really tough to spot errors until you test spawn that object, which isn't feasible in many situations thanks to the limitation where one user can edit a scene at a time (Perforce sharing).

I'd really like to find some solution for this, but I fear that it may be impossible/difficult due to current problems with Unity (which we're already writing systems to work around).

You can copy FSMs, at least, with minimal issues, but that's not a maintainable long-term solution.
« Last Edit: September 30, 2011, 10:48:47 PM by alexchouls »

tobbeo

  • 1.2 Beta
  • Full Member
  • *
  • Posts: 186
Re: Share FSMs Between Prefabs
« Reply #1 on: September 29, 2011, 07:32:29 PM »
It's a good and valid point. I think it's a bit extreme to say that Playmaker isn't usable without this feature but I can completely see the necessity, especially on slightly larger projects. Hopefully Alex is paying attention. I think it's been raised before but I am not sure. Best thing would be to suggest how it would work in practice so you and others can give Alex an idea of how people want it implemented.

tobbeo

  • 1.2 Beta
  • Full Member
  • *
  • Posts: 186
Re: Share FSMs Between Prefabs
« Reply #2 on: September 29, 2011, 07:41:00 PM »
Solution a) Quick fix?:

As I am thinking about this, an "Invoke FSM" action would cover this issue. You specify the FSM you want to Invoke and then copy that FSM to all your objects that you want to use your original FSM. Then you can have a central Gameobject that contains an FSM with your AI or whatever.

This would also solve your other feature request of reusable states. Generally I find it much easier to keep each FSM as small as possible so that I can re-use it.

Solution b) Maybe a better one but would take a bit more time?:

Though another idea would be to implement an instancing system where you can instance FSMs or even States with a visual feedback letting you know it's an instance along with another window that shows how many times you've instanced an FSM or State. Ideally on top of this it'd be great to see which objects use them and select them easily.

Edit: In 3ds max for an example, if a modifier is instanced it shows up in italic. That could be one way to easily know if a state or FSM is instanced.
« Last Edit: September 29, 2011, 07:51:36 PM by tobbeo »

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 4000
  • Official Playmaker Support
    • LinkedIn
Re: Share FSMs Between Prefabs
« Reply #3 on: September 30, 2011, 10:33:41 PM »
This is definitely something I'm looking into. Templates are re-usable FSMs, so I'm exploring how FSMs can reference Templates. The first step will likely be an AttachFSM action, so you can add an FSM Template to an object at runtime.