User Tools

Site Tools


projects:dwarfcraft

DwarfCraft: A Tragedy

See DwarfCraft on GitHub

 If you have read about my interests, then you know that procedural generation is an interest of mine. Although I was interested in it, I lacked a canvas to test out my ideas. My dream was to program a procedural generator for Minecraft, but alas, for so long this goal seemed out of reach.

The classic option of using MCEdit filters wasn't going to cut it. For one thing, they lack the fidelity that I wanted. For another thing, MCEdit hasn't been developed since 2016, and doesn't work on newer versions of Minecraft. All seemed lost for my dream – until I found Amulet.

Amulet is the next generation of Minecraft world editors. It is in active development. When I found it, the project was in it's infancy, and I had no clue what was going on in the code. There was basically no API documentation. So, I did the only thing that I knew to do - hack. The result of this hacking was DwarfCraft.

The rationale for DwarfCraft was that caves in Minecraft are boring. You go down into the cave, there are some monsters, but there are only monsters because it is dark. The only thing to see is stone, gravel, and occasionally ore 1). I wanted more interesting caves.

DwarfCraft added:

  • Ore difficulties. More valuable ore tended to spawn deeper in the map than, say, iron. This is significant because the danger of the world also increases the deeper you go.
  • Lots of cave generation “upgrades”. Depending on how you look at them, some of these could be considered downgrades.
    • Caves no longer have a bias to be up or down. One thing you might not know about vanilla minecraft caves is that they are biased to be easy to walk around in. Well, screw that. In DwarfCraft they can go in any direction- up, down, left, right, sideways, you name it. This leads to some very unique cave generation.
    • Configurable size. Cave size can be configured from the command line. Caverns more your style? Set it big. Like claustrophobic passages? Set it small.
    • Configurable density. You can make caves as rare or common as you want.
  • Glowstone clusters. These stalactites would provide natural, eerie lighting in the depths.
  • Lava pools. These are similar to vanilla lava pools, but they can be configured to (at cost of processing time) fill caves systems. More likely to occur at greater depths.
  • Spawners. They spawn monsters. The deeper you go, the more likely they are to be buffed with armor, weapons, and potion effects. In terms of difficulty, the command line reference warns: “Be careful: Even 5% [spawn chance] was too much.”
  • Cave bushes. Trees that just kind of go everywhere. The only source of wood in the caves.
  • Biomes. Different block types for caves. The two options were stone (the default) and organic (grass blocks, flowers, etc)
  • Water Pools. Spawn with sand, sugarcane, etc.

DwarfCraft also boasted an impressive command line interface. Almost every aspect of the world generation could be configured from the command line. Running “main.py –help” speaks for itself:

usage: main.py [-h] [--full_reset] [--skip_ores] [--ore_pockets_per_chunk ORE_POCKETS_PER_CHUNK]
               [--ore_pocket_size ORE_POCKET_SIZE] [--skip_caves] [--cave_fill_cube N] [--cave_length CAVE_LENGTH]
               [--cave_max_size CAVE_MAX_SIZE] [--cave_min_size CAVE_MIN_SIZE] [--skip_cave_deco]
               [--glowstone_clusters GLOWSTONE_CLUSTERS]
               [--glowstone_cluster_spawn_chance GLOWSTONE_CLUSTER_SPAWN_CHANCE]
               [--glowstone_cluster_compression GLOWSTONE_CLUSTER_COMPRESSION]
               [--glowstone_cluster_max_length GLOWSTONE_CLUSTER_MAX_LENGTH] [--lava_pools LAVA_POOLS]
               [--lava_pool_spawn_chance LAVA_POOL_SPAWN_CHANCE]
               [--lava_pool_punishment_factor LAVA_POOL_PUNISHMENT_FACTOR] [--lava_pool_fill LAVA_POOL_FILL]
               [--mob_spawners MOB_SPAWNERS] [--mob_spawner_spawn_chance MOB_SPAWNER_SPAWN_CHANCE] [--bushes BUSHES]
               [--bush_melons BUSH_MELONS] [--bush_melon_spawn_chance BUSH_MELON_SPAWN_CHANCE]
               [--bush_spawn_chance BUSH_SPAWN_CHANCE] [--bush_compression BUSH_COMPRESSION]
               [--bush_min_size BUSH_MIN_SIZE] [--bush_max_size BUSH_MAX_SIZE] [--biomes BIOMES]
               [--biome_flower_spawn_chance BIOME_FLOWER_SPAWN_CHANCE]
               [--biome_grass_spawn_chance BIOME_GRASS_SPAWN_CHANCE] [--water_pools WATER_POOLS]
               [--water_pool_sand_border WATER_POOL_SAND_BORDER] [--water_pool_spawn_chance WATER_POOL_SPAWN_CHANCE]
               [--water_pool_sugarcane_spawn_chance WATER_POOL_SUGARCANE_SPAWN_CHANCE]
               world_path size

All of these options were documented. Here is the section that described cave generation options:

CAVES:
  --skip_caves          Skip cave generation.
  --cave_fill_cube N    One cave should be located in each NxNxN area.
  --cave_length CAVE_LENGTH
                        The length of a cave.
  --cave_max_size CAVE_MAX_SIZE
                        Maximum size of a cave.
  --cave_min_size CAVE_MIN_SIZE
                        Minimum size of a cave.

 So, what happened? Well, remember how I said the whole thing was hacked together? That came to bite me in the rear end. When I switched computers, DwarfCraft just kind of stopped working, for reasons I don't really understand. It likely had to do with me doing something hacky on the backend that “just worked” on my other PC.

To top it all off, Mojang released plans for their Caves and Cliffs update in October 2020, just five months after the last commit in DwarfCraft. Guess what Caves and Cliffs adds? New cave generation algorithms and biomes. 🤦‍♂️ Caves and Cliffs isn't exactly what my vision for DwarfCraft was, but it falls firmly in the “good enough” category. Caves will soon not be boring any longer.

So, was it all a waste of time? I guess that is a matter of perspective. I had a lot of fun creating it, although tinkering and experimenting was a bit maddening at times. Sure, procedural generation won't help me in my career, but learning the importance of dependency management might. Overall, I don't regret the time I spent developing this.

If you still want to play on a DwarfCraft map, even if the program doesn't work, boy do I have good news for you! The releases page for each update has an example world, for this very reason. So all is not lost. Be careful though - me and two of my friends (BJ and AD) were very quickly overwhelmed in the map.

1)
andesite, granite and diorite are given a seat on the council but not granted the rank of master
projects/dwarfcraft.txt · Last modified: 2021/04/25 18:16 by Owen Mellema