I'm a 15yo indie developer. I all my life loved the indie games (<3). I started when i was 6yo. I understand AS3||AS2, A bit of Java && Lua, and why not, some of HTML. Actually i'm working on Dimentionalz

Report RSS The definitive optimization. Development tips

Posted by on

Finally, i improved the game on a never seen level! LOL.

Flash is naturally the slowest IDE. Thats obvious, (It should be named Slash, SLow ash xD) but i changed that. No, i didn't modified the adobe source code. [Mind note, change the flash soruce code okno]. I improved it on a never-seen level, and i will tell to others how to make it.

By the way, i checked my game with Adobe Scout. This is a software designed to check the performancye on your SWF's with a simple diagramm and some advanced things to show what scripts, renders, or any other things can lower the performance.

When i knew what was the highest performance impact, in my case, the render scripts, i had to do something.

  • The looped calculations have high performance impacts.

always use integer numbers, not calculations.

var im:int = cam.x - 10;

for(var i:int = 0; i < im; i++){

IS SLOWER THAN

for(var i:int = 0; i < 10){var something:int = i+cam.x}

  • Lots of symbols, vectors, shapes or other things are slow

Flash renders ALL, still if its out of the scene. To fix this, i recommend using a tile-based system and caching all the tiles.

  • Tiles are faster

Did you think that a tile-based game is ugly? That may be true if the developer doesn't make something to improve this. But there's something true, tiles are faster. In example, raycasting 100 pixels is slower than raycasting 4 or 2 tiles.

  • All in one...

This one is all that you think that is not. I thinked so when i readed this, but its faster. The trick is that, don't distribute all in diferent enter frames (if possible). This, strangley, makes a better ordering for the FPS, making a better performance, rare, not so?

  • Looped loops are slow

NEVER place a for in an EnterFrame event without the correct optimizations.

DONT DO:

function onenterframe(e:Event):void{

for(you_know_what_goes_here){}

}

I recommend doing so:

var something:Boolean = true

function onenterframe(e:Event):void{

if(something){

something = false;

for(var i:int = 0; i<max;i++){

if(i == max-1) something = true;

}

}

}

That looks longer, but its faster.

That's all by now, hope it helps you, TiosneyStudio here, peace out!

Post a comment

Your comment will be anonymous unless you join the community. Or sign in with your social account: