Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/Zaechus/kingslayer
A text-based adventure written in Rust
https://github.com/Zaechus/kingslayer
adventure-game cargo dungeon game interactive-fiction ron rust wasm webassembly
Last synced: about 1 month ago
JSON representation
A text-based adventure written in Rust
- Host: GitHub
- URL: https://github.com/Zaechus/kingslayer
- Owner: Zaechus
- License: mit
- Created: 2018-08-30T21:56:08.000Z (over 6 years ago)
- Default Branch: main
- Last Pushed: 2024-11-15T00:42:03.000Z (about 2 months ago)
- Last Synced: 2024-11-15T01:27:18.809Z (about 2 months ago)
- Topics: adventure-game, cargo, dungeon, game, interactive-fiction, ron, rust, wasm, webassembly
- Language: Rust
- Homepage: https://zaechus.github.io/kingslayer-web
- Size: 937 KB
- Stars: 39
- Watchers: 3
- Forks: 11
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 👑 Kingslayer ⚔️
[![CI](https://github.com/Zaechus/kingslayer/actions/workflows/ci.yml/badge.svg)](https://github.com/Zaechus/kingslayer/actions/workflows/ci.yml)
[![Crates.io](https://img.shields.io/crates/v/kingslayer)](https://crates.io/crates/kingslayer)
[![Kingslayer documentation](https://docs.rs/kingslayer/badge.svg)](https://docs.rs/kingslayer)Kingslayer is a text-based dungeon crawler written in Rust. It is a continuation of [thekinggame](https://github.com/Zaechus/thekinggame).
### Playing the game
You can play an online WASM version here: [zaechus.github.io/kingslayer-web](https://zaechus.github.io/kingslayer-web/)
You can also install Kingslayer:
```sh
cargo install kingslayer
kingslayer
```
or clone the project and run it:
```sh
cargo run --release
```### Creating and running your own world
Worlds can be created with RON and Rust helper functions. Running a specific world on the command line looks like this:
```sh
kingslayer [FILE]
```
or with your own Rust code:
```rust
use kingslayer::Cli;fn main() {
let cli = Cli::from_file("worlds/world.ron");cli.start();
}
```
The game loop can also be managed manually like this:
```rust
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("Farewell.") {
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/Cargo ^1.59.0