Map generation for games
Go to file
2020-09-15 08:45:40 +02:00
demo Random Rooms renamed to Simple Rooms 2020-09-15 08:45:40 +02:00
docs Implemented simple rooms. Fixed #14 2020-09-14 22:54:39 +02:00
src Random Rooms renamed to Simple Rooms 2020-09-15 08:45:40 +02: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 new creates Box. Ver 0.2 2020-09-15 07:37:20 +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 Random Rooms renamed to Simple Rooms 2020-09-15 08:45:40 +02:00

Game Map Generator

Build Status Crates.io mapgen.rs

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

Features

Dungeons

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

Usage

Add dependency to your project

mapgen = "0.1"

Using single map generator:

use rand::prelude::*;
use mapgen::dungeon::{
    MapGenerator,
    cellular_automata::CellularAutomataGen
};

let mut rng = StdRng::seed_from_u64(100);
let gen = CellularAutomataGen::new(80, 50);
let map = gen.generate_map(&mut rng)

Use MapBuilder for chaining map generator and modifiers

use mapgen::dungeon::{
    MapBuilder,
    map::{Map, Point, TileType},
    cellular_automata::CellularAutomataGen,
    starting_point::{AreaStartingPosition, XStart, YStart},
    cull_unreachable::CullUnreachable,
};

let map = MapBuilder::new(CellularAutomataGen::new(80, 50))
            .with(AreaStartingPosition::new(XStart::CENTER, YStart::CENTER))
            .with(CullUnreachable::new())
            .build_map();

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.