Infinite Ammo 4k
Photon Storm
Code by Richard Davey
Graphics by Richard Davey / inspired by Geometry Wars (Bizarre Creations)
Infinite Ammo was my entry to the first Flash 4k Game Competition held by Urbansquall and Gaming Your Way. The objective was simple (on paper). To create any game you wanted, using any version of Flash. The only limit was that the final SWF had to compile to 4096 bytes in size or less.
When you're dealing with such a tiny size limit you have to watch every single byte carefully. That's not enough room to draw a wide variety of baddies for example, or even to have much text in your game. So I had to try and be clever about the style of game I made.
My original plan was to try and re-create as much of the classic Geometry Wars as possible. Geometry Wars benefited me because all of the graphics are very geometrical in shape and appearance. This is wonderful because it meant I could re-create them using Flash's drawing API, rather than try to draw them in the Flash IDE and have them in a library.
The final game ended up having 9 different baddies and the player ship. I was quite pleased with this. Each sprite has a glow filter applied that makes it look a little more "dynamic" than it otherwise would. I literally copied the colours used in Geometry Wars by using the paint dropper in Photoshop and extracting colours from screen shots of the original game, then applying them in code.
Obviously the original has the benefit of being designed for the X-Box 360 and it's twin stick controller. You use the left stick to move and the right to fire (you can fire at all angles around your ship). I had to emulate this somehow, so I let the player move using WASD (or the cursor keys for azerty folks!) and use the mouse to shoot. It takes a little getting used to, but I think it works out ok in the end.
Source Code Released
The source code for this game is available for download here. This is highly unusual for me, but I figure if anyone can learn anything from this 4k basket case of code then good for them! You will need Flash CS4 to compile the game. The original FlashDevelop project is included.
Flash Player 10? but it's not in 3D!
If you are wondering why the game needs Flash Player 10 it's because I use a new graphics API function called copyFrom(). This allowed me to create 1 set of baddie sprites at the start, shove them in a pool, and then just generate a new baddie on demand and copy the graphics data from the original set. This saved me a load of processing time, but sadly made the game FP10 only. I feel it was worth it though.
Development Trivia
I spent a long time optimising this game, crunching down every single last byte I possibly could. You can see the results of this process in blog entries around the time! But I still didn't want to compromise the graphical look either, so I stuck to my guns and included effects such as the gradient grid background and the beautiful explosion that happens when you die.
This game went through a lot of iterations! In the original your ship looked like the main ship from the Atari coin-op Asteroids. I changed this to the final sprite (which is far closer to the original) on the last day before submitting. I found that using the Asteroids shape meant that people expected the ship to control in the same way (with momentum), and expected it to fire out of the nose rather than any angle. The new ship gets around this.
It also took quite a bit of effort to get the boss wave into the game, and I don't feel it works half as well as in earlier builds either. In the early builds the boss would literally "snake" around the screen in a beautiful slinky way, but this got lost in the final version due to space constraints and a different tween system. I really should have put it back in but space was not on my side at that point.
I got really hooked on creating particle effects which writing this game. The game is a bit mad for particles, but I just loved them
I had great fun making this game. It's the first real "arcade" game I've made in AS3, and I've now got a real taste for it – so look out for a full version soon!
March 12th 2009 at 7:49 am
Yes, the particle effects are really amazing, and there are lots of eye candy, and glad to see that your enemies tweens are fixed, but the boss really looks retarded now
It would have been better if you could have just squeezed 3 more bytes out and made the particles random colored (when you kill an enemy), but all in all a great job for 4kb! This just shows that 4kb doesn't mean no graphics at all, but rather you can make some pretty nice graphics with 4kb.