rpg-cli —your filesystem as a dungeon!

Overview

rpg-cli —your filesystem as a dungeon!

rpg-cli is a bare-bones JRPG-inspired terminal game written in Rust. It can work as an alternative to cd where you randomly encounter enemies as you change directories.

Features:

  • Automatic turn-based combat.
  • 15+ enemy classes.
  • Character stats and leveling system.
  • Basic item and equipment support.
  • Permadeath with item recovering.
  • Run and bribe to escape battles.

Setup

Installing from binary

Just download the binary for your platform (linux/macOS) from the GitHub releases page.

Installing from source

Assuming you have Rust and Cargo installed, clone the repo and run:

$ cargo build --release

The binary will be available at target/release/rpg-cli.

Use as a cd replacement (recommended)

Once the binary is installed with one of the methods described above, it can be wrapped on a shell function or alias so the working directory is updated to track to the hero's progress. You can set that up by adding something like this to your .bashrc (with the RPG_CLI variable pointing to the binary location):

RPG_CLI=/Users/facundo/dev/facundoolano/rpg-cli/target/release/rpg-cli
rpg () {
   $RPG_CLI "$@"
   cd $($RPG_CLI --pwd)
}

Usage

The first time you run the program, a new hero is created at the user's home directory.

~ $ rpg

    hero[1]@home
    hp:[xxxxxxxxxx] 25/25
    xp:[----------] 0/30
    att:10   def:0   spd:5
    equip:{}
    item:{}
    0g

When running without parameters, as above, the hero status is printed (health points, accumulated experience, etc.). If you pass in a path as parameter, that will instruct the hero to move:

~ $ rpg dev/
~/dev $ rpg

    hero[1]@~/dev
    hp:[xxxxxxxxxx] 25/25
    xp:[----------] 0/30
    att:10   def:0   spd:5
    equip:{}
    item:{}
    0g

In this case, the hero moved to ~/dev/facundoolano. Sometimes enemies will appear as you move through the directories, and both characters will engage in battle:

~/dev $ rpg facundoolano/

   snake[1][xxxx]@~/dev/facundoolano

   snake[1][x---] -12hp
    hero[1][xxxx]  dodged!
   snake[1][----] -12hp

    hero[1][xxxx][xxxx]@~/dev/facundoolano +24xp +75g

Each character attacks in turn (the frequency being determined by their speed stat). Whenever you win a fight, your hero gains experience points and eventually raises its level, along with their other stats.

When you return to the home directory, the hero's health points are restored:

~/dev/facundoolano/rpg-cli $ rpg ~
    hero[1][xxxx][xxxx]@home +20hp

Also at the home directory, you can buy items and equipment:

~ $ rpg --shop

    sword[1]    500g
    shield[1]   500g
    potion[1]   200g
    escape      1000g

    funds: 275g

~ $ rpg --shop potion
~ $ rpg

    hero[3]@home
    hp:[xxxxxxxxxx] 37/37
    xp:[xx--------] 19/155
    att:13   def:0   spd:7
    equip:{}
    item:{potion[1]x1}
    75g

The shorcut rpg -s p would also work above.

The further from home you move the hero, the tougher the enemies will get. If you go to far or too long without restoring your health your hero is likely to die in battle, causing the game to restart.

~ $ rpg ~/dev/facundoolano/rpg-cli/target/debug/examples/

     orc[1][xxxx]@~/dev/facundoolano/rpg-cli

    hero[1][x---] -20hp critical!
     orc[1][xxx-] -9hp
    hero[1][----] -16hp

    hero[1][----][----]@~/dev/facundoolano/rpg-cli 💀

Death is permanent: you can't save your progress and reload after dying, but if you take your new hero to the location of the previous one's death, you can recover gold, items and equipment:

~ $ rpg ~/dev/facundoolano/rpg-cli/

    🪦 @~/dev/facundoolano/rpg-cli/

    +potionx1
    +75g

Try rpg --help for more options.

Comments
  • cd force flag now calls visit to reset character when cd'ing to home

    cd force flag now calls visit to reset character when cd'ing to home

    This pull request resolves #123, by instead of hard coding the changing of the location in change_dir(), offloading this to the visit() method in game.rs.

    opened by zoomiti 8
  • Going to $HOME with --force flag doesn't reset character stats or apply ring/status effects

    Going to $HOME with --force flag doesn't reset character stats or apply ring/status effects

    These are the commands I type into the command line to try to go home to reset my characters HP but it never happens

    [zoomiti@MastermindRogue ~]$ rpg-cli pwd
    /home/zoomiti
    [zoomiti@MastermindRogue ~]$ rpg-cli stat
        mage[1]@home
        hp:[xxxxx-----] 14/28
        mp:[xxx-------] 3/12
        xp:[xxxxxx----] 17/30
        att:3   mag:33   def:0   spd:11
        equip:{}
        item:{}
        46g
    [zoomiti@MastermindRogue ~]$ rpg-cli cd ~
    [zoomiti@MastermindRogue ~]$
    

    For the record I am on 1.0.0

    [zoomiti@MastermindRogue ~]$ rpg-cli -V
    rpg-cli 1.0.0
    
    opened by zoomiti 7
  • Probably overkill example for fish shell

    Probably overkill example for fish shell

    I feel like this function added to ~/.config/fish/config.fish should be self-explanatory. Just throwing it out there in case it "helps" anyone:

    function rpg
        if string match -qr RPG (functions cd)
            echo 'Setting cd to normal mode'
            functions --erase cd
            functions --copy cd_orig cd
        else
            echo 'Setting cd to RPG mode'
            functions --erase cd_orig
            functions --copy cd cd_orig
            function cd --description 'Change directory, RPG-style'
                cd_orig $argv
                and rpg-cli $PWD
            end
        end
    end
    

    And then, of course, right after the function definition, you can silently enable rpg mode:

    rpg >/dev/null
    
    opened by cowboy 7
  • Rings Disappear

    Rings Disappear

    I'm trying to create reproduction steps, but I wanted to post in case I'm making assumptions that aren't true:

    1. When a hero dies, a tombstone should be created at their working directory containing all of their items
    2. When a hero searches in a directory with a tombstone, all items from that tombstone should be added to their inventory
    3. If a ring is not listed in rings_left (see jq query below), it should be in either the active hero's inventory (my_rings) or a tombstone (dead_rings).

    Context:

    I've written some scripts that take the active hero through randomly generated folders to optimize leveling up, finding loot, and dying to leave a trail of treasure.

    After running the script for a while, the rings_left list will only contain "Diamond", but there will only be 18 or fewer rings between dead_rings and my_rings.

    After running the scripts for several thousand more tombstones, the rings are never found again. If this sounds like something that ought not to happen, I can start adding some debugging to my scripts to watch for actions that result in a lost ring, but if there are cases where rings should disappear from the game it'll change what I'm debugging for :D

    alias rings_left="jq '.quests[][][2] | select(any(.type==\"FindAllRings\"; .)) | .to_find' ~/.rpg/data"
    alias dead_rings="jq '.tombstones[].items[] | select(any(.type==\"Ring\";.))' ~/.rpg/data"
    alias my_rings="jq '.inventory | keys[] | select(endswith(\"-rng\"))' ~/.rpg/data"
    
    opened by Flare576 6
  • A little note on the game-play balance

    A little note on the game-play balance

    • We gain just a little too much gold in late games (3150360g on this 1h game).
    • Are lvl-stone effects skipped for achievements? Is an +event raised when a stone is used?
    • We maybe should use a seed-based RNG based on the path to knowing if we must generate a new boss, it is easy to just go to the same 3/4 paths to fight something and gain XP without endangeringyourself.
    opened by Kerollmops 6
  • No output printed when not changing directories

    No output printed when not changing directories

    Version: 0.2.0, OS/X binary

    Hi! I saw this on Hacker News, it looks neat, and I wanted play around with it.

    Something I wanted to offer feedback on is that I had trouble understanding the flow at first, because the app doesn't print anything when you don't change directories. Example:

    $ rpg-cli rpg/
    
       slime[1][xxxx]@~/tmp/rpg 
    
       slime[1][xxxx] -8hp
       slime[1][xxxx] -8hp
    [snip]
       slime[1][----] -12hp
    
        hero[3][xxxx][x---]@~/tmp/rpg +111xp ++level +114g
    
    $ rpg-cli $HOME
    
        hero[3][xxxx][x---]@home +8hp
    
    $ rpg-cli $HOME
    $
    

    The second time I ran rpg-cli $HOME, my character obviously didn't change directories, and while with the benefit of hindsight, I can understand why output wasn't printed, it still confused me when I first started playing this, and I thought I may have been doing something incorrectly.

    Expected behavior from running rpg-cli $HOME a second time (or for any directory, tbh) would be to print the here's location and stats.

    Thanks for reading!

    -- Doug

    opened by dmuth 6
  • Panics with `.` as argument in Windows

    Panics with `.` as argument in Windows

    $ rpg-cli.exe .
    thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', src\location.rs:43:44
    note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
    
    help wanted 
    opened by mainrs 6
  • Change Windows target

    Change Windows target

    MSVC is the default recommended toolchain for Windows.

    | . | Before | After | | ---: | --------: | ---------: | | Binary size | 7.74MB | 1.82MB | | Build time | 3m49s | 2m21s |

    opened by rashil2000 5
  • Initiate a battle when running other file and dir commands

    Initiate a battle when running other file and dir commands

    this is awesome; i love this project

    i have long dreamed that something like this would exist!

    it would be really cool to have a feature where you can start a battle that, if you win, results in the file being deleted!

    opened by silky 5
  • feat: update deps, and fix clippy lints

    feat: update deps, and fix clippy lints

    • Update dependencies
    • Fix almost all clippy lints beside two of them
    • Bump rust edition from 2018 to 2021
    • Fixes issue #133 since this compiles with the newest clap edition
    • ...I like the project
    opened by Uzaaft 4
  • Condensed output if rpg-cli is shared with other commands (and separators)

    Condensed output if rpg-cli is shared with other commands (and separators)

    Hi there,

    Great idea you got here. I like it howver i want to propose 2 changes:

    1. Condense output for us who want to use this neat game while doing our stuff on the system. I am using, for example, cd function to list directory right after changing location. This could lead to clutter in te terminal like:
    $ cd /usr/share/
         rat[7][xxxx][----]@/usr/share 
       thief[2][xxx-] -17hp 
         rat[7][xxxx] dodged!
       thief[2][x---] -13hp 
         rat[7][xxxx] dodged!
       thief[2][----] -14hp 
       thief[2][----] 💀
    abrt                         gnome-packagekit       mobile-broadband-provider-info
    accountsservice              gnome-session          ModemManager
    aclocal                      gnome-settings-daemon  mousetweaks
    adobe                        gnome-shell            mozilla
    

    What if you introduce "slim output"? I dont know how it would be implemented right now but to show only enemy, if any, and then the outcome of the battle?

    1. My second proposal is in direct relation to the 1st: add separators to be added after battle. Something like:
    $ cd /usr/share/
         rat[7][xxxx][----]@/usr/share 
       thief[2][xxx-] -17hp 
         rat[7][xxxx] dodged!
       thief[2][x---] -13hp 
         rat[7][xxxx] dodged!
       thief[2][----] -14hp 
       thief[2][----] 💀
    ---------------------------------------------------------------------------------------------
    abrt                         gnome-packagekit       mobile-broadband-provider-info
    accountsservice              gnome-session          ModemManager
    aclocal                      gnome-settings-daemon  mousetweaks
    adobe                        gnome-shell            mozilla
    

    Support for both top and/or bottom separator would be apprieciated.

    opened by ghost 4
  • Non-UTF-8 display

    Non-UTF-8 display

    The last request :-)

    Could you care for LC_CTYPE (or they like) for detecting if the display is capable of displaying UTF-8? And if not, substitute the nice icons. :-)

    opened by mowgli 0
  • Localizing

    Localizing

    Could you make the game localized? For example, the words "remedy", "ether" and "escape" in buy display makes no sense for me…

    opened by mowgli 3
  • Colors for light background

    Colors for light background

    I usually have a light background which makes white color not visible.

    For now I patched that in the source but it would be nice to make colors aware of light or dark background or/and configure colors with config files.

    It might also be nice to get environment CLICOLOR_FORCE documented if using pipes…

    bug 
    opened by mowgli 5
  • Failed to compile with clap 3.0.0.beta.5

    Failed to compile with clap 3.0.0.beta.5

    On fedora compiling with this version of clap doesn’t work. https://kojipkgs.fedoraproject.org//work/tasks/1906/79961906/build.log

    error[E0432]: unresolved import clap::Clap --> src/command.rs:10:5 | 10 | use clap::Clap; | ^^^^^^^^^^ no Clap in the root error[E0432]: unresolved import clap::Clap

    opened by ghost 7
  • please run `reset --hard` to restart.

    please run `reset --hard` to restart.

    Invalid game data file. If it was generated with a previous version please run reset --hard to restart.

    
    ~ $ rpg-cli pwd
    /home/~/.config/glib-2.0
    ~ $ rpg-cli cd ~
    ~ $ rpg-cli pwd
    /home/~/.config
    ~ $ rpg-cli cd ~
    ~ $ rpg-cli cd ~
    ~ $ rpg-cli cd ~
    ~ $ rpg-cli cd ~
    ~ $ rpg-cli cd ~
         rat[5][xxxx][----]@~/.config
         rat[5][----] -201hp
     warrior[21][xxxx] +0xp
     warrior[21][xxxx][----][x---]@~/.config
    ~ $ rpg-cli cd ~
        wolf[5][xxxx][----]@~/.dbus
        wolf[5][----] -264hp
     warrior[21][xxxx] +0xp
     warrior[21][xxxx][----][x---]@~/.dbus
    ~ $ rpg-cli cd ~
    ~ $ rpg-cli cd ~
    ~ $ rpg-cli cd ~
    ~ $ rpg-cli cd ~
    ~ $ rpg-cli cd ~
    Invalid game data file. If it was generated with a previous version please run `reset --hard` to restart.
    ~ $ rpg-cli cd ~
    Invalid game data file. If it was generated with a previous version please run `reset --hard` to restart.
    ~ $ rpg-cli cd ~
    Invalid game data file. If it was generated with a previous version please run `reset --hard` to restart.
    ~ $ rpg-cli cd ~
    Invalid game data file. If it was generated with a previous version please run `reset --hard` to restart.
    ~ $ rpg-cli cd ~
    Invalid game data file. If it was generated with a previous version please run `reset --hard` to restart.
    ~ $ rpg-cli cd ~
    Invalid game data file. If it was generated with a previous version please run `reset --hard` to restart.
    ~ $
    
    
    opened by e3e0261f 6
  • macOS binary is unsigned, requiring Sec&Privacy adjustment

    macOS binary is unsigned, requiring Sec&Privacy adjustment

    I downloaded the binary and ran it on macOS 10.15.7. I got a security warning. I was able to open the Security & Privacy prefpane and allow it to run. The next time I ran it, I got the security warning again, but I was able to proceed.

    opened by colindean 3
