# The World

Yesterday I finished a good deal of my world generator. At the moment, the world is made up of HashMap<Point, Integer> which is fairly easy to use but will be slower as the map will reach its final size (I try to get at least 20000*20000 walkable tiles). During creation, several Maps are created, such as one for height, one for forest. The important one contains the tile flag, a simple int that tells the game logic what type of Tile (enum) it is dealing with. In pseudo-code, I do this:
``````

//Make Noise
for(int x; x&lt;width;x++){
for(int y; y&lt;height;&lt;++){
Point p = new Point(x,y)
cellHeight = cellNoise(x,y) //several octaves
simplexHeight = simplexNoise(x,y) //several octaves
float height = cellHeight+simplexHeight
heightMap.put(p,height)
}
}
normalize(heightMap); //scale the value range (min, max) to (0,255)

//Make the general form an Island
for(int x; x&lt;width;x++){
for(int y; y&lt;height;&lt;++){
Point p = new Point(x,y)
height = heightMap.get(p)
heighheightMap.put(p,height)t = makeIsland(height)
}
}
normalize(heightMap); //I normalize twice because of negative values in the first step

//Create the Tilemap with heightmap values
for(int x; x&lt;width;x++){
for(int y; y&lt;height;&lt;++){ Point p = new Point(x,y) if (height &gt; THRESHOLD_MOUNTAIN) {
flag = Tile.FLOOR_ROCK_RAW;
} else if (height &gt; THRESHOLD_HILL) {
flag = Tile.FLOOR_ROCK_SMOOTH;
} else if (height &gt; THRESHOLD_DRYGRASS) {
flag = Tile.FLOOR_GRASS_DRY;
} else if (height &gt; THRESHOLD_WETGRASS) {
flag = Tile.FLOOR_GRASS_DEEP;
} else if (height &gt; THRESHOLD_SHALLOWWATER) {
flag = Tile.WATER_SHALLOW;
} else {
flag = Tile.WATER_DEEP;
}
flagMap.put(p,flag)
}
}

``````
In the first part, I calculate the heightMap by passing the coordinates through Simplex Noise and Cell Noise. The Map then gets scaled to a range of 0 to 255 for further processing. In the second part (which looks very ugly but works) I assign Tile types to each coordinate depending on its height. The heightMap can be discarded after world generation, the only thing that is important during gameplay is the flagMap, as height will not play a role. Of course there is more to it, and I clean up scattered tiles afterwards and other things need to be created after that. Forests already work well enough and next are rivers. I will however see if I can store the map differently as 20000*20000 entries will need their time to browse through. Here are some pics for you:  