Map generation for games
Go to file
Krzysztof Langner 363b90cde9
Merge pull request #37 from ndarilek/master
Add getter for index.
2021-07-15 10:01:58 +02:00
demo changed TileType to struct 2021-06-28 17:06:47 +02:00
docs Improved map selection in demo app 2021-01-15 14:26:19 +01:00
examples smaller example1 2020-10-19 21:35:24 +02:00
src Add getter for index. 2021-07-13 12:17:51 -05:00
.gitignore First working version 2020-09-12 15:49:33 +02:00
.travis.yml Added Travis CI 2020-08-31 11:48:44 +02:00
Cargo.toml Version 0.5 2021-06-28 17:08:09 +02:00
LICENSE-APACHE init 2020-08-31 11:45:59 +02:00
LICENSE-MIT init 2020-08-31 11:45:59 +02:00
README.md implemented Voronoi Hive. Fixed: 30 2020-11-19 20:53:34 +01:00

Game Map Generator

Build Status Crates.io mapgen.rs

Generate procedural maps for games. Try it in the browser using WebAssembly.

Map filters

This library consists of different map filters which can be combined to create custom map generator.

Implemented filters

  • Area exit point
  • Area starting point
  • BSP Interior
  • BSP Rooms
  • Cellular automata
  • Cull unreachable areas
  • Diffusion-Limited Aggregation (DLA)
  • Drunkard's walk
  • Maze
  • Noise generator
  • Prefabs
  • Room corridors nearest
  • Simple rooms
  • Voronoi hive
  • Wave Function Collapse

Usage

Add dependency to your project

mapgen = "0.4"

Using single map generator:

use rand::prelude::*;
use mapgen::{Map, MapFilter};
use mapgen::filter::CellularAutomata;

let mut rng = StdRng::seed_from_u64(100);
let gen = CellularAutomata::new();
let map = gen.modify_map(&mut rng, &Map::new(80, 50));

Use MapBuilder for chaining map generator and modifiers

use mapgen::{
    MapBuilder,
    filter::{
        NoiseGenerator, 
        CellularAutomata,
        AreaStartingPosition,
        XStart, 
        YStart,
    },
};

let map = MapBuilder::new(80, 50)
        .with(NoiseGenerator::uniform())
        .with(CellularAutomata::new())
        .with(AreaStartingPosition::new(XStart::CENTER, YStart::CENTER))
        .with(CullUnreachable::new())
        .with(DistantExit::new())
        .build();

For more information check the doc

This library is based on the code from the Roguelike tutorial. I highly recommend it for learning how to write Roguelike in Rust.

License

Licensed under either of

at your option.

Contributions

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.