#scenario #yaml #builder #dungeon #level #dcss #webtile

dcss-scenario-builder

A scenario builder for DCSS Webtile

2 releases

new 0.2.2 Mar 10, 2025
0.2.1 Mar 10, 2025

#3 in #dungeon

MPL-2.0 and GPL-3.0 licenses

120KB
2K SLoC

Rust 1K SLoC // 0.1% comments Python 1K SLoC // 0.1% comments Just 60 SLoC

dcss-scenario-builder

dcss-scenario-builder creates scenarios in Dungeon Crawl Stone Soup's (DCSS) Webtile using dcss-api in wizmode from a yaml file. It can create any floor layout, from any feature, and add any item or monster.

Example

This example will create a two floor dungeon (D:1 and D:2), with a scroll and sword on the first floor (second room, past the door) and with a Kobold on the second floor.

options:
  default_feature: "floor"

levels:
  - level:
      name: D:1
      features:
        - '< = exit_dungeon'
        - '> = stone_stairs_down_i'
        - '# = rock_wall'
        - '. = floor'
        - '+ = closed_door'
      items:
        - 'x = Scroll of identify'
      map: |-
          #########
          #...#...#
          #.<.#.x.#
          #...#...#
          #.@.+...#
          #...#...#
          #...#.>.#
          #...#...#
          #########

  - level:
      name: D:2
      features:
        - '< = stone_stairs_up_i'
        - '# = rock_wall'
        - '. = floor'
      monsters:
        - 'k = Kobold'
      map: |-
          #########
          #.......#
          #.<.....#
          #.......#
          #.......#
          #.......#
          #.....k.#
          #.......#
          #########

start_game_with_scenario, in combination with the Webtile from dcss-api is used to build the scenario in Rust.

// Connect to DCSS Webtile
let mut webtile = Webtile::connect("ws://localhost:8080/socket", 0, "0.30")?;

// Empty message queue;
while webtile.get_message().is_some() {}

// Log in (to a user called "Username", with a password "Password")
let _gameid = webtile.login_with_credentials("Username", "Password")?;

// Start game
start_game_with_scenario(
    &mut webtile,
    "dcss-0.32",
    "b",
    "i",
    "c",
    "./scenarios/docs/readme.yaml",
)?;

webtile.disconnect().expect("Failed");

Ok(())

Dependencies

~5–16MB
~238K SLoC