playMaker

Author Topic: 1,000 FSMs (any tricks to save perf?)  (Read 3133 times)

Haymaker

  • Playmaker Newbie
  • *
  • Posts: 11
1,000 FSMs (any tricks to save perf?)
« on: March 08, 2016, 02:28:09 PM »
I have a 100x100 grid.  Each tile on the grid can be tapped/selected via an FSM with a "Touch Object Event".  I'm running pretty slow here.

How can I speed things up?

Tonda

  • Playmaker Newbie
  • *
  • Posts: 31
Re: 1,000 FSMs (any tricks to save perf?)
« Reply #1 on: March 08, 2016, 06:00:06 PM »
I had a very similar amount of FSMs, 60x32x4 however many that is.

After flailing about endlessly looking for a solution , what greatly increased my response speed was disabling all Error Checking boxes in Playmaker Preferences.

(when you want to check for FSMs errors you check manually by just toggling "Enable Real-Time Error Checker on/off)

Let me know how that works.

Haymaker

  • Playmaker Newbie
  • *
  • Posts: 11
Re: 1,000 FSMs (any tricks to save perf?)
« Reply #2 on: March 09, 2016, 11:35:34 AM »
What I am experiencing is a major slowdown in FPS.  The slow down is incremental, meaning, if I delete half my gameboard my game runs 50% faster.  I am building to an android device (Nvidia Shield K1).

Maybe there is some way in playmaker to turn off the FSMs and turn them on as I tap around on the gameboard.  Then I wouldn't have 1000 FSMs sitting there waiting to be tapped.


Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 3987
  • Official Playmaker Support
    • LinkedIn
Re: 1,000 FSMs (any tricks to save perf?)
« Reply #3 on: March 09, 2016, 02:00:59 PM »
It's actually 10,000 FSMs   ;)

TouchObjectEvent does a Raycast, so you're doing 10,000 Raycasts every frame, which is going to be slow!

You should try to reorganize so you do one Raycast to pick a GameObject then send an event to that GameObject.

Right now I think you'd have to use a few actions to do this, e.g., Touch Event, Get Touch Info, Screen To World Point and Raycast. Or there may be a custom action on the Ecosystem to streamline this. If not, this seems like a good action for us to make...



djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7615
    • jinxtergames
Re: 1,000 FSMs (any tricks to save perf?)
« Reply #4 on: March 09, 2016, 02:58:15 PM »
Hi,
I made a quick sample, hope this helps you :)


Haymaker

  • Playmaker Newbie
  • *
  • Posts: 11
Re: 1,000 FSMs (any tricks to save perf?)
« Reply #5 on: March 09, 2016, 04:52:52 PM »
You guys rock.  Thanks so much!

I'm going to go for a touch manager strategy.

Haymaker

  • Playmaker Newbie
  • *
  • Posts: 11
Re: 1,000 FSMs (any tricks to save perf?)
« Reply #6 on: March 09, 2016, 11:28:20 PM »
UPDATE...

My current strategy works just fine it seems.  I upgraded my Unity to pro and took at a look at the profiler.  I discovered 75% of my perf was in the PlayerMakerGUI, added to my scene by default but unused by my FSMs.  I deleted it and everything in my game works great, including seeing a rock-solid 60fps.

jasperPT

  • Full Member
  • ***
  • Posts: 115
  • I am a VFX Animator teaching myself to make games
Re: 1,000 FSMs (any tricks to save perf?)
« Reply #7 on: March 10, 2016, 04:47:22 AM »
Have you looked into using arraymaker and hash tables to do this?

Instead of having FSMs on each object you can have one "controls" FSM that checks what you are clicking on in the scene (via raycast ect) then you can just store those objects in an array or hash table.

If the objects change state when you click on them ect, just run through the hash tables and update what is happening to the object depending on what table they are in ect.

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7615
    • jinxtergames
Re: 1,000 FSMs (any tricks to save perf?)
« Reply #8 on: March 10, 2016, 05:52:44 AM »
Hi jasperPT,

I will try to make a tutorial video for this next week.
Do you have a sample of how you set this up?
That would save me time to figure it out myself :)