Releases(1.0.1)
Owner
Facundo Olano
Facundo Olano
Sci-fi run 'n' gun action RPG created in Rust, using Macroquad

Capstone - Twilight of the Archons This is an action/run 'n' gun RPG, created in Rust using macroquad. The future holds huge boss fights, and a mind-n

Ole A. Sjo Fasting 58 Dec 5, 2022
Engine / framework for creating highly customizable and user modable action RPG's

Rust RPG Toolkit PLEASE NOTE: this in early and very heavy development. API is subject to constant change, as it has newly transitioned from being a g

Ole A. Sjo Fasting 58 Dec 5, 2022
Rustification of the excellent GD Script Action RPG Tutorial by youtuber HeartBeast

Godot Action RPG w/Rust A GDNative implementation in Rust of youtuber HeartBeast 's great step-by-step turoial series creating a Godot Action RPG, usi

Nejat 14 Apr 14, 2022
Dwarf Fortress inspired frontend to Veloren, the multiplayer RPG voxel game written in Rust

velobracket ('veloren' + 'bracket-lib') velobracket is Dwarf Fortress inspired frontend to Veloren, the multiplayer RPG voxel game written in Rust. Us

Rodion Martynov 13 Dec 25, 2022
A basic RUST RPG created by arukovic.

Rust RPG! Hello this is a RUST RPG created by arukovic! This is just a simple RPG created by purely Rust... feel free to run it! Manually running 1st

