Thursday, July 26, 2012

Alien Chase road generation

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.

No comments: