Crate mapgen[][src]

Expand description

Generators for dungeon type maps.

Generators can bu used directly or they can be combined with MapGenerators and MapModifiers

  • MapGenerators are use to create initial map.
  • MapModifiers modify existing map.

Example

use mapgen::{MapFilter, MapBuilder, Map, Tile};
use mapgen::filter::{
    NoiseGenerator,
    CellularAutomata,
    starting_point::{AreaStartingPosition, XStart, YStart}
};
use mapgen::geometry::Point;
 
let map = MapBuilder::new(80, 50)
            .with(NoiseGenerator::uniform())
            .with(CellularAutomata::new())
            .with(AreaStartingPosition::new(XStart::CENTER, YStart::CENTER))
            .build();
 
assert_eq!(map.width, 80);
assert_eq!(map.height, 50);
assert_eq!(map.starting_point.is_some(), true);

Re-exports

pub use map::Map;
pub use map::Symmetry;
pub use map::Tile;
pub use filter::*;

Modules

Generators for dungeon type maps.

Support function for 2D geometry

Map structure contains information about tiles and other elements on the map.

Different metrics for the map Can be used to meausre the quality of the map or the quality of the generator. To meause the quality of the generator; generate lots of maps, measure them and the provide generator score as an average.

Structs

Used to chain MapBuilder and MapModifiers to create the final map.

Traits

Trait which should be implemented by map modifier. Modifier takes initiall map and apply changes to it.