Long time no post! Auto Fire rides again!
OUTPOST REVISIONSCheck out the results in action right here!Something that is really enjoyable, believe it or not, is refining ways to generate cool maps. To see the result of a mad pile of code and some assets turn into something you can play can be a bit addicting. I've certainly got a lot to do for entirely new content, but since I was working on creating new types of maps, it was worthwhile to look back at how I was generating outposts.
Auto Fire uses a few different generators, one for rolling terrain, one for piecing together city blocks, one for populating hand-crafted levels... Originally I had been using the straight terrain generator that I use for battlefields and the overworld maps... a method of laying out blobs of varying terrains using
Voronoi regions. If you're unfamiliar those may sound froo-froo-fancy but for grids they are almost embarrassingly simple: Throw a bunch of spots down on the map that have a particular terrain type: mountains, clearing, rough terrain, etc. Test every tile on the map and mark it as part of whatever spot it is nearest. Add some noise and various other properties of each spot/region, plow roads to get you from place to place and you're pretty far along. It's at least enough for stuff like the overworld, where the specific terrain isn't so important.
For outposts, however, that was only part of the equation… I needed walled areas, I needed an “inside” and “outside” area. I wanted buildings to make the interior more interesting. I managed to piece together features like the walls and special setpieces like water towers and little dwellings. In the end the placement of buildings were random, which created a lot of unbelievable areas and many dead-ends… a curse for a driving game where speed is king.
The buildings were also single-tile affairs… This scale mismatch was deliberately set on early in the game’s development for cities, but have since been changed to a double scale that allows buildings to be more interesting and for roads to have more width in cities.
What I realized is that I had a really refined measure of control in cities, with varying width roads, support for passability and large crafted areas, and just overall a less random feel.
Cities are constructed using 8×8 blocks (which was 4×4 back when buildings were single-tile) that are crafted to hold a 2 or 4-lane road connector or a 1-lane alley (either left or right side). Each block has one or more exits, and a bunch of places where optional exits can be punched through if the system needs to create extra loops.
So why not do this with desert maps? Walls can be made this way of course, but we don’t want a desert map to look like Manhattan… Luckily there are a ton of tricks to keep roads from being straight and buildings falling in irregular patterns. This generator set used 4×4 tiles and almost entirely 1-lane roads, which can meander within a block like a
Carcassone tile to keep things from looking too precise. One set of blocks can be used for the inside of the walls, and another for the lighter desert features outside. Everything’s great except that terrain needed to come back into the fore.
And so it did! Parts of the terrain generator came over to the block generator to give the map a more natural appearance… considering it was largely giant squares. With it we got terrain rendering thanks to
Microsplat and some pretty nice grass from
Advanced Terrain Grass. Our road-plowing routines guaranteed passability and some other code helped give the driveable spaces a little bit of vertical rise and fall.
So “why now” might come to mind… “You’ve had outposts for years now, so what’s the big deal about revising them now?” Fair question. The main reason is my recent investigation into new map types: Industrial parks! Dueling arenas! Race tracks! I have some examples that I’ve hand built with assets I have, but I want to get those generating also… and this same method will work for all of them.
Highways are also a culprit, because they are okay maps, but the road is arrow-straight and can’t really incorporate curves. With my current overworld system I can’t draw two-lane roads without using this block method. Also, a road that curves gently like a highway or race track is best laid out on an 8×8 tile… or even a 16×16. These things are all possible in our brave new world!
That’s the big news of February… a new build will be coming out tomorrow. Excelsior!