#text #adventure #game #crawler #dungeon

bin+lib kingslayer

A text adventure dungeon crawler game written in Rust

9 unstable releases (3 breaking)

✓ Uses Rust 2018 edition

0.5.2 Mar 16, 2020
0.5.1 Jan 31, 2020
0.4.3 Oct 29, 2019
0.4.2 Sep 30, 2019
0.1.0 Mar 10, 2019

#6 in Games

Download history 15/week @ 2019-11-29 74/week @ 2019-12-06 7/week @ 2019-12-27 2/week @ 2020-01-03 127/week @ 2020-01-10 1/week @ 2020-01-17 1/week @ 2020-01-24 31/week @ 2020-01-31 13/week @ 2020-02-07 8/week @ 2020-02-14 27/week @ 2020-02-21 20/week @ 2020-02-28 18/week @ 2020-03-06 30/week @ 2020-03-13

88 downloads per month

MIT license

125KB
3.5K SLoC

Rust 3K SLoC // 0.0% comments Rusty Object Notation 355 SLoC

👑 Kingslayer ⚔️

Rust Crates.io Kingslayer documentation license/MIT

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

Playing the game

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

You can also install Kingslayer:

cargo install kingslayer
kingslayer

or clone the project and run:

cargo run --release

Creating and Running your own World

Worlds can be created with RON and Rust helper functions. Running the world on the command line looks like this:

use kingslayer::Cli;

fn main() {
    let cli = Cli::from_file("worlds/world.ron");

    cli.start();
}

or the loop can be managed manually like this:

use kingslayer::Cli;

fn main() {
    let cli = Cli::from_file("worlds/world.ron");

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

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

Dependencies

  • Rust ^1.41.0

Crates

  • rand = "0.7"
  • rayon = "1.0"
  • serde = "1.0"
  • ron = "0.5"

Dependencies

~3MB
~62K SLoC