#text #adventure #game #crawler #dungeon

kingslayer

A text adventure dungeon crawler game written in Rust

2 unstable releases

✓ Uses Rust 2018 edition

0.2.0 Mar 11, 2019
0.1.0 Mar 10, 2019

#5 in #adventure

Download history 3/week @ 2019-03-04

5 downloads per month

MIT license

38KB
947 lines

Kingslayer

Build Status

A text adventure dungeon crawler game written in Rust.

Creating and Running a World

Worlds are defined with JSON. An example can be found on the wiki. Deploying the world file in Rust looks like this:

use kingslayer::Cli;

fn main() {
    let cli = Cli::from_json_file("data/world.json");

    cli.start();
}

or the loop can be managed manually like this:

use kingslayer::Cli;

fn main() {
    let cli = Cli::from_json_file("data/world.json");

    println!("{}", cli.ask("l"));
    loop {
        match cli.ask(&cli.prompt()) {
            s => {
                println!("{}", s);
                if s.contains("You died.") {
                    break;
                }
            }
        }
    }
}

Dependencies

~2.5MB
~46K SLoC