I have been focused in my limited free time this week on getting my 8K game down to 4K. I still have at least one more optimization to do and then a couple things to add, but I am at 3.9K!
Here are a couple of the things I needed to do to get here:
1. No optimized game loop – good old onEnterFrame is working fine
2. No object farms for projectiles or particles
3. No classes other than the main one
4. No embedded anything (sounds, bitmaps).
5. Simple Vectors drawn in code for game graphics.
6. As few functions as possible
7. I am sharing as many variables as global as I can.
8. I am importing as few Flash built-in classes as possible
9. No pre-created arrays of movement vectors
10. I don’t pre find the length of my arrays for for loops
11. I have actually repeated code in a few places rather than create a re-usable function
All of that is contrary to how I would optimize a game for speed, but in this case I need to squeeze as much game a possible into this tiny file size
What I left in:
I still have a completely blitted output screen which allows me to do a couple things that I can’t say just in case UrbanSquall reads this and it gives away which game is mine.
The one optimization I have left is to combine my update and render loops into one and do collision after (not the correct way, I know). I feel that this will save me enough file size to add in the a few messages needed for game play, start, end, and a graphical enhancements (still no chance at sounds)
I certainly hope to have the 4K version done this weekend so I can start work on the AWESOME 16K version =) that will have 4X the features. It will be like going from the speccy to the Amiga.