Skip to main content
Known Participant
July 5, 2011
Answered

dealing with slowdown in game performance?

  • July 5, 2011
  • 2 replies
  • 1174 views

So, I'm running into a pretty tough roadblock trying to develop a game for the iphone 4/ipad.  The best comparison to what i'm working on would probably be Plants vs. Zombies. My road bock is I can't get more than 10 enemy's on screen bofore i get some major slow down. 2.7 update helped a little, but not enough to really get the preformance I need.

My game resolution is 960x640.  All objects on screen are raster (png) based. I'm rendering in GPU mode.  The average 'enemy' object is aprox 60x100 pixels and about ten frames of animation.  I'm not using any blending modes, and no .alpha property changes. No tweening.  I've basically pulled out all the major code at one point or aonther, and just tested having a large number (say 14) of the enemy objects (animated movie clips) on the screen (and viewed the resulting slow down). I'm also object pooling just about everything.

I have seen games push WAYYY more in terms of how much they have going on on-screen, so I'm wondering if this is one of the limitations of the Flash engine?  I can only guess that I'm just running out of memory?

Any thoughts or insight on people running into similar issues (and hopefully some solutions) would be greatly appreciated.

Thanks,

-dis

This topic has been closed for replies.
Correct answer Colin Holgate

What you were trying with visibility is almost a good idea! If you used CS5.5's visibility keyframes, you could set up a walk cycle that achieved its goal by only showing one thing at a time.

Unfortunately, when the timeline loops the caching is lost. So, try your idea, only duplicate the effect to last a long time in the timeline. It ought to them work, and would save you having to use code to get the same results.

2 replies

Colin Holgate
Inspiring
July 5, 2011

All of the frames of the characters would need to be cached on the GPU, and then cycled using various approaches. If you're just cycling or blitting through the frames, each one is having to be sent back to the GPU every frame. When I've done it I used visibility to do the cycling.

Known Participant
July 5, 2011

Collin,

Interesting approach.  How much of a performance boost did this method give you?

I tried a quick test by taking my in-line frames of animation and moving all of the individual sprites to a single frame.  Then just assigned the appropriate .visible  states on the time-line. Unfortunately I didn't see much change in performance on the device. But, perhaps this isn't a proper method?

I'd love to to hear about what caching methods work, and what doesn't, if you know of any good resources or examples. 

Thanks,

-dis

Colin Holgate
Colin HolgateCorrect answer
Inspiring
July 5, 2011

What you were trying with visibility is almost a good idea! If you used CS5.5's visibility keyframes, you could set up a walk cycle that achieved its goal by only showing one thing at a time.

Unfortunately, when the timeline loops the caching is lost. So, try your idea, only duplicate the effect to last a long time in the timeline. It ought to them work, and would save you having to use code to get the same results.

relaxatraja
Inspiring
July 5, 2011

Try with the rendering mode CPU

Known Participant
July 5, 2011

Unfortunately CPU mode makes slow down considerably worse.