Gamasutra: The Art & Business of Making Gamesspacer
Interview: The Making Of Dwarf Fortress

Printer-Friendly VersionPrinter-Friendly Version
View All     RSS
April 18, 2014
arrowPress Releases
April 18, 2014
PR Newswire
View All





If you enjoy reading this site, you might also want to check out these UBM TechWeb sites:


 
Interview: The Making Of Dwarf Fortress

February 27, 2008 Article Start Previous Page 7 of 10 Next
 

The World Generator

Let's talk about the world generator for a bit. If you wouldn't mind giving us a general overview of the process the game goes through? No need to go into great detail.

TA: Sure. The first overall goal of the world generator is to create enough information to produce a basic biome display. A lot of initial attempts at a world generator will start with things like "I need to lay down some forests, and some mountains, and some rivers, and some deserts..." and then when you end up with a jungle next to a desert, or a desert next to a swamp in an unlikely way, it's difficult to fix.

So the idea is to go down to basic elements. The biomes are not the basics, they arise, at least in DF, from several factors: temperature, rainfall, elevation, drainage. First, it uses midpoint displacement to make an elevation map.

It also makes a temperature map (biased by elevation and latitude) and a rainfall map (which it later biases with orographic precipitation, rain shadows, that sort of thing). The drainage map is just another fractal, with values from 0 to 100. So we can now query a square and get rainfall, temp, elevation and drainage data.

This is where the biome comes from. There's an additional vegetation field so it can alter the amount (from logging for example), and there's also a "savagery" and a "good/evil" field. So for instance, if rainfall is >=66/100 and drainage is less than 50, then you have a swamp.

The nice thing about having the fractally-generated basic fields is that the biome boundaries all look natural. Part of the trick was to differentiate things like swamps and forests. There's also a salinity field, to differentiate fresh and saltwater marshes, etc. Just lots of basic information, so you don't try to shoehorn anything into place. Just let it happen and these fields can all potentially be altered.

I guess oceans get high salt as a special step?

TA: Yep, for now, it just sets the salinity to 100 at the oceans (oceans are just all the low elevation spots), and tapers it off quickly over the land squares.

You still get some artifacts from the midpoint displacement. It tends to like vertical and horizontal lines, so the next step is the erosion phase.

It picks out the bases of the mountains (mountains are all squares above a given elevation), then it runs temporary river paths out from there, preferring the lowest elevation and digging away at a square if it can't find a lower one, until it get to the ocean or gets stuck. This is the phase where you see the mountain being worn away during world creation. I have it intentionally center on a mountain at that point so you can watch.

This will generally leave some good channels to the ocean, so it runs the real rivers after this. However, some of them don't make it, so it forces paths to the ocean after that, and bulges out some lakes. Then it loop-erases the rivers, and sends out (invisible on the world map) brooks out from them. During the loop-erase it also calculates flow amounts and decides which rivers are tributaries, and names the rivers.

This gives us a world with biome data and rivers, but no actual life. So now it actually looks at the general biome groups of each square (what I call a region type) and forms regions, giving them names. So you can have the "Silvery Forest" which is taiga in the cold regions and a jungle in the warm region, as long as it is connected.

At this point, it looks at the biomes available in each region and sets up plant and animal populations. This gives you a canvas for world history.

And from there I imagine it's just looking up the combinations of circumstances and looking them up in a table of random possibilities.

TA: Yeah, I'd like to do more with ranges for animals, so that it's not so scattered. So that many of the northern forests have certain critters, and many of the western forests have others to kind of set up more of a geographical image. Right now, it goes strictly by biome type. It also sets up all the seed information around this time. There are some additional structures it sets up, for features like cave rivers and so on. So it could set up a non-local feature like a world-wide cave tunnel like this.

It wouldn't be so complicated to have the computer generate the races itself, though the lack of familiarity could be jarring. Armok 1 did this.

Very cool idea, I'd say. But does this mean we won't have dwarves to play in the future?

TA: Nah, I like having a stock universe around. It helps people get into the game, and they can stick with that if they like.

I do like the idea of there being unknown species to discover though.

TA: The intermediate part of this might be the most interesting. Like when an evil wizard creates a randomized race, and over several games it actually forms towns, starts wars, etc. Then you play one in adventure mode. Lots of possibilities here.

I've kind of put some of that to the back burner while I work on the basics, like the current Army Arc. But it's really cool that I could start working on that even now if I wanted to. I've always wanted to be able to do some of this stuff!


Article Start Previous Page 7 of 10 Next

Related Jobs

Sucker Punch Productions
Sucker Punch Productions — Bellevue, Washington, United States
[04.17.14]

Director of Engineering
Gearbox Software
Gearbox Software — Plano, Texas, United States
[04.17.14]

Graphics Programmer
SOAR Inc.
SOAR Inc. — Mountain View, California, United States
[04.17.14]

Unity 3D MiniGame Programmer (and Designer)
Darkside Game Studios
Darkside Game Studios — Sunrise, Florida, United States
[04.17.14]

Mid-Senior Graphics Programmer






Comments


Edwin DeNicholas
profile image
This awesome interview ended too suddenly. Where's the rest?

Aaron Murray
profile image
Nice tech article :)

It did end a little abruptly...

K Olsen
profile image
Indeed - fascinating stuff, but where's the rest?

(if any)


none
 
Comment: