Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Are off-stage DisplayObjects in Flash still slowing down my game?

How does Flash deal with elements that are off-stage?

Obviously Flash doesn't actually render them (because they don't appear anywhere on-screen), but is the process of rendering them still existent, slowing down my game as much as it would if the elements were on-screen?

Or does Flash intelligently ignore elements who don't fall into a renderable area?

Should I manually manage removing objects off the DisplayList and adding them back on as the exit and enter the stage, or is this going to be irrelevant?

like image 417
Marty Avatar asked Nov 05 '22 05:11

Marty


1 Answers

Yes, they are slowing down your game.

In one of my early experiments I've developed a sidescroller game with many NPCs scattered around the map, not all visible in the same screen. I still had to calculate stuff but they weren't on the screen. The performance was significantly better when I handled their removal off the display list when irrelevant (by simply checking their X in relation to the 'camera'). Again, I'm not talking about additional code and events that may be attached to them, just plain graphical children of a movieclip.

The best practice though, in my experience, is drawing the objects in bitmaps. Of course if you're too deep into your game already this may be irrelevant, but if you have the time to invest, this is one of the best ways to get the most out of AS3 regarding 2D games. I found some of the greatest tutorials regarding bitmaps and AS3 in 8bitrocket http://www.8bitrocket.com/books/the-essential-guide-to-flash-games/ I can elaborate on the subject if you want, but I think I'm going off topic here.

like image 141
ido Avatar answered Nov 11 '22 13:11

ido