nmmo.core.terrain module#

class nmmo.core.terrain.MapGenerator(config)#

Bases: object

Procedural map generation

generate_all_maps()#

Generates NMAPS maps according to generate_map

Provides additional utilities for saving to .npy and rendering png previews

generate_map(idx)#

Generate a single map

The default method is a relatively complex multiscale perlin noise method. This is not just standard multioctave noise – we are seeding multioctave noise itself with perlin noise to create localized deviations in scale, plus additional biasing to decrease terrain frequency towards the center of the map

We found that this creates more visually interesting terrain and more deviation in required planning horizon across different parts of the map. This is by no means a gold-standard: you are free to override this method and create customized terrain generation more suitable for your application. Simply pass MAP_GENERATOR=YourMapGenClass as a config argument.

load_textures()#

Called during setup; loads and resizes tile pngs

class nmmo.core.terrain.Save#

Bases: object

Save utility for map files

static as_numpy(mats, path)#

Save map to .npy

static fractal(terrain, path)#

Render raw noise fractal to png

static render(mats, lookup, path)#

Render tiles to png

class nmmo.core.terrain.Terrain#

Bases: object

Terrain material class; populated at runtime

static generate_terrain(config, map_id, interpolaters)#
nmmo.core.terrain.cluster(config, tiles, mat, mmin, mmax)#
nmmo.core.terrain.place_fish(tiles)#
nmmo.core.terrain.sharp(noise)#

Exponential noise sharpener for perlin ridges

nmmo.core.terrain.spawn_profession_resources(config, tiles)#
nmmo.core.terrain.uniform(config, tiles, mat, mmin, mmax)#