Usage
- gext is a text based adventure game written in rust and saved in json
in game commands
look: print the description of the roomgo [room]: move to another room (checks if you have the key)take [item]: take an itemtakekey [key]: take a keysearch: search the room for items, keys, and doorssave: save the gamebattles: print the battles you've foughtinventory: print the items and keys you haveuse: use an item now, but for only half the effect
debug-only in game commands
debug: print current player and map data
Installation
using cargo
Prerequisites
- you need to have
cargoinstalled (which comes withrust) - to do this, run the following command in your terminal:
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
- this downloads the latest rust installer, then pipes it to your shell to run it
- follow the instructions in the installer (if you don't know what to do, just press enter)
- after the installer is done, you need to restart your terminal (by closing it and opening a new one, or by running
exec <your shell>), or by running the following command:
source $HOME/.cargo/env
- this adds the
cargocommand to your path
Installation
- to install
gext, run the following command in your terminal:
cargo install gext
- this downloads the latest version of
gextfromcrates.io, then compiles and installs it - then, assuming the installation of
rustmodified your path, you can run the game with the following command:
gext [OPTIONS]
- if the installation of
rustdid not modify your path, you can run the game with the following command:
~/.cargo/bin/gext [OPTIONS]
- if you are not using *nix, replace
~/.cargo/bin/gextwith the path to thegextbinary (which should be in thebindirectory of thecargoinstallation directory, on windows, this is usuallyC:\Users\<your username>\.cargo\bin\gext.exe) - if you are using *nix, you can add the
bindirectory of thecargoinstallation directory to your path by running the following command:
echo 'export PATH="$HOME/.cargo/bin:$PATH"' >> ~/.bashrc
using the binary
- the game is built on linux, so it should work on all linux systems
- to install
gext, download the latest release from the releases page - ensure to pick the correct binary for your system
- if your system is not listed, you can build the game from source, as detailed above
Playing
- this page contains some tips and tricks for playing the game
player stats
- the player has 3 stats: health, attack, and defense
- health is the amount of damage the player can take before dying
- attack is the amount of damage the player can deal to an enemy
- defense is the amount of damage the player can block from an enemy
doors
- doors are used to move between rooms
- some doors are guarded by an enemy, where you need to defeat the enemy to pass
- other doors are locked, where you need to find a key to pass
items
- items are used to buff the player
- items can be found in rooms
- items can be taken with the
takecommand - they buff one or more of the player's stats
enemies
- enemies are found behind doors
- enemies have stats, just like an ordinary player (in the game files, they are just an instance of the
Playerstruct) - enemies can be fought when attempting to pass a door (but you need the key first)
- by using the
searchcommand, you can check if a door is guarded by an enemy, or if it is locked - once you attempt to pass a door, you can't go back (if you die, all your stats are reset, but any items you used in the battle are not returned to you)
saving
- the game can be saved with the
savecommand - at the start of each game, you are asked if you want to load a save file
- if you choose to load a save file, you are asked for the name of the save file
- game files usually have the
.save.jsonsuffix
Options
command line arguments
--map or -m to specify a map file, usually suffixed with .map.json
- if not specified, defaults to hard-coded map, which can be found at src/main.rs
Modding
- gext is an inherently moddable game, as it is saved in json
- though it should be pretty obvious, the details of how to mod the game are documented here
- Map
- Player Data
Map
- to modify the map, you can customise the map save file
- this is usually suffixed with
.map.json - the map save file is a json file, with the following structure:
examples
- here are some example rooms, from the default save
- note that all rooms that they reference (ie "East Dungeon Cell" etc.) are not included in this snippet, and can be found at (default.map.json)[https://github.com/werdl/gext/blob/main/default.map.json]
{
"East Dungeon": {
"name": "East Dungeon",
"description": "a dark dungeon",
"doors": [
{
"name": "East Dungeon Cell",
"description": "a dark dungeon cell",
"locked": false,
"key": {
"name": ""
},
"enemy": null,
"associated_room_name": "Dungeon",
"requirements": null
}
],
"items": [
{
"name": "stick",
"description": "a stick",
"health": 0,
"attack": 1,
"defense": 0
}
],
"keys": []
}
}
- this one describes a simple room, that contains a stick, and a door to a dungeon cell
"Armory": {
"name": "Armory",
"description": "a room with a lot of weapons",
"doors": [
{
"name": "Trophy Cupboard",
"description": "a room with a lot of trophies",
"locked": true,
"key": {
"name": "trophy cupboard"
},
"enemy": {
"class": {
"name": "Default",
"description": "Looks like somebody didn't choose a class...",
"health": 100,
"attack": 10,
"defense": 10,
"starting_items": [],
"starting_keys": [],
"won_battle_attack_bonus": 5,
"won_battle_defense_bonus": 5,
"won_battle_health_bonus": 5
},
"name": "Trophy Keeper",
"map": {},
"items_held": [],
"keys_held": [],
"health": 100,
"attack": 20,
"defense": 10,
"battles": [],
"current_room": {
"name": "Empty Room",
"description": "a room with nothing in it",
"doors": [],
"items": [],
"keys": []
},
"game_name": ""
},
"associated_room_name": "Trophy Cupboard",
"requirements": null
}
],
"items": [
{
"name": "shield",
"description": "a shield",
"health": 20,
"attack": 0,
"defense": 0
},
{
"name": "axe",
"description": "a sharp axe",
"health": 0,
"attack": 20,
"defense": 0
}
],
"keys": [
{
"name": "trophy cupboard"
},
{
"name": "pantry"
}
]
}
- this one describes a room with a shield, an axe, and a door to a trophy cupboard
- the trophy cupboard is locked, and contains an enemy
- the enemy is a
Trophy Keeper, with 100 health, 20 attack, and 10 defense
Player Data
How to customise items held by user, user stats etc
- all player data is stored in the game save file, a serialized
Playerinstance - therefore, by editing it after saving and before loading, you can customise the player's stats, items, and keys
player stats
- the player has 3 stats: health, attack, and defense
- these are all integers
- to edit, change the
health,attack, anddefensefields in thePlayerstruct (at top level of the json file)
items
- items are stored in the
items_heldfield of thePlayerstruct - to add an item, add a new item to the
items_heldarray - to remove an item, remove the item from the
items_heldarray
keys
- keys are stored in the
keys_heldfield of thePlayerstruct - these can be added and removed in the same way as items
battles
- battles are stored in the
battlesfield of thePlayerstruct - this is an array of
Battlestructs - to add a battle, add a new battle to the
battlesarray - to remove a battle, remove the battle from the
battlesarray
current room
- the current room is stored in the
current_roomfield of thePlayerstruct - this is a
Roomstruct
game name
- the game name is stored in the
game_namefield of thePlayerstruct - exactly why you would want to change this is beyond me, but you can, I guess