Map generation for games
Go to file
Nolan Darilek 4926caa1ce
Some checks failed
continuous-integration/drone/push Build is failing
Install rustfmt.
2022-03-18 12:42:59 -05:00
demo Add ability to associate arbitrary BuilderData with maps. 2022-03-12 09:45:42 -06:00
docs Improved map selection in demo app 2021-01-15 14:26:19 +01:00
examples Rename. 2022-03-18 11:56:34 -05:00
src Rename. 2022-03-18 11:56:34 -05:00
.drone.yml Install rustfmt. 2022-03-18 12:42:59 -05:00
.DS_Store removed 2021-12-06 10:33:01 +01:00
.gitignore First working version 2020-09-12 15:49:33 +02:00
Cargo.toml Rename. 2022-03-18 11:56:34 -05: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 Rename. 2022-03-18 11:56:34 -05:00

Here Be Dragons

Crates.io here_be_dragons

Generate procedural maps for games.

Acknowledgments

This crate is based on mapgen.rs. Thanks to Krzysztof Langner for doing the hard work of implementing the many map generation algorithms this crate includes.

Map filters

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

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 the dependency to your project

here_be_dragons = "0.1"

Using single map generator:

use rand::prelude::*;
use here_be_dragons::{Map, MapFilter};
use here_be_dragons::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 here_be_dragons::{
    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 docs.

This library is based on the code from the Roguelike tutorial. I highly recommend it for learning how to write a 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.