playMaker

Author Topic: Best way to use PlayMaker: Productivity vs Performance  (Read 3459 times)

liteking

  • Playmaker Newbie
  • *
  • Posts: 3
Best way to use PlayMaker: Productivity vs Performance
« on: July 10, 2014, 04:05:15 AM »
Hi,
I've been using PlayMaker for a few days to create some AI behaviors in my game.
I used to code everything in C#, but for AI, nothing beats a visual FSM editor like PlayMaker.
However, due to the fact that PlayMaker is so powerful it can do almost everything, I wonder how much I should depends on PlayMaker to have the best performance vs. productivity balance.
For example, I used to handle collision & calculating damage and hp in C#, is it a good idea to move all those to PlayMaker FSM or should I keep those code in script?

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2511
  • Mender of the past
    • Cleverous
Re: Best way to use PlayMaker: Productivity vs Performance
« Reply #1 on: July 10, 2014, 08:07:50 AM »
I think it really depends on your particular application. Personally I would encapsulate it all in Playmaker FSM's but if it happens to be easier to interconnect some FSMs/logic into your existing scripts and systems then that would likely be better for you. The Script Control action category has the actions best for that.

Each project is different, and everyone is comfortable/faster working certain ways so it's really just a matter of finding that balance yourself. I don't script much at all, others like to script mostly then use FSMs for simple stuff. It just boils down to preference.

It's probably a big undertaking to convert an entire project of scripts to FSMs so maybe you are better off leaving the majority of the scripts to avoid rework, unless it was just a big improvement over messy scripts or something.
Products by Cleverous
|| Vault Core : Database
|| Vault Inventory : Multiplayer Inventory
|| Vault Attributes : Character Stats
|| That Hurt! : Dmg Floaties
|| Quinn : 3D

liteking

  • Playmaker Newbie
  • *
  • Posts: 3
Re: Best way to use PlayMaker: Productivity vs Performance
« Reply #2 on: July 11, 2014, 06:15:50 AM »
Thanks for the information, Lane.
I agree with everything you said, but you only mentioned productivity.
In term of run-time performance, is it a good idea to do everything in PlayMaker?

mweyna

  • Full Member
  • ***
  • Posts: 242
Re: Best way to use PlayMaker: Productivity vs Performance
« Reply #3 on: July 11, 2014, 06:44:31 PM »
Depending on your FSM and what your doing with it, you can easily kill your performance with sloppy practices. In general I've found that a playmaker FSM will add a slight overhead per FSM, that whenever possible try to limit the number of active FSMs running at any given time.

liteking

  • Playmaker Newbie
  • *
  • Posts: 3
Re: Best way to use PlayMaker: Productivity vs Performance
« Reply #4 on: July 12, 2014, 12:26:24 AM »
yeah, that's what I'm suspecting. Looking into some actions' source code, I can see that it will cost a lot more than my pure C# scripts.
Maybe I will only use PlayMaker for AI behaviors

mweyna

  • Full Member
  • ***
  • Posts: 242
Re: Best way to use PlayMaker: Productivity vs Performance
« Reply #5 on: July 13, 2014, 03:02:26 AM »
There are ways around it to some extent, where you can disable/enable FSMs. In my current project, I'm making a Dungeon Keeper like game so you have a large number of systems always running (units, build abilities, etc) and found that generally, seperating out high level logics to a global level (so my area of awareness is done via arrays on a global level, rather then each individual unit having it's own Area of Awareness FSM), and turning off FSMs until you absolutely need them makes things managable from a performance standpoint. That being said, I couldn't code my way out of a single line so Playmaker has been amazing at allowing me to make as much progress as I have.