DimWorld

Keywords: cellular automata terrain, automata terrain generation, understand procedural generation, map generation, dwarf fortress, game, alive, cell, time, fill, study. Powered by TextRank.

I am totally fascinated by Dwarf Fortress and the detail it can achieve. I have huge respect for Tarn who is the programmer of the game (and his brother too, who designed the game and probably came up with a lot of those great ideas). It’s a masterpiece in procedural generation for sure. I wish I had the time to play it thoroughly but I only have the time to study it and try to understand it’s mechanics. To this end I even bought the book “Getting started with Dwarf Fortress”. The best way to learn and understand procedural generation is to try to copy the masters, so I started something new: Dim World, a base building game that is set on some planet where you tell your colonists what to do and they might eventually do it.

The first thing is to get a map going so I ported over some cellular automata terrain generation code I had lying around to Swift. Refresher: Cellular automata basically generates or changes a tile based on the state of its neighbors. E.g If you have more than 4 neighbors that are alive the current cell dies and if you have 3 or less neighbors dead the cell becomes alive. This leads to interesting and natural-like patterns on the terrain.

i

The bright green and brown glyphs are trees and the blobs are forests. I had to augment the cellular automata generator with a flood fill algorithm to turn the blobs into things that resemble forests without holes. The trick here was to fill every hole except the largest one (which is the rest of the terrain).

Here's a video of some keyboard controls and map generation:

video


Metadata

Similar posts

Powered by TF-IDF/Cosine similarity

First published on 2021-08-30

Generated on May 5, 2024, 8:48 PM

Index

Mobile optimized version. Desktop version.