Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics

Worlds: History Simulator

A world generator, and human history simulator · By DrTardigrade

Heightmap Guide Sticky

A topic by DrTardigrade created May 24, 2019 Views: 340
Viewing posts 1 to 1

To generate a world using a heightmap image first you need to copy the image to Worlds\Heigthmap. The image can be any of the following formats (extensions): PSD, TIFF, JPG, TGA, PNG, BMP, and PICT.

The image must be at least 400x200 pixels in size. Any image larger in size will be scaled to have an aspect ratio of 2:1, with a respective resolution of 400x200.

The image doesn't require to be a grayscale image. Internally, the game will convert the source image to grayscale by extracting the grayscale value of each pixel (using Unity's Color.grayscale). Lighter colors will turn into lighter shades of gray and viceversa. When scaling down an image larger than 400x200, the colors of neighboring pixels will be averaged.

Once the image is converted to grayscale, the game will interpret the shades of gray as values between 0 and 1, where 0 is black and 1 is white. These values will then be mapped to height values between -15000 meters and 15000 meters. For example, a grayscale value of 0.2 becomes -9000 meters. 0.6 becomes 3000 meters. 0.5 becomes 0 meters.

Note that the results from using a heightmap to generate a world might not perfect. Upon generating a map, the actual sea level and mountain scales might not be what you expected from the source image. In that case you can use the map editor to correct and adjust the generated world map to better match the source.