On the cusp of moving into the uber-geek status, Joey and I programmed a terrain generation feature in Actionscript 3 yesterday. It’s for a new defense/offense style game we’re cooking up. The game will have pregenerated levels however we really wanted to do an unlimited mode for the die-hard/got-too-much-time crowd who really wants to have some extended fun.
After a brief read of the Paul Martz article on how he generates terrain, we decided that fractal terrain is exactly what we needed especially for how we want to place objects on the terrain. In essence, the article talks about how you take a line segment and keep cutting it in half and pushing up or down. This way the terrain starts to form peaks and valleys.
We also experimented with a method that draws lines at random angles across the screen. In the end we found this method draws really peculiar shapes and that even when you start the weight the line towards the center that it starts looking like a sine wave.
Overall it looks great, especially when generated 20 times like seen above. But we’ll only be generating once so ideally we’ll need to polish up the mountains being made for the final release.
Upcoming blog post will talk about our game and what we’re planning, stay tuned! It’s a smaller project so it’ll be a great little diversion from the massive projects.