playMaker

Author Topic: ArrayMaker Object Pooling Performance Issues  (Read 1519 times)

dramamine

  • Playmaker Newbie
  • *
  • Posts: 1
ArrayMaker Object Pooling Performance Issues
« on: August 01, 2014, 09:11:14 PM »
I'm working on a mobile game with gameplay similar to Flappy Bird with a unique theme and collectibles.  The background and player don't move horizontally, the obstacles and collectibles move from right to left to simulate movement. 

Originally, I just created and destroyed the obstacles and collectibles as needed.  Performance wasn't bad at all when running the game in debug mode, in the web player or on my Galaxy S3.  However, I knew reusing objects was supposed to be the more efficient way of doing this.
So, I downloaded ArrayMaker and reworked my FSMs to move objects around instead of reuse them.  The basic setup is as follows:

Diamond Generator (container object with Array List Proxy script) with 8 diamond pre-fab child objects.
Obstacle Generator (container object with Array List Proxy script) with 8 obstacle pre-fab child objects.

The prefabs have a target (an object on the left side of the screen) with a simple move towards FSM.  After they get close enough to the target they stop.  The generators use the select next action to select the next obstacle/diamond to simply move them to the right side of the screen. 

This seems to work but surprisingly performance is way worse than when I was creating and destroying the prefabs as needed.  It starts okay, but within 30 seconds or so, there's quite a bit of stuttering/frame rate dropping. 

Am I doing something fundamentally wrong here? I'm about to try to rework the way objects move...my thought is having all 16 objects always trying to move towards their target probably isn't a good idea, but wanted to put this out there to get thoughts. 

In case it makes a difference, this is a 2D game, using the 2D PlayMaker and ArrayMaker actions.

Thanks for any assistance!

Update: I put the move action in the Becomes Visible global event.  This works while non-maximized and performance seems pretty good.  However, when maximized the objects only start moving when I move them into view of the camera...like the event suggests. 

They kind of a just appear on the right side of screen, which isn't awful, but they stop moving when about half of the object is still on the screen.  I'm going to see if there's a way to enable/disable the objects when they are selected, but still looking for the best way to do this.
« Last Edit: August 02, 2014, 10:23:05 AM by dramamine »