SONIC-CODEZ 3 Jul 16, 2022
A cross platform classic RPG game creator written in Rust.

Eldiron - Classic RPG Creation Create RPGs for every platform with Eldiron. Eldiron v1 will be able to create games similar to the classic Ultima seri

Markus Moenig 164 Jan 2, 2023
RPG Dialog support for Bevy, written in pure Rust!

?? ?? Bevy x RPG Dialog ?? ?? RPG Dialog support for Bevy, written in pure Rust! bevy-rpg is a plugin crate that adds dialog functionalities to Bevy,

null 5 Jan 8, 2023
A CLI tool to manage your godot-rust projects

ftw A CLI tool to manage your godot-rust project! Table of contents General Information Setup Usage Contact General Information This is a tool to help

Michael Angelo Calimlim 77 Dec 13, 2022
CLI game to see how fast you can guess the language of a code block!

Guess That Lang! CLI game to see how fast you can guess the language of a code block! If you like the game, please consider giving a ⭐ ! Code is retri

null 152 Dec 27, 2022
A third-party CLI utility for the Bevy game engine.

cargo-bavy A third-party command-line utility for the Bevy game engine. To not steal the cargo bevy command from the official Bevy maintainers, I chos

null 4 Oct 16, 2022
A puzzle game where you eat your own tail to win!

