Wiki

Clone wiki

WorldCreator / The_Block_map

The Block Map

In the previous articles we have only ever looked at the heightmap. The problem with using jsut the heightmap however is you don't get to choose what blocks to use for the terrain. For example you may want part of your world grass, and the next part sand. The block map allows us to do just this.

Before we start looking at the block map, open up the config.json for the world you should have already generated. If you haven't done this already then refer to the Getting started tutorial. The configuration should look something like this

{
  "biomes": {
    "69a41b": "FOREST",
    "c9c3b7": "TAIGA",
    "f8f55f": "DESERT",
    "3f47f2": "OCEAN",
    "b26a9b": "MUSHROOM_ISLAND",
    "1ca52a": "JUNGLE"
  },
  "blocks": {
    "4c853c": {
      "middle": 1,
      "blocks": [
        "bedrock",
        "stone",
        "dirt",
        "dirt",
        "dirt",
        "dirt",
        "grass"
      ]
    },
    "209900": {
      "middle": 1,
      "blocks": [
        "bedrock",
        "dirt",
        "grass"
      ]
    },
    "e9ea33": {
      "middle": 1,
      "blocks": [
        "bedrock",
        "stone",
        "sandstone",
        "sandstone",
        "sandstone",
        "sandstone",
        "sand",
        "sand",
        "sand",
        "sand"
      ]
    },
    "c2c441": {
      "middle": 1,
      "blocks": [
        "bedrock",
        "sandstone",
        "sand",
        "sand",
        "sand",
        "sand"
      ]
    }
  }
}

The section we are interested in is the blocks section. Just taking the first blocks entry we have something like this:

"4c853c": {
      "middle": 1,
      "blocks": [
        "bedrock",
        "stone",
        "dirt",
        "dirt",
        "dirt",
        "dirt",
        "grass"
      ]
    }

Each block consists of 3 parts. The color, The middle block, and an array of blocks.

Color

The color of the block "4c853c" is the color you'll use in the block map to create the particular terrain. In this example the color is a grey-green.

Middle

The middle "middle": 1, states which block will be repeated in-between the lower and upper blocks. This is a zero based index which means that a value of 1 will mean the 2nd block gets repeated.

Block array

The blocks array is wht defines what blocks to use for this terrain type. In the example above the blocks are as follows:

"blocks": [
  "bedrock",
  "stone",
  "dirt",
  "dirt",
  "dirt",
  "dirt",
  "grass"
]

With middle set to 1 as above this example will place one piece of bedrock at the bottom of the world. It will then fill the middle with stone, and then top it off with 4 blocks of dirt, and one block of grass.

Creating the map

Now that we know how the blocks are defined we can now begin to create our blockmap. To help I've created a quick reference for the blocks provided in the default config:

ColorBlocks
4c853cGrass with stone below
209900Grass with dirt below
e9ea33Sand+Sandstone with stone below
c2c441Sand with sandstone below

All of the above examples contain one layer of bedrock at the bottom.

Using these colors we can now create a simple texture to choose our terrain:

  1. Create a new 512x512 image. Don't worry about the background
  2. Fill the background with the color of the default terrain you want to use. In my example I used the color 4c853c (Tip to set the color in GIMP simply open the color picker and paste the code into the HTML Notation box).
  3. Next draw a few splodges of the other colors listed in the table. Make sure to use the pencil tool with a hard edge since we only want the colors that we've defined. Once you've done that the image should look something like this: blockmap_basic.png
  4. Save this file in your world's data folder as blocks_<x>_<z>.png where <x> and <z> are the x and z coordinates of the region you're generating. Before regenerating the world make sure you still have a heightmap for the same region. If not grab one from one of the previous tutorials.
  5. Regenerate the world and enjoy. Here's what I got: blockmap_basic_result.png One thing to note is the different "filler" blocks will give you different cross sections of the world as shown: blockmap_basic_section.png

Updated