Prefabricating Map Sections
Random dungeons are great, but sometimes you want to represent something specific. You might have a great idea for part—or even all—of a map. This has been used to great effect in many games. Games as varied as Diablo and Dungeon Crawl Stone Soup procedurally generate a large portion of their content—and intersperse pre-made sections called vaults.
Handmade Dungeons
Create a new file named map_builder/prefab.rs. Add the usual use crate::prelude::* and define your first prefabricated map section:
| use crate::prelude::*; |
| |
| const FORTRESS : (&str, i32, i32) = (" |
| ------------ |
| ---######--- |
| ---#----#--- |
| ---#-M--#--- |
| -###----###- |
| --M------M-- ... |
Get Hands-on Rust now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.