Thursday, July 26, 2012

My Twelve Months of Doomsday Alien Chase game was released last week on Blazing Games so this week I am going to briefly go over road generation. This is not the first time I have created a randomly generated map, but is the first time that I have created a car driving game.

I wanted a road that was randomly generated to give the game a bit more replay-ability. More important, the size of the map would be huge and I really didn't want to create a really large road map by hand. Creating a map by hand has the advantage of giving the designer a lot more control over the difficulty of the game and often can result in better looking maps, but if done properly you can get fairly good results from a randomly generated map.

The first task, which is necessary for both random and hand-mad maps, is to come up with the tiles that the map is made up of. As I didn't want an obviously tiled look to the road and grass, I decided that there would be a number of tiles for each piece of road which would be textured slightly differently. I opted for 10 tiles for each root type of tile. The root tiles in the game were grass, trees, curb, road, dashed road, lined road, dividers (left, centered, right). In addition to this, I realized that transitions for increasing or decreasing the road size and the divide size would also be needed.

The road is then broken into sections. To keep the generator more manageable, the sections only allow a single change to the road. The four changes are increases in lanes, decreases in lanes, increasing the divide, and decreasing the divide. If any transition is impossible, the road remains the same as it was for that section. Divides consider a double-line and a concrete separator different types of divides.

While in practice this system worked okay, I found that additional transition tiles would have been nice to have, such as a road curving as the divide is increased. I did not have enough time to add this extra transition, but may do so when this game is revisited in the future.

Thursday, July 12, 2012

One of the nice things about creating small projects is that it gives you a chance to play around with new techniques and try out new things. This is especially the case when the game is a type of game that you normally don't create. For this episode I played around with a different way of handling animation. I also experimented with vehicle systems. Finally, I tried a new way of spawning enemies.

The animation subsystem for this game is table driven with canned clips. Normally I use animations centered around the current coordinates of the object being animated. This has the advantage that it is easy to move the object as you can simply use linear interpolation. With the canned animation the motion is part of the animation meaning that the animation plays through with the coordinates not changing until after the animation has completed.

Making the animation system much more complicated was the number of different sequences. To handle all the different transitions necessary without needing a huge number of animations, only the core animation segments are created. The transitions then stored as a table of sequences. Each segment in the transition then gets played in sequence. This approach works great for more complex character animations.

The elevators were an interesting challenge. My first thought on handling the elevators was to treat them as platforms. This lack of control simply did not feel right so I opted instead to treat the elevators as vehicles. Players "enter" the elevator by jumping or crouching while standing in front of the elevator. The player then exits the elevator by moving left or right. While inside the elevator jumping and crouching become the up/down controls.

Because the main theme of the game is about moving through a building infested with aliens, having aliens pop out of the doors seemed to be a really good way of handling the spawning of aliens. Each door has a set number of aliens (based on the level) that it can spawn. To prevent too many aliens from showing up, there is a per-floor limit (again based on level). Finally, I decided to make the spawning of aliens time based.

If I had more time, I would have created a number of towers. I would also consider making the player retrieve a number of cases by entering multiple doors and then return to the first floor to complete a level. If I ever revisit this game, I may make these enhancements.

About Me

I am a programmer who can program in a large variety of programming
languages (including some Assembly Language) but am currently focused
on interactive web development which means my current focus is on Flash
and JavaScript. When I am not programming for clients, I am working on my
game site.