taileater taileater is a puzzle game available for free here: https://szunami.itch.io/taileater This project is built using Rust and Bevy. Assets were

null 25 Dec 20, 2022
Synchronize games from other platforms into your Steam library

BoilR Description This little tool will synchronize games from other platforms into your Steam library, using the Steam Shortcuts feature. The goal is

Philip Kristoffersen 823 Jan 9, 2023
The Big Cheese a webapp wherein you can share recipes with your friends.

The Big Cheese The Big Cheese a webapp wherein you can share recipes with your friends. Contributing Contributions are what make the open source commu

null 3 May 5, 2022
💤 Put your Minecraft server to rest when idle.

?? Put your Minecraft server to rest when idle.

Tim Visée 285 Jan 4, 2023
This is an online game in which you program your character and he fights with other players

Game for programmers The goal of this project is to create a simple game for programmers. The essence of the game Each player has his own character th

Danila 1 Dec 10, 2021
Easily update your minecraft mods with 1 file (guess I'm back to rust again)

Mod Updater This program updates all your mods to a newer/later version. To use: Create a file named config.toml Create a folder named mods; Add the f

sussyimpostor 2 Sep 18, 2022
Find out what takes most of the space in your executable.

cargo-bloat Find out what takes most of the space in your executable. Supports ELF (Linux, BSD), Mach-O (macOS) and PE (Windows) binaries. WASM is not

Yevhenii Reizner 1.7k Jan 4, 2023
State of the art "build your own engine" kit powered by gfx-hal

A rendering engine based on gfx-hal, which mimics the Vulkan API. Building This library requires standard build tools for the target platforms, except

Amethyst Foundation 801 Dec 28, 2022
This is starter for your own game-specific tools

Bevy Toolbar Usage: This is starter for your own game-specific tools, clone source and manually add it to [workspace] section in Cargo.toml. Now add i

null 15 Sep 11, 2022