#text #adventure #game #crawler #dungeon

bin+lib kingslayer

A text adventure dungeon crawler game written in Rust

6 releases

✓ Uses Rust 2018 edition

0.4.2 Sep 30, 2019
0.4.1 Sep 26, 2019
0.4.0 Aug 27, 2019
0.2.1 Mar 25, 2019
0.1.0 Mar 10, 2019

#27 in Games

Download history 11/week @ 2019-06-17 29/week @ 2019-06-24 21/week @ 2019-07-01 9/week @ 2019-07-08 3/week @ 2019-07-22 3/week @ 2019-07-29 13/week @ 2019-08-05 6/week @ 2019-08-19 45/week @ 2019-08-26 21/week @ 2019-09-02 9/week @ 2019-09-09 15/week @ 2019-09-16 27/week @ 2019-09-23

57 downloads per month

MIT license

57KB
1.5K SLoC

Kingslayer

Build Status Build status Current Crates.io Version

Kingslayer is a text-based dungeon crawler written in Rust. It is a rewrite and continuation of thekinggame.

You can find the WASM package at github.com/Maxgy/kingslayer-wasm

Running the game

You can play the online WASM version here: maxgy.github.io/kingslayer-wasm

or clone the project and run:

$ cargo run --release

Creating and Running your own World

Worlds are defined with JSON. An example can be found on the wiki. Deploying the world to the command line 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 {
        let s = cli.ask(&Cli::prompt());
        println!("{}", s);
        if s.contains("You died.") {
            break;
        }
    }
}

This method allows you to manage other forms of input and output such as within a website. The JSON content for the world can also be passed as a raw string with Cli::from_json_str.

Dependencies

  • Rust ^1.38.0

Dependencies

~1.5–2.2MB
~45K SLoC