Yes, you could do this as a game that runs in the shell itself. You could declare a bunch of functions in a script file then source my-game-functions.sh
to make all game functions available in the shell. Maybe the game play entry point could setup these functions, and then enter into a restricted Bash shell using bash -r
which forbids users from using the cd
command, but the functions in my-game-functions.sh
would still be available.
I think the interesting thing for you will be how to structure the rooms and parts of the story for your game, how to present the story, and how you can set variables for the player of the game that determine what moves the player is allowed to make next, how to keep track of their score, their skill points, and their inventory.
The jq
command is "JSON Query", you can use it to save your player's information as JSON data. You could also do it with sqlite, or just store your game state as a file with lots of Bash variables that you just source
into your shell to continue a saved game. It depends on how complicated you want the game to be.
The graphics are optional. If you use Linux and use a program like <code>eog</code> to just display an image for that room whenever someone enters the room, let the game player close the window themselves. But really the Bash scripting is the more important part, so don't waste time on graphics until you have the rest of your game done.
I'm not sure how to interpret the targets, TBH. You may have a misleading expectation.
xclip 0.13-1
I opened an image in eog (Gnome's Image viewer), right clicked, and selected copy. Pasting in the terminal shows file:///path/to/image.png.
xclip -selection clipboard -t TARGETS -o | sort
COMPOUND_TEXT
MULTIPLE
SAVE_TARGETS
STRING
TARGETS
TEXT
text/html
text/plain
text/plain;charset=utf-8
text/x-moz-url-priv
text/_moz_htmlcontext
text/_moz_htmlinfo
TIMESTAMP
UTF8_STRING
xclip -selection clipboard -t image/png -o > new.png
No problems.
Eye of Gnome the default image viewer on Gnome
You can easily check that yourself by comparing the md5 hash after a rotation and after rotating it back again (or completing a full rotation)