rpg-cli is a minimalist computer RPG written in Rust. Its command-line interface can be used as a cd
replacement where you randomly encounter enemies as you change directories.
Features:
- Character stats and leveling system.
- Automatic turn-based combat.
- Item and equipment support.
- Warrior, thief and mage player classes.
- 15+ Enemy classes.
- Extensible player and enemy classes via configuration.
- Permadeath with item recovering.
- Quests to-do list.
- Chests hidden in directories.
Just download the binary for your platform (linux/macOS/windows) from the GitHub releases page.
Assuming you have Rust and Cargo installed:
$ cargo install --git https://github.com/facundoolano/rpg-cli --force --tag 1.2.0
The binary should be available as rpg-cli
(assuming you have ~/.cargo/bin
in your $PATH
).
Show details
You can use homebrew to install the binary on macOS::
If you use Nix/NixOS you can get rpg-cli from nixpkgs, either install it by adding it to your system config, with nix-env -i rpg-cli
/nix profile install nixpkgs#rpg-cli
or try it in a ephemeral shell with nix-shell -p rpg-cli
/nix shell nixpkgs#rpg-cli
.
If you use Gentoo, you can get rpg-cli from portage:
# emerge -av games-rpg/rpg-cli
rpg-cli can be installed from the extra repository for Arch Linux:
The game is designed to integrate with common file system operations, such as changing directories or deleting files.
The most basic type of integration consists in wrapping rpg-cli in a shell function, such that the working directory is updated to match the hero’s progress, effectively working as a cd
alternative:
rpg () { rpg-cli "$@" cd "$(rpg-cli pwd)" }
If you want to go all the way and really use it in place of cd
:
cd () { rpg-cli cd "$@" builtin cd "$(rpg-cli pwd)" }
Other commands like rm
, mkdir
, touch
, etc. can also be aliased. Check this example and the shell integration guide for more sophisticated examples, as well as their fish shell equivalents.
This example session assumes a basic rpg
function as described in the previous section.
The first time you run the program, a new hero is created at the user’s home directory.
~ $ rpg
warrior[1]@home
hp:[xxxxxxxxxx] 48/48
mp:[----------] 0/0
xp:[----------] 0/30
att:10 mag:0 def:0 spd:10
equip:{}
item:{}
0g
When running without parameters, as above, the hero status is printed (health points, accumulated experience, etc.).
The stats are randomized: if you run rpg reset
you will get a slightly different character every time:
~ $ rpg reset; rpg
warrior[1]@home
hp:[xxxxxxxxxx] 50/50
mp:[----------] 0/0
xp:[----------] 0/30
att:13 mag:0 def:0 spd:12
equip:{}
item:{}
0g
You can also pick a different class (default options are warrior
, thief
and mage
, but more can be added).
For example, the mage
class enables magic attacks:
~ $ rpg class mage; rpg
mage[1]@home
hp:[xxxxxxxxxx] 32/32
mp:[xxxxxxxxxx] 12/12
xp:[----------] 0/30
att:3 mag:27 def:0 spd:9
equip:{}
item:{}
0g
If you use the cd
subcommand with a path as parameter, it will instruct the hero to move:
~ $ rpg cd dev/
~/dev $ rpg
warrior[1]@~/dev
hp:[xxxxxxxxxx] 47/47
mp:[----------] 0/0
xp:[----------] 0/30
att:10 mag:0 def:0 spd:12
equip:{}
item:{}
0g
In this case, the warrior moved to ~/dev
. Sometimes enemies will appear as you move through the directories,
and both characters will engage in battle:
~/dev $ rpg cd facundoolano/
snake[3][xxxx][----]@~/dev/facundoolano
snake[3][xxx-] -10hp
warrior[1][xxxx] -8hp
snake[3][xxx-] -9hp
warrior[1][xxx-] -10hp
snake[3][x---] -12hp
warrior[1][xx--] -9hp
snake[3][----] -14hp
warrior[3][xxx-] +117xp ++level +275g
warrior[3][xxx-][----][x---]@~/dev/facundoolano
Each character attacks in turn (the frequency being determined by their spd
stat).
Whenever you win a