This commit is contained in:
Nolan Darilek 2022-03-18 11:56:34 -05:00
parent 20a14de05d
commit 1c29eb71cd
18 changed files with 53 additions and 57 deletions

View File

@ -1,13 +1,12 @@
[package]
name = "mapgen"
version = "0.5.2"
authors = ["Krzysztof Langner <klangner@gmail.com>"]
description = "Map generator for games (dungeons, worlds etc.)"
name = "here_be_dragons"
version = "0.1.0"
authors = ["Nolan Darilek <nolan@thewordnerd.info>", "Krzysztof Langner <klangner@gmail.com>"]
description = "Map generator for games"
keywords = ["game", "map", "map-generator"]
license = "MIT OR Apache-2.0"
repository = "https://github.com/klangner/mapgen.rs"
homepage = "https://github.com/klangner/mapgen.rs"
documentation = "https://docs.rs/mapgen"
repository = "https://labs.lightsout.games/projects/here_be_dragons"
documentation = "https://docs.rs/here_be_dragons"
edition = "2021"
[dependencies]

View File

@ -1,15 +1,17 @@
# Game Map Generator
# Here Be Dragons
[![Build Status](https://travis-ci.org/klangner/mapgen.rs.svg?branch=master)](https://travis-ci.org/klangner/mapgen.rs)
[![Crates.io](https://img.shields.io/crates/v/mapgen.svg)](https://crates.io/crates/mapgen)
[![mapgen.rs](https://docs.rs/mapgen/badge.svg)](https://docs.rs/mapgen/)
[![Crates.io](https://img.shields.io/crates/v/here_be_dragons.svg)](https://crates.io/crates/here_be_dragons)
[![here_be_dragons](https://docs.rs/here_be_dragons/badge.svg)](https://docs.rs/here_be_dragons/)
Generate procedural maps for games. [Try it in the browser](https://klangner.github.io/mapgen.rs/) using WebAssembly.
Generate procedural maps for games.
## Acknowledgments
This crate is based on [mapgen.rs](https://github.com/klangner/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 generator.
This library consists of different map filters which can be combined to create custom map generators.
### Implemented filters
@ -29,20 +31,19 @@ This library consists of different map filters which can be combined to create c
* [x] Voronoi hive
* [ ] Wave Function Collapse
## Usage
Add dependency to your project
Add the dependency to your project
```
mapgen = "0.4"
here_be_dragons = "0.1"
```
Using single map generator:
```rust
use rand::prelude::*;
use mapgen::{Map, MapFilter};
use mapgen::filter::CellularAutomata;
use here_be_dragons::{Map, MapFilter};
use here_be_dragons::filter::CellularAutomata;
let mut rng = StdRng::seed_from_u64(100);
let gen = CellularAutomata::new();
@ -52,7 +53,7 @@ let map = gen.modify_map(&mut rng, &Map::new(80, 50));
Use MapBuilder for chaining map generator and modifiers
```rust
use mapgen::{
use here_be_dragons::{
MapBuilder,
filter::{
NoiseGenerator,
@ -72,14 +73,11 @@ let map = MapBuilder::new(80, 50)
.build();
```
For more information check the [doc](https://docs.rs/mapgen)
For more information check the [docs](https://docs.rs/here_be_dragons).
This library is based on the code from the [Roguelike tutorial](https://github.com/thebracket/rustrogueliketutorial). I highly recommend it for learning how to write a Roguelike in Rust.
This library is based on the code from the [Roguelike tutorial](https://github.com/thebracket/rustrogueliketutorial).
I highly recommend it for learning how to write Roguelike in Rust.
# License
## License
Licensed under either of
@ -88,7 +86,6 @@ Licensed under either of
at your option.
**Contributions**
Unless you explicitly state otherwise, any contribution intentionally submitted

View File

@ -1,4 +1,4 @@
use mapgen::*;
use here_be_dragons::*;
use rand::prelude::*;
fn main() {

View File

@ -1,4 +1,4 @@
use mapgen::*;
use here_be_dragons::*;
use rand::prelude::*;
use std::time::{SystemTime, UNIX_EPOCH};

View File

@ -1,4 +1,4 @@
use mapgen::{
use here_be_dragons::{
filter::{
AreaStartingPosition, CellularAutomata, CullUnreachable, NoiseGenerator, XStart, YStart,
},
@ -16,8 +16,8 @@ impl MapFilter<MyData> for IncrementData {
fn modify_map(
&self,
_rng: &mut rand::prelude::StdRng,
map: &mapgen::Map<MyData>,
) -> mapgen::Map<MyData> {
map: &here_be_dragons::Map<MyData>,
) -> here_be_dragons::Map<MyData> {
let mut map = map.clone();
map.data.value += 1;
map

View File

@ -1,4 +1,4 @@
use mapgen::{
use here_be_dragons::{
filter::{
AreaStartingPosition, CellularAutomata, CullUnreachable, NoiseGenerator, XStart, YStart,
},

View File

@ -9,7 +9,7 @@
//! ---
//! use rand::prelude::*;
//! use crate::common::geometry::Point;
//! use mapgen::dungeon::{
//! use here_be_dragons::dungeon::{
//! MapModifier,
//! map::{Map, TileType},
//! starting_point::{AreaStartingPosition, XStart, YStart}

View File

@ -6,8 +6,8 @@
//! Example generator usage:
//! ```
//! use rand::prelude::*;
//! use mapgen::{Map, MapFilter, NoData};
//! use mapgen::filter::{
//! use here_be_dragons::{Map, MapFilter, NoData};
//! use here_be_dragons::filter::{
//! BspInterior
//! };
//!

View File

@ -6,8 +6,8 @@
//! Example generator usage:
//! ```
//! use rand::prelude::*;
//! use mapgen::{Map, MapFilter, NoData};
//! use mapgen::filter::BspRooms;
//! use here_be_dragons::{Map, MapFilter, NoData};
//! use here_be_dragons::filter::BspRooms;
//!
//! let mut rng = StdRng::seed_from_u64(100);
//! let gen = BspRooms::<NoData>::new();

View File

@ -9,8 +9,8 @@
//! Example usage:
//! ```
//! use rand::prelude::*;
//! use mapgen::{Map, MapFilter, NoData};
//! use mapgen::filter::CellularAutomata;
//! use here_be_dragons::{Map, MapFilter, NoData};
//! use here_be_dragons::filter::CellularAutomata;
//!
//! let mut rng = StdRng::seed_from_u64(100);
//! let gen = CellularAutomata::<NoData>::new();

View File

@ -1,8 +1,8 @@
//! Example generator usage:
//! ```
//! use rand::prelude::*;
//! use mapgen::{Map, MapFilter, NoData};
//! use mapgen::filter::DrunkardsWalk;
//! use here_be_dragons::{Map, MapFilter, NoData};
//! use here_be_dragons::filter::DrunkardsWalk;
//!
//! let mut rng = StdRng::seed_from_u64(100);
//! let gen = DrunkardsWalk::<NoData>::open_area();

View File

@ -1,8 +1,8 @@
//! Example generator usage:
//! ```
//! use rand::prelude::*;
//! use mapgen::{Map, MapFilter, NoData};
//! use mapgen::filter::MazeBuilder;
//! use here_be_dragons::{Map, MapFilter, NoData};
//! use here_be_dragons::filter::MazeBuilder;
//!
//! let mut rng = StdRng::seed_from_u64(100);
//! let gen = MazeBuilder::<NoData>::new();

View File

@ -4,8 +4,8 @@
//! Example usage:
//! ```
//! use rand::prelude::*;
//! use mapgen::{Map, MapFilter, NoData};
//! use mapgen::filter::NoiseGenerator;
//! use here_be_dragons::{Map, MapFilter, NoData};
//! use here_be_dragons::filter::NoiseGenerator;
//!
//! let mut rng = StdRng::seed_from_u64(100);
//! let gen = NoiseGenerator::<NoData>::uniform();

View File

@ -6,8 +6,8 @@
//! Example generator usage:
//! ```
//! use rand::prelude::*;
//! use mapgen::{MapFilter, Map, NoData};
//! use mapgen::filter::SimpleRooms;
//! use here_be_dragons::{MapFilter, Map, NoData};
//! use here_be_dragons::filter::SimpleRooms;
//!
//! let mut rng = StdRng::seed_from_u64(100);
//! let gen = SimpleRooms::<NoData>::new();

View File

@ -6,9 +6,9 @@
//! Example modifier usage:
//! ```
//! use rand::prelude::*;
//! use mapgen::{MapFilter, Map, NoData, Tile};
//! use mapgen::filter::starting_point::{AreaStartingPosition, XStart, YStart};
//! use mapgen::geometry::Point;
//! use here_be_dragons::{MapFilter, Map, NoData, Tile};
//! use here_be_dragons::filter::starting_point::{AreaStartingPosition, XStart, YStart};
//! use here_be_dragons::geometry::Point;
//!
//! let mut rng = StdRng::seed_from_u64(100);
//! let mut map = Map::<NoData>::new(80, 50);

View File

@ -1,8 +1,8 @@
//! Example generator usage:
//! ```
//! use rand::prelude::*;
//! use mapgen::{Map, MapFilter, NoData};
//! use mapgen::filter::VoronoiHive;
//! use here_be_dragons::{Map, MapFilter, NoData};
//! use here_be_dragons::filter::VoronoiHive;
//!
//! let mut rng = StdRng::seed_from_u64(100);
//! let gen = VoronoiHive::<NoData>::new();

View File

@ -84,7 +84,7 @@ impl Rect {
/// Calculate abs value between 2 usize values
/// Example:
/// ```
/// use mapgen::geometry::usize_abs;
/// use here_be_dragons::geometry::usize_abs;
///
/// assert_eq!(usize_abs(5, 3), 2);
/// assert_eq!(usize_abs(3, 5), 2);

View File

@ -8,13 +8,13 @@
//!
//! Example
//! ```
//! use mapgen::{MapFilter, MapBuilder, Map, NoData, Tile};
//! use mapgen::filter::{
//! use here_be_dragons::{MapFilter, MapBuilder, Map, NoData, Tile};
//! use here_be_dragons::filter::{
//! NoiseGenerator,
//! CellularAutomata,
//! starting_point::{AreaStartingPosition, XStart, YStart}
//! };
//! use mapgen::geometry::Point;
//! use here_be_dragons::geometry::Point;
//!
//! let map = MapBuilder::<NoData>::new(80, 50)
//! .with(NoiseGenerator::uniform())