VoxelMapGenerator

Generates a tileable BGE.VoxelMap: diamond-square heights, coloured by height band (biome) in 4 shades by slope. Each mip level is re-shaded from its own averaged heights.

Slow: a 256 map takes ~1.3 s on a Roku Ultra, long enough to risk the watchdog on slower devices, so games should load a baked map (tools/voxel-map.py, or saveToFile() a generated one) instead.

Palette: biome b in shade s (0-3, darkest first) is index b * 4 + s.

Properties

  • size (integer)
  • seed (integer) — Negative seeds are made positive
  • roughness (float)
  • seaLevel (integer)
  • biomes (Array.<VoxelBiome>) — Empty for the defaults
  • slopeShading (boolean)

Constructor

new VoxelMapGenerator( options?: BGE.VoxelMapGeneratorOptions, ): VoxelMapGenerator

Parameters


Instance Methods

generate(): dynamic

Returns

  • dynamic — a BGE.VoxelMap, or invalid if the size isn't valid