(This is a long post, and mainly code & theory related. Just FYI)
So I mentioned I wanted the game to run faster. There were two more things I wanted to try. The first is optimizing the backgrounds. The default graphic type is vector art, and flipping it to a bitmap is supposed to make the game run faster. It's a pretty simple change, you just add this code to the 1st frame of the clip:
this.cacheAsBitmap = true
I don't quite understand why this works BTW. It has something to do with vector art requiring more resources when it needs to update (Vector art can also do more, like spin or zoom easily, so vector art is also the safer choice most times). What I do understand is that the first time I tried it the results were just crazy good, possibly better than the quality button. Unfortunately, subsequent applications were not so incredible, and often I couldn't see any improvement at all.
So I decided to try & be a bit more scientific about this. I built a shitty little FPS counter by placing this code in the main loop:
newtime = getTimer()
_root.xxx = _Math.round(1000 / (newtime - oldtime))
oldtime = newtime
There's some variable declarations elsewhere of course, and _root.xxx is just the name of a global variable I use when I'm chasing errors. With this 'tool', I then altered the background in small steps. I also reset horde mode to spawn exactly 10 monsters just off from the hero. And here's what I found: (I should note that the FPS output was an integer, so the decimal point is my interpretation of how often it was flipping around.)
FPS
Original Background: 3.4
Bitmap, built from movie clips: 3.9
Bitmap, drawn from shapes: 4.0
No Background: 5.1
Yeah, that's some shitty FPS there eh? It's supposed to be 20. But it does show an improvement with this bitmap idea, so at least it's a step in the right direction.
The other thing I wanted to play with was optimizing the symbols that make up the bad guys. I think I've mentioned this before, but there's a simplify tool that will substantially reduce the line count of your symbols (The command is in the main toolbar, under Modify, Shape, Optimize). I played with this in the past & wasn't impressed, so this time around I cranked it to max settings. Not as a permanent change, more to see if it would do anything at all. In my mind, this should be very similar to what the quality toggle is doing, so I was hoping to perhaps find a good middle ground between graphics & performance. And here's what I got:
Normal Monsters Optimized Monsters
Original Background: 3.4 4.0
Bitmap, built from movie clips: 3.9 4.2
Bitmap, drawn from shapes: 4.0 3.7
No Background: 5.1 4.6
Now call me a pessimist, but the FPS numbers between the normal & optimized are virtually the same in my opinion. There's no clear indicator that optimizing the shapes improved performance at all. (This also tells me there's a lot of error in my data gathering ability, but that's nothing new. hahah). In my mind, it does show a small improvement with the bitmap idea though, so I'm going to keep doing that for backgrounds. And it looks like it doesn't matter how the backgrounds are built either, which is nice because it means I don't have to change a lot. hehe.
So, that's my conclusions from this. What do y'all think? If I toggle the quality button to low, the FPS jumps up to anywhere from 12 to 20. So clearly the quality button is doing more than the optimize shape command. In my opinion, that also means the bulk of the processing time is being spent on the graphics, not the code. I reckon that's a good thing, but I'm not sure there's much I can do to fix it, short of 'draw less'.
DirtyC101