roguelike-game/README.md

78 lines
2.6 KiB
Markdown
Raw Normal View History

2022-02-03 12:00:37 -05:00
# Rust Roguelike
A rogue-like game, implemented in Rust, with the `specs` ECS library, and `rltk` roguelike toolkit.
## Rust Setup
2022-02-04 11:07:54 -05:00
Follow the instructions on the [Getting Started](https://www.rust-lang.org/learn/get-started) page of the Rust language
website.You should then have `rustup` and `cargo` available in your terminal. If you want to run on a Raspberry Pi, or
via WebAssembly, you will also need `make`.
2022-02-03 12:00:37 -05:00
## Running the game
2022-02-04 11:07:54 -05:00
* For most setups, `cargo run` or `make run`.
* For the Raspberry Pi: `make run-pi`
### Controls
#### Movement
Any movement commands with numbers can use the top row or numpad.
2022-02-04 11:10:53 -05:00
| Direction | Keys |
|:---------:|--------------------|
| ↑ | ↑, 8, k |
| ↓ | ↓, 2, j |
| ← | ←, 4, h |
| → | →, 6, l |
| ↖ | 7, u, q, Home |
| ↗ | 9, y, w, Page Up |
| ↙ | 1, b, a, End |
| ↘ | 3, n, s, Page Down |
2022-02-04 11:07:54 -05:00
#### Item management
| Key | Action |
2022-02-04 11:10:53 -05:00
|:---:|------------------|
| g | Grab an item |
| i | Inventory menu |
| d | Item drop menu |
| r | Remove item menu |
2022-02-04 11:07:54 -05:00
#### Ranged weapons (Not magic or scrolls)
| Key | Action |
2022-02-04 11:10:53 -05:00
|:---:|-------------------------|
| v | Cycle potential targets |
| f | Fire at selected target |
2022-02-04 11:07:54 -05:00
#### Other actions
2022-02-04 11:10:53 -05:00
| Key(s) | Action |
|:--------:|---------------|
2022-02-04 11:07:54 -05:00
| 5, Space | Skip a turn |
2022-02-04 11:10:53 -05:00
| Escape | Save and quit |
2022-02-04 11:07:54 -05:00
#### Mouse controls
By hovering over tiles, the name of item(s) on that tile will appear. For ranged scroll attacks, the left mouse button
is used to select a target.
2022-02-03 12:00:37 -05:00
## WebAssembly Build
2022-02-04 11:07:54 -05:00
2022-02-03 12:00:37 -05:00
* Install the WebAssembly target via rustup: `rustup target add wasm32-unknown-unknown`
* Install `wasm-bindgen`: `cargo install wasm-bindgen-cli`
* Run `make build-wasm`
* Serve the `wasm` folder with a web server (wasm will not work straight from the html file)
## Makefile
2022-02-04 11:07:54 -05:00
2022-02-10 11:18:21 -05:00
If you want to see what else you can run with Makefile, run `make help`. This will list commands and what they do.
## Changes from tutorial
* Added a macro to register components for `specs`, like was in the tutorial for saving/loading.
* Game state machine is moved to `src/state.rs`
* Colors (Bracket-lib `RGB` struct) have been converted to static values in `src/colors.rs`, to cut down on boilerplate and numbers of ways of generating color values.
2022-02-10 11:54:57 -05:00
* All references to `rltk` have been converted to `bracket_lib`, as `rltk` was a facade in `bracket_lib`
* Made the crate a library and binary, with the binary just starting and running the game engine
* Submodules use named files as the module base, rather than `mod.rs`