Just finished my first game since going solo and it went pretty well. It’s a pretty simple top-down shooter. I wanted to test myself with a 1 week schedule, but ended up taking 2 weeks.
I’ve put it on Flash Game License. This is the first time I try out their service, but I’ve only heard good things. I’ll put a link up after the game’s live.
The soundtrack was done by my brother, Jonathan Rock. After the game’s out, I’ll put the music here for download.
The game is entirely blitted (using a single bitmap display instead of many sprites), which allowed me to fill it with action without any worry of slow-down. The framerate is a solid 30fps. It even seemed to run well at 60fps, but I didn’t want to alienate anyone on a crappy machine.
You can see in the screenshot that enemy movement is very fluid. That’s because I used timeline animation to guide everything. This was done with a ‘puppet’ system that updated blit data based on played movieClips even though they weren’t on the stage.
The background was generated from 4 different bitmapData objects. The 3 star layers were scrolled down (bitmapData.scrollTo(x , y)) by a given distance (their velocity) every frame and the gap left at the top was filled by an image of randomly generated stars using the setVector function which is extremely fast. The most efficient way to handle that was to constantly refresh the values of uint vectors with lengths fixed to exactly the value needed to fill the space of each bitmapData object.
There’s also a layer of perlin noise used to generate the smoky nebula effect that drifts by all the ships. Just as the stars were generated one piece at a time, the perlin noise was generated just at the top as a slice and then scrolled down as it ‘moves’. However I couldn’t use setVector to generate perlin noise, so I had to have a separate bitmapData object just for generating perlin noise that was only big enough to fill the space left by the constant downward scroll. Each time the perlinNoise function is called, it is passed an offset array so that the noise always represents the portion that should exist above what came before it. I ran into an annoying problem here until I realized that the ‘stitch’ argument in the perlinNoise function was set to true and should not have been. Generating perlin noise is very processor intensive, but I was pleased to find that if you generate it just a little bit at a time, you have no problems at all. I would like to use this same technique in the future to create infinitely large maps that are only generated one slice at a time as the player moves in any particular direction.
I based collision detection in this game on my work in the Bad Bones demo I showed at IGCW a couple weeks ago and found the bitmapData based technique to be very effective. Each ship filled a rectangular area which represented itself on a bitmapData object. They filled this area with a color that acted as an ID tag for that specific object. Other objects could then check a specific part of the bitmapData object to see if any other objects are there. The checker finds a specific color registered with a specific object and a collision is detected. The only limitations are that you cannot collision detect outside of the area of the bitmapData object and if you want collision detection for anything other than a rectangular shape, you must get a bit more complicated than the fillRect function (and lose some efficiency). This technique has proven to be so effective that I expect to make it a standard part of my game development process and recommend it to others.
Check back for the full game.
-Christopher J. Rock