Crate dungen_minion[−][src]
Expand description
A dungeon generation library focused on 2D roguelikes.
dungen_minion
is in the very early release stage, with most features being new or unstable.
It is not (yet!) recommend for general use, although you can test it if you’re feeling really
adventurous.
use dungen_minion::geometry::*;
use dungen_minion::*;
// Create a dungeon generator using SparseMap.
// SparseMap is expandable, and has no explicit size restrictions.
let map_id = DunGen::new(SparseMap::new())
// Expand the map to a width of 40, and a height of 30.
.gen_with(&EmptyRoomGenerator::new(Size::new(40, 30)))
// TileType::Floor will be placed.
// You may also give it a SizeRange to generate a randomly-sized map.
// .gen_with(EmptyRoomGenerator::new(SizeRange::new(Size::new(24, 18), Size::new(40, 30))))
// Create walls for the map.
.gen_with(&WalledRoomGenerator::new(Size::zero()))
.build();
let maps = MAPS.read();
let map = maps[map_id].read();
// A simple drawing routine.
for y in 0..map.size().height() {
for x in 0..map.size().width() {
let tile_type = map.tile_type_at_local(Position::new(x as i32, y as i32));
// The selection of tiles is deliberately limited, for now.
// Theming is included in future plans for dungen_minion.
let ch = match tile_type {
Some(TileType::Void) => ' ',
Some(TileType::Floor) => '.',
Some(TileType::Wall) => '#',
Some(TileType::Portal) => '+',
None => ' ',
};
print!("{}", ch);
}
println!();
}
Modules
Provides geometry for the dungen_minion
system of crates.
Structs
A new dungeon generator for generating dungeons based on a starting Map
.
A generator for adding one or more instances of Portal
to the edges of a map.
A generator for creating an area of TileType
::Floor.
A generator for filling an area with a TileType
.
Used to conditionally execute a dungeon generator.
Global Vec storage for Map
implementations.
Merges the maps connected to this map through Portal
s as sub-maps of this map.
Contains information about a Map
that can be reached from this Portal
.
An iterator over immutable references to Portal
.
An iterator over mutable references to Portal
.
A generator for iterating through the Portal
s on a Map
, and creating one or more linking Portal
s on the target map, if they do not exist.
Used to sequentially execute a series of dungeon generators..
Contains information about a Map
contanined within, and sub-ordinate to, another Map
.
A generator for adding one or more instances of SubMap
to a map.
Contains information about generating a sub-map for SubMapGenerator
.
An iterator over immutable references to SubMap
.
An iterator over mutable references to SubMap
.
The standard TileTypeCmp
implementation sorts TileType
and Option<TileType>
in the
following order:
Used to execute a dungeon generator by traversing portals.
Used to execute a dungeon generator sequentially on both the current map, and through its portals.
A generator for walling in a map.
Enums
A generic set of non-specific tiles suitable as a base for further customization.
Traits
A trait for types that enact some aspect of dungeon generation on a Map
.
The defining trait for a map..
The defining trait of a type that has a collection of Portal
s.
The defining trait of a type that has a collection of SubMap
s.
A trait for types that support dungeon generation on a Map
.
Implements a priority-based comparison for TileType
.
Functions
Call this to get an ID for a new Map
.
Invalidates the specified map, allowing its MapId
to be re-used.
Call this to register a Map
.
Type Definitions
A definition for MapId
, so that the implementation can be more easily changed if needed or desired.