Adventure Bash Game

This commit is contained in:
fred 2022-10-30 02:22:28 +01:00
parent 36c2fd2238
commit f9b782cf62
27 changed files with 928 additions and 113 deletions

View File

@ -1,113 +0,0 @@
BashVenture - Adventure for Bash
=================================
You are in a git repository. Code surrounds you. There are directories to the north, south, east, and west.<br>There is a README file here!
Introduction
------------
One of the very first computer games I played was Colossal Cave, aka 'Adventure'. Widely regarded as one of THE original classic text-based adventure games, pre-dating Zork and others, it set the scene for a new era of human-computer interaction and inspired countless software developers to build things that had a more human touch.
In this age of high-performance graphics and hyper-realistic gameplay, I think it's important to remember that a cleverly told story beats a well-rendered polygon any day.
That's why I build BashVenture. I wanted a way to bring back a bit of life into the text-based adventure game format, without the need to be an expert coder. BashVenture is a simple set of easy-to-edit scripts and logic files that you can re-word and re-engineer to create games as simple or as complex as you like.
Play the demo, fork the repo, and have a go at making an immersive, well-told adventure of your own! All I ask is that you link back here in the game introduction, so that others can see how easy it is to make a game of their own too.
Play the demo of BashVenture!
-----------------------------
You don't need to download the repo to try out the game mechanics! BashVenture is designed to run over a telnet/ssh connection. I've set up a test instance that anyone can play - so jump onto the server and have a go!
```bash:
ssh bashventure@gkly.co
```
Password:<br>
```
xyzzy
```
NB - If you're a Windows user, you can still join in the fun. Download [PuTTY](http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html) and use the credentials above. Simples!
How it all works
----------------
BashVenture - or any game you create with it - is a simple set of bash script files that display artwork and text, wait for a user's input, and acts on that input accordingly. Usually this sees a player move around a 'map' of interconnected script files, called rooms, to discover where they are, what they have to do, and where to go next.
Games can also have logic with various degrees of complexity, from a simple set of switches and levers (as in the demo) right through to complex codebreaking or secret-sharing. In BashVenture, logic is all file-based - when you flick a switch, for example, an entry in the corresponding logic file is changed. This means logic states transcend rooms and player death - you can reset logic as and when you want to, rather than it being tied tod a specific room or area, or lifetime if you're the kind of player that dies a lot.
A player makes their way through the game by issuing commands. The default commants are north, south, east, west, use and hug. Because hugging is better than shooting. The user decides what course of action to take by typing in n, s, e, w, u or h respectively. You can customise this completely by adding your own commands.
There's an introduction and a bit of an endgame - and some baddies and things that can kill you along the way. I strongly suggest that, before forking and trying to write a game of your own, you play the demo and get a feel for how the gameplay mechanics work.
The magic of a good adventure game is in the storytelling! Script well, test often, and don't over-complicate things.
What's included in this framework?
----------------------------------
There are four types of file in this project, split into their respective subdirectories:
### Art
Everyone loves a bit of ASCII art, right? There are a few sample files with artwork included in here - but if you're building a game yourself and want to inclide more artwork, this is the place to put it. The title art is displayed in every room, for consistency.
### Rooms
Every single 'room' in the game is stored in a separate room file. This is a metaphorical room - it could be a wooded area, a cave, the moon, spaaaaaace, whatever. In this demo there are rooms and corridors - the files look identical. It's all in the wording.
### Script
While the room files have the majority of each room's special wording in them, the files in this folder contain longer bits of story and the introduction text. If you want to display large chunks of text from files in your game, the scripts folder is where you want to place them.
### Logic
What makes a text-based adventure more than a simple maze game is logic. Here you can set switches, have users match words or find secrets. In the demo game, there's one piece of logic and one piece only - but you can add as much logic as you like! Keep it tidy - the logic all lives in the logic folder.
Setting it up yourself
----------------------
If you play the demo, you'll notice that one only has to log into the server and the game starts automatically. In this instance, I've put the user inside a chroot jail and set the ./adventure file as the shell - so whatever happens, the player can't break out of the game and go rummaging through system files.
### Allowing for Multiple Players
If you take a look at the ./adventure.sh script, you'll notice that multiple players are handled by the spinning up of a new game instance for each player connecting to the server. BashVenture has a dependancy on uuid-runtime here, as it generates a new, and temporary, unique identifier for each new player.
The script checks to see whether the uuidgen runtime is installed and takes the appropriate action - so you don't need to edit the file to enable or disable multi-user support. All you need to do is ensure that the uuid-runtime dependancy is installed on your server (and inside your chroot jail if appropriate). To do this, simply install the following package:
```bash:
sudo apt-get install uuid-runtime
```
Note that uuidgen ships with OS X and OS X Server, but isn't installed by default in some linux distros.
If you don't want to enable multiple players at once, simply ensure all of the game files are kept within the correct folder structure, install it somewhere (usually within a user's home folder) and run the ./adventure file.
### Trouble running the game? Getting weird errors?
Check the permissions on the 'adventure' file and the main folder for the game. If you need to, chmod +x to make all of the game files executable.
Contributing & License
--------------
Future versions of this framework are planned, with massive extensions to the logic side of things. I welcome any and all contributions, so please feel free to contribute. If you have ideas for the direction that the framework should take, please don't hesitate to [get in touch](mailto:mail@bennunney.com).
This code is relased under the MIT License. Please see the LICENSE file for more information on what this means and how to make attributions.
Acknowledgements
----------------
Huge thanks to [@drwilco](https://github.com/drwilco/), [@penman](https://github.com/penman), & [@kfouwels](https://github.com/kfouwels) for helping me see clearly when I was bash-ing my head against a brick wall.
<br>Bash-ing? See what I did there?
Comments, questions, suggestions? [Get in touch.](mailto:mail@bennunney.com).

40
adventure/adventure.sh Executable file
View File

@ -0,0 +1,40 @@
#!/bin/bash
# This Launch script is based on BashVenture. https://github.com/apetro/BashVenture
# It runs on Astroport Stations and allow players to create their own digital stories
# First you have to install IPFS in order to play with everyone in the same network
#
# Remember, kids - sharing is caring! Keep it open. Spread the love.
# - @BenNunney
# Thanks and gratitude to all living creatures and the whole creation.
# - @Fred
# Here we check to see if uuidgen is installed - if not it will default to single-user mode. To run this on a server
# and support multipe-users, check you have everthing set up correctly. Follow the instructions in the ReadMe file on GitHub.
if hash uuidgen 2>/dev/null; then
homefolder=$(pwd)
newplayer=$(uuidgen)
mkdir -p $HOME/.zen/tmp/adventure/$newplayer
cp -r rooms $HOME/.zen/tmp/adventure/$newplayer/rooms
cp -r art $HOME/.zen/tmp/adventure/$newplayer/art
cp -r script $HOME/.zen/tmp/adventure/$newplayer/script
cp -r logic $HOME/.zen/tmp/adventure/$newplayer/logic
fi
echo "Loading..."
echo
sleep 4
if hash uuidgen 2>/dev/null; then
cd $HOME/.zen/tmp/adventure/$newplayer/rooms
else
cd rooms
fi
./start.sh
if hash uuidgen 2>/dev/null; then
cd "$homefolder"
rm -r $HOME/.zen/tmp/adventure/$newplayer
fi
echo
exit

21
adventure/art/Gune.ben Normal file
View File

@ -0,0 +1,21 @@
.';:llllc;'.
.:xXWX;.,ll;.:XWXx;.
;0MMMMMMKl;'',l0MMMMMWO,
,0MMMMMMW0dc;,,;cd0WMMMMMMO.
dWMMMMM0; ;OMMMMMN:
dMMMMMN: .,'. cWMMMMMc
,WMMMMX. .xNMMMMNx,'lONMMMMMMN.
oMMMMM: :WMMMMMMMMMMMMMMMMMMMMc
xMMMMM' xMMMMMMOlllllllloNMMMMo
oMMMMMc ,NMMMMMWd. KMMMM:
.WMMMMN, .l0NWWWKc KMMMX.
cMMMMMWo .. KMMW;
cWMMMMMXo' .lKd. KMK'
.xWMMMMMMN0dlllldONMMMMWOXd
.xNMMMMMMMd''lWMMMMMMXo.
'lONWMW, .XMWXOl.
..,,..,,..

View File

@ -0,0 +1,21 @@
.':cdxxxxxoc;.
.:x00dc;'..:..,:lk00o'
;0Xd, oMo :OXx.
:KK; cMMMl .oNk.
.kN: ;MMMMMc xNl
.0K. ,WMMMMMW; ;Wo
OX. ,WMMMMMMMW; ;Wc
cM; .WMMMMMMMMMW, kX.
OX .NMMMMMMMMMMMW' ,Mc
O0 .NMMMMMMMMMMMMMW' .Mc
ON .XMMMMM0kkkkKMMMMN. ,M:
:M; KMMMMM: .,,;dMMMMMN. kX.
ON. 0MMMMMl ,WMMMMMMMMMMX. ;Wc
.0K. 0MMMMMd 'WMMMMMMMMMMMMX. :Wo
.xN: kMMMMMO .XWWWWNNNNNXXKKKd xNc
;0Xl. .oXx.
,OXx, .cOKd.
;d00xl:,....';coO0Ol'
.;:odddddl:,.

View File

@ -0,0 +1,21 @@
MMMMMMMMMMMMMMMMMMMl xxlxxxd . KNNMNl. 'd0xdddkXKxc. ,dNMMMMMMMMMMMMMMM
MMMMMMMMMMMWKOl:cc' .NNOMXNX .ld; ,lxXMMMMMMMMMMM
MMMMMMMMNo. ,,' .KKWMOXX .. .dWMMMMMMMM
MMMMMMWc cdddc .NNNMXNX .do '' ' .:,:k; l, .KMMMMMMM
MMMMMW, ;ll: .,:ddddd .KKOM0XX .do '0MMXMo . dMMMMMMXOMX0: XMMMMMM
MMMMMo xc:d 'ddddddd .XXWMK00' .do .oo. .dMMMMMMO;lWNMMMMMMWXMMMX: :MMMMMM
MMMMW. .cXKKXWooK0kk0d0Oxxkkx .XXNM0Ok; .:ol:'do,0MMK ... 'XMMMMMMMMMMMMMMMMMWWMMMMx .dkONMM
MKNK. NMWooOWllKKoMNll0MM0x0 xNXXOMKOkKOoM0kkkOkWMMMM0NWWXXMMMMMMMMMMW:WkWk0OKMWdOMNxd0O. .KM
l dkkMMWloOWcc0KoMNccOMMxl0cMMXXWM0KOMMMM0OkkOKMMMMMMMMMMMMMMMMMMMMM0 : o.. 'll.lMMMMMMx .O
;kMMMMMWlckWooKXdMNccOMMxlXk0MMMNMMMMMMMM0OkkOWMMMMMMMMMMMMMMMMMMMMMMo0OWW,xNWKcooMM0NN0Oc
.NMMMMMMNllkWllKKoMNll0MMxlNxOMMMOMMMMMMMM0OkOOWMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMWNMMNdxMMMk
;WMMMMMMMMMMMNNWWNMMMMMMMWWMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMWMWx.
:MMkxxxWMMMWkxxxxxxxWXxxxxxxxxKWxxxxxxxxxWMMKxxxxxxKMMKxxxxxxxxKMMXxxxxxx0MMkxxxxxxxxNMXxdlloodO:
:N, OMM0. 'N. 0: :Mc XK Nx kl ,N. ;'
x..M0xddddKMMOddddddddKKddddddddxNxdddddddddOWoooooooooN0ddddddddddNdoooooooo0xdddddddddkKdddddddox.
MWKK ,MN. .,XMMMMl ;MMMM' xc 'MMd .Mx ;x .NMO N; dMMMl ,W
MMMK NM:. 'MMMW. xMMMO dW. oMM. lM' .:N, ;MM; ;K oMMMW. dO
MMMMMMMo xXXXXXk .MMMO NMMM; .WWN. 00 XM0 KK 0WWWWMMW OMX kc .WWW. OMMMO Nc
MMMMMMMX dMMM; ;MMMN dMMk N0 .. oMl .MMMMMMMN ... :W. lMM0 XMMM; ;M' .c
MMMMMMMM, .xMMMW. kMMMx .NMM: cMMd. .;0MM. oMMMMMMMMk. .,kMO XMMl :MMMW. kMOKMM
MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM

View File

@ -0,0 +1,21 @@
.,'.
.,,;,'',;,'',,.'.
.;;,,.. .........'
.l:. ............cc.
.c, .................:c.
.lc ................... .l;
l' ... .............. c:
:: .. ........... l'
d . .''...... 'o
.o .. ''''''. l
.d . ......''''''' l
o . .,,,,,,'''''' 'l
;: . ',,,,''''', l.
l, .. .,,,''''', oc
.lc .',,,''',. .c,
'l, .,,''',..:c.
';;. .,,',,:;.
':;;'. .;:,,,.
.,,'''''','..;,,.
,:.
.,

9
adventure/art/bigfinish.ben Executable file
View File

@ -0,0 +1,9 @@
_______ _ ______ _
|__ __| | | ____| | |
| | | |__ ___ | |__ _ __ __| |
| | | '_ \ / _ \ | __| | '_ \ / _` |
| | | | | | __/ | |____| | | | (_| |_
|_| |_| |_|\___| |______|_| |_|\__,_(_)

View File

@ -0,0 +1,21 @@
.:dO0NNkNX0ko,.
.:OWMMMMMMc cWMMMMMXd,
'kWMMMMMMMMc cWMMMMMMMNo.
.kMMMMMMMMMMo lMMMMMMMMMWl
.KMMMMMMMMMMd oMMMMMMMMMMx
.XMMMMMMMMMMk dMMMMMMMMMMx
xMMMMMMMMMM0 OMMMMMMMMMM,
.NMMMMMMMMMK. OMMMMMMMMMk
'MMMMMMMMMK. OMMMMMMMMK
.NMMMMMMMK. ,;;;;' OMMMMMMMx
dMMMMMMX. kMKkxxc 0MMMMMM,
.KMMMMN. dMx .KMMMMd
.0MMN. cMx .KMMd
xW' 'W0. ......:Xc
.lXNNWNWMMMMMMMMMMMMMMMMXl
;xXMMMMMMMMMMMMMMWKo'
.,lxkKKKK0kdc'

10
adventure/art/supper.ben Executable file
View File

@ -0,0 +1,10 @@
_____ _ _
/ ____| (_) | |
| (___ _ _ _ __ _ __ _ __ _ ___ ___| |
\___ \| | | | '__| '_ \| '__| / __|/ _ \ |
____) | |_| | | | |_) | | | \__ \ __/_|
|_____/ \__,_|_| | .__/|_| |_|___/\___(_)
| |
|_|

9
adventure/art/titleart.ben Executable file
View File

@ -0,0 +1,9 @@
_ _ _ ____ ___ _ ____
/ \ ___| |_ _ __ ___ _ __ ___ _ __| |_ |___ \ / _ \ _ / |___ \
/ _ \ / __| __| '__/ _ \| '_ \ / _ \| '__| __| __) | | | | (_) | | __) |
/ ___ \\__ \ |_| | | (_) | |_) | (_) | | | |_ / __/| |_| | _ | |/ __/
/_/ \_\___/\__|_| \___/| .__/ \___/|_| \__| |_____|\___/ (_) |_|_____|
|_|
--- Un JEu de Forêt Jardin en Monnaie Libre sur IPFS ---

1
adventure/logic/leverlogic.ben Executable file
View File

@ -0,0 +1 @@
off

View File

@ -0,0 +1 @@
off

58
adventure/rooms/bigroom.sh Executable file
View File

@ -0,0 +1,58 @@
#!/bin/bash
clear
# Initialise the Title Art
file1="../art/titleart.ben"
while IFS= read -r line
do
echo "$line"
done <"$file1"
# This is close to the endgame, but affords the player a last set of things to try and do.
# Obviously if you use this framework to create a game of your own, you can extend this massively.
echo
sleep 1
echo "Vous décidez de sortir de la Sation Astroport."
echo
echoleverstate=`cat ../logic/stationlogic.ben`
if [ "$leverstate" = "on" ]; then
sleep 2
echo "Il ne dépend que de vous d'explorer ce nouveau futur."
echo "Le Visa MadeInZion inaugure un monde sans territoire, sans frontière, transnationnal, interplanétaire, à vous de voir?"
sleep 2
echo "Avant de nous rejoindre. Visitez notre 'bon coin' https://gchange.fr "
echo
sleep 3
echo "Ouvrez une ambassade? Installez IPFS, devenons hébergeur, fournisseur d'accès de nos Internets."
echo
sleep 4
echo "Ouvrez votre propriété au futur en commun, activez Astroport."
echo "Nous organisons des formations habitats posés, vissés et cousus. Eau potable. Biogaz, Marmite Norvégienne..."
echo "Comment nourrir le sol, reconnaitre les plantes... Redevenir ceuilleur, créateur."
echo
else
echo ""
echo "Aucune entrée n'est visible."
fi
echo
sleep 5
echo
echo "Que voulez vous faire?"
while true; do
read -p "> " nsewuh
case $nsewuh in
n ) echo "Pas moyen de se déplacer." ;;
s ) echo ".Pas le choix." ;;
e ) echo "Pas par là." ;;
w ) echo "Plus à l'ouest que ça? Y'a pas!" ;;
u ) ./end.sh
exit ;;
h ) echo "Comment refuser une telle proposition..." ;;
* ) echo "Je suis désolé, je ne vous comprends pas. Les commandes sont : n, e, s, w, u et h..";;
esac
done
esac
exit

62
adventure/rooms/brown.sh Executable file
View File

@ -0,0 +1,62 @@
#!/bin/bash
clear
# Initialise the Title Art
file1="../art/titleart.ben"
while IFS= read -r line
do
echo "$line"
done <"$file1"
echo
sleep 1
# Here's this room's script.
echo "Sur la direction du sud, vous traversez une zone plus sombre et humide."
echo "Le sol est glissant à cause de l'argile qui colle sous vos bottes"
echo "Vous finissez par croiser un chemin qui traverse la forêt d'Est en Ouest"
echo
echo "Un terminal informatique est installé là."
echo
echo "Il ressemble à une grosse calculatrice"
# Here we tell the player whether the lever is on or off.
leverstate=`cat ../logic/leverlogic.ben`
if [ "$leverstate" = "on" ]; then
echo "'VISA SVP' clignote sur l'écran..."
else
echo "La machine affiche l'heure : 20:12"
fi
echo
echo "Il est tard pour explorer le chemin à pied, vous devriez retourner d'où vous venez."
echo
echo "Que faites vous?"
# In this set of actons lies the logic switch used later in the game.
# You have to set this switch to reach the endgame.
while true; do
read -p "> " nsewuh
case $nsewuh in
n ) ./mainroom.sh
exit ;;
s ) echo "Si vous continuez à marcher dans la forêt. Vous allez vous perdre. Demi tour." ;;
e ) echo "Le chemin qui part à l'Est est plein de boue... Impossble d'aller par là." ;;
w ) echo "Une rivière vous empêche de passer." ;;
u ) leverstate=`cat ../logic/leverlogic.ben`
if [ "$leverstate" = "on" ]; then
echo "A chaque frappe d'une touche. l'écran fait défiler le texte 'SCANNEZ VISA SVP'."
else
sed -i='' 's/off/on/' ../logic/leverlogic.ben
echo "Vous pianotez sur l'appareil..."
sleep 3
echo "A moment où vous touchez la touche '#' L'écran se met à clignoter..."
echo "Puis le message 'ACTIVATION STATION' défile sur les caractères lumineux."
fi
;;
h ) echo "Le terminal comporte un clavier numérique. Un petit écran.. Il est réalisé avec un mini ordinateur Raspberry Pi. Il porte l'adresse G1TAG [https://g1sms.fr]" ;;
* ) echo "Je suis désolé, je ne vous comprends pas. Les commandes sont : n, e, s, w, u et h..";;
esac
done
esac
exit

71
adventure/rooms/end.sh Executable file
View File

@ -0,0 +1,71 @@
#!/bin/bash
clear
# This is the endgame. This file does nothing but give you the final bit of storyline.
# Use (over-use) of 'sleep' is for dramatic effect - play around with it, see how it reads.
# Let's reset the lever, now that we're done with it.
sed -i='' 's/on/off/' ../logic/leverlogic.ben
# Initialise the Title Art
file1="../art/titleart.ben"
while IFS= read -r line
do
echo "$line"
done <"$file1"
echo
sleep 1
echo "Voic la fin de cette petite aventure."
echo
sleep 4
echo "Vous venez de visiter la forêt où s'est posé Astroport ONE."
sleep 3
echo
echo "Une oeuvre habitable. Un jardin sur sol vivant. Un progamme pair à pair interplanétaire"
sleep 4
echo
echo "Les terraformeurs"
echo "En quête de la meilleure façon de vivre sur le vaisseau spatal Terre..."
echo
sleep 5
echo "Vous aussi ouvrez votre Ambassade."
echo "Activez le JEu. Invitez vos visiteurs à rêver d'un monde meilleur"
echo "Reproduisez, améliorez, partagez les plans pour y parvenir."
echo
sleep 7
echo "Il est l'heure de laisser derrière vous la civilisation thermo industrielle."
echo "Gagnez en autonomie, en convivialité, en optimisme, en conscience."
echo
sleep 5
echo
echo "EMBARQUEZ VERS LE FUTUR"
echo
sleep 9
echo
file1="../art/bigfinish.ben"
while IFS= read -r line
do
echo "$line"
done <"$file1"
echo
echo
read -p "Appuyez sur [ENTER] pour terminer..."
echo
clear
file1="../art/titleart.ben"
while IFS= read -r line
do
echo "$line"
done <"$file1"
echo
echo "Merci d'avoir joué le jeu"
echo "Je suis heureux de vous avoir fait partager le rêve des astronautes terraformeurs."
echo
echo "Le futur ne se prédit pas, il se construit. Il se vit."
echo
echo " - @Fred"
echo
# That's all, folks!
exit

77
adventure/rooms/gameroom.sh Executable file
View File

@ -0,0 +1,77 @@
#!/bin/bash
clear
# Initialise the Title Art
file1="../art/titleart.ben"
while IFS= read -r line
do
echo "$line"
done <"$file1"
echo
# This room gives the player a typical poisoned apple style scenaro.
# Just because something looks shiny and fun, doesn't make it any
# less deadly.
sleep 1
echo "Dans une cabine, un écran est disposé en coin. Un tout petit ordinateur"
echo "y est raccordé... D'autres fils sortent de l'appareil. Une webcam. Une imprimante."
echo
echo "Que voulez vous faire?"
myIP=$(hostname -I | awk '{print $1}' | head -n 1)
[[ ! $myIP ]] && myIP="127.0.1.1"
while true; do
read -p "> " nsewuh
case $nsewuh in
n ) echo "Vous êtes dans une cabine. Des QRCode sont collés à la parois nord" ;;
s ) echo "Cette paroie comprte un miroir. Pour se faire une beauté avant d'enregistrer une capsule vidéo." ;;
w ) ./kroo.sh
exit ;;
e ) echo "Vous êtes face à l'écran. Au dessus des hauts parleurs, une webcam" ;;
u ) leverstate=`cat ../logic/stationlogic.ben`
if [ "$leverstate" = "on" ]; then
echo "A chaque frappe d'une touche. l'écran fait défiler le texte 'SCANNEZ VISA SVP'."
else
sed -i='' 's/off/on/' ../logic/stationlogic.ben
echo "Vous appuyez sur l'interupteur de l'écran. Y apparaît alors :"
sleep 3
echo "AMBASSADE MadeInZion - TerraPi4 - 2 To -"
echo ""
echo
sleep 2
echo "INTERNET est dangereux. il vend vos information personnelles pour que vous deveniez un produit. "
echo "Quittez INTERNET. Découvrez le Système de Fichiers Interplanétaire (IPFS)."
sleep 2
echo
echo "Nous remplissons IPFS des identités des Astronautes qui explorent le mode de vie en forêt jardin."
sleep 2
echo
echo "On y échange en pair à pair. La monnaie y est Libre."
sleep 4
file1="../art/astrored.ben"
while IFS= read -r line
do
echo "$line"
done <"$file1"
echo
echo
echo "____ Astroport 20:12 est un programme qui permet de monter des ambassades de la 'présipauté pair à pair' MadeInZion....."
echo "Chaque Lieu porte l'Arbre des rêves de ses habitants"
echo "Chaque Astronaute fait des voeux et partage ses talents."
echo "Participez au JEu d'ingénierie DIY lancez la terraformation forêt jardin."
sleep 3
echo
echo "ASTROPORT ONE"
echo
read -p "Appuyez sur [ENTER] pour démarrer votre station"
~/.zen/Astroport.ONE/start.sh
fi
exit
;;
h ) echo "'DEMARRER API http://$myIP:1234 ... Une Station Astroport.ONE.?." ;;
* ) echo "Je suis désolé, je ne vous comprends pas. Les commandes sont : n, e, s, w, u et h..";;
esac
done
esac
exit

38
adventure/rooms/green.sh Executable file
View File

@ -0,0 +1,38 @@
#!/bin/bash
clear
# Initialise the Title Art
file1="../art/titleart.ben"
while IFS= read -r line
do
echo "$line"
done <"$file1"
echo
# Everybody clap your hands. I mean, here is the script.
sleep 1
echo "Vous atteignez une zone remplie de jeunes épineux"
echo "Vous reconnaissez des prunus, des aubépines."
echo "Quelques génévriers dont vous remarquez les baies noires."
echo "Un peu plus loin ce sont les ronces."
echo
echo "Plus vous progressez plus vous souffrez des épines. Existe-t-il un passage? Qui sait."
echo
echo "Que voulez vous faire?"
# And here's what you could have won...
while true; do
read -p "> " nsewuh
case $nsewuh in
n ) echo "Un énorme roncier vous barre la route. Ca ne passe pas." ;;
s ) echo "Vers le sud, aucun passage en vue." ;;
e ) ./mainroom.sh
exit ;;
w ) echo "Vous voyez le même paysage à perte de vue" ;;
u ) echo "Vous cueillez une baie de genèvrier. Vous la portez à la bouche. Croquez. La saveur est délicieuse. La force de la plante vous envahi." ;;
h ) echo "Ce type de terrain est caractéritique des zones déboisées. La nature sort ses épines pour protéger les arbres qui poussent en dessous." ;;
* ) echo "Je suis désolé, je ne vous comprends pas. Les commandes sont : n, e, s, w, u et h..";;
esac
done
esac
exit

35
adventure/rooms/grue.sh Executable file
View File

@ -0,0 +1,35 @@
#!/bin/bash
clear
# Initialise the Title Art
file1="../art/titleart.ben"
while IFS= read -r line
do
echo "$line"
done <"$file1"
echo
# I like this room. There is no way to get out of it alive.
sleep 1
echo "Un évier derrière une fenère, une ancienne porte d'armoire comme table."
echo "Un meuble fait de planches de bois cousues rempli de bocaux"
echo "Une glacière recouverte d'une couche d'isolant Un bruleur à gaz."
echo "C'est un espace pour cuisiner."
sleep 3
echo
echo "Vous avez soif. Un filtre à eau gravitationnel vous fait face"
echo "vous attraper un gobelet et le remplissez à raz bord du liquide de la bombone"
echo "Vous portez le verre à vos lèvres..."
echo
sleep 5
echo "A la première gorgée vous vous sentez ramolir. Comment savoir combien vous avez bu"
echo "quand votre corps devenu impossible à garder droit s'est éffondré sur le sol."
echo "Simplement le temps de vous demander pourquoi?"
echo
echo "Vous sombrez dans l'inconscience."
sleep 4
echo "VOUS VOUS SENTEZ DECOLLER."
echo
read -p "Appuyez sur [ENTER] pour revenir..."
./mainroom.sh
exit

57
adventure/rooms/kroo.sh Executable file
View File

@ -0,0 +1,57 @@
#!/bin/bash
clear
# This room gets a little artsy with sleep commands, to help with the
# narrative of the story. This is why there are two versions - foyer and foyer2.
# Initialise the Title Art
file1="../art/titleart.ben"
while IFS= read -r line
do
echo "$line"
done <"$file1"
echo
# It's script time again...
sleep 1
echo "Vous pénétrez à l'intérieur de l'Astroport."
echo
sleep 3
echo "Une voix synthétique vous accueille."
echo
echo "Vous parcourez l'espace du regard"
echo "Au nord, face à vous se trouve un foyer où brule un feu."
echo
sleep 3
echo "A l'ouest sont suspendus tuyaux, ustensiles et bocaux. Une cuisine?"
echo "A l'est il y a un genre de 'photomaton' "
sleep 2
echo "Derrière vous, la porte par où vous êtes entré est encore ouverte."
echo
echo "Que voulez vous faire?"
# And once again the room logic.
while true; do
read -p "> " nsewuh
case $nsewuh in
n ) echo "Vous vous asseyez sur le grand tapis devant le feu. Vous vous relaxez un instant."
./magic8.sh
;;
s ) ./bigroom.sh
exit ;;
e ) ./gameroom.sh
exit ;;
w ) ./grue.sh
exit ;;
u ) echo "Vous tapotez sur le barmoètre. Une photo satellite?"
./meteofrance.sh
exit
;;
h ) echo "La pièce est spacieuse. La chaleur du feu agréable, à gauche on dirait une cuisine explosée, à droite une chaise moletonnée fait face à un écran." ;;
* ) echo "Je suis désolé, je ne vous comprends pas. Les commandes sont : n, e, s, w, u et h..";;
esac
done
esac
exit

40
adventure/rooms/kroo2.sh Executable file
View File

@ -0,0 +1,40 @@
#!/bin/bash
clear
# Initialise the Title Art
file1="titleart.ben"
while IFS= read -r line
do
echo "$line"
done <"$file1"
echo
# So here's a little story all about how this script got flip-turned upside down...
sleep 1
echo "You're in a corridor, but it's quite a small one. You got here"
echo "the first time by hugging a statue of a kitten. Standard."
echo
echo "You see a glow coming from the rooms to your east and west, and"
echo "there's a big, old looking door to the south of you."
echo
echo "What would you like to do?"
# Imma let you finish, but here's the room choices.
while true; do
read -p "> " nsewuh
case $nsewuh in
n ) echo "You faceplant the wall. Idiot." ;;
s ) ./bigroom.sh
exit ;;
e ) ./gameroom.sh
exit ;;
w ) ./grue.sh
exit ;;
u ) echo "There's nothing you can use right here." ;;
h ) echo "After hugging that cat you aren't sure you should try to hug yourself again." ;;
* ) echo "I'm sorry, I don't understand you. Commands are: n, e, s, w, u and h.";;
esac
done
esac
exit

29
adventure/rooms/magic8.sh Executable file
View File

@ -0,0 +1,29 @@
#!/bin/bash
# magic 8 ball. Yup. Pick a random number, output message
# source: https://www.linuxjournal.com/content/bash-shell-games-lets-play-go-fish
answers=("Oui c'est certain." "C'est carrément ça."
"Sans aucun doute." "Oui - assurément."
"Comptez la dessus." "Comme je le vois, oui." "Très probablement."
"Bonne perspective." "Oui." "Les signes indiquent que oui."
"Réponse floue, essayez à nouveau." "Redemandez plus tard."
"Il vaut mieux ne pas vous le dire maintenant.." "Impossible de prédire maintenant."
"Concentrez-vous et demandez à nouveau." "N'y comptez pas."
"Ma réponse est non." "Mes sources disent que non."
"Rien de bon." "Très douteux.")
echo "Oh ! Boule magique, dis-moi la vérité, s'il te plaît...." ; echo ""
/bin/echo -n "Quelle est votre question ? "
read question
answer=$(( $RANDOM % 20 ))
echo ""
echo "J'ai regardé dans le futur et je dis: "
echo " ${answers[$answer]}" ; echo ""
sleep 3
./mainroom.sh
exit

45
adventure/rooms/mainroom.sh Executable file
View File

@ -0,0 +1,45 @@
#!/bin/bash
clear
# This is a repeat of the opening room in the start.sh file - if the player
# wants to go back to the main room, this saves going through the whole
# start script over again.
# Initialise the Title Art
file1="../art/titleart.ben"
while IFS= read -r line
do
echo "$line"
done <"$file1"
echo
# Shakesphere wrote this, honest.
sleep 1
echo "Vous êtes de retour à votre point de départ."
echo "La forêt qui vous entoure est immense."
echo "Vous ne pouvez pas vraiment en imaginer la taille,"
echo
echo "Vous pouvez vous diriger au nord, à l'est, au sud et à l'ouest."
echo
echo "Que voulez-vous faire ?"
# And the room logic once again.
while true; do
read -p "> " nsewuh
case $nsewuh in
n ) ./white.sh
exit ;;
s ) ./brown.sh
exit ;;
e ) ./red.sh
exit ;;
w ) ./green.sh
exit ;;
u ) echo "Il n'y a rien que vous puissiez utiliser ici." ;;
h ) echo "Vous observez votre montre, il est 20:12" ;;
* ) echo "Je suis désolé, je ne vous comprends pas. Les commandes sont : n, e, s, w, u et h..";;
esac
done
esac
exit

43
adventure/rooms/meteofrance.sh Executable file
View File

@ -0,0 +1,43 @@
#!/bin/bash
################################################################################
# Author: Fred (support@qo-op.com)
# Version: 0.1
# License: AGPL-3.0 (https://choosealicense.com/licenses/agpl-3.0/)
################################################################################
ts=$(date -u +%s%N | cut -b1-13)
################################################################################
# Capture la photographie satellite de la France
# https://fr.sat24.com/image?type=visual5HDComplete&region=fr
mkdir -p ~/..zen/game/meteo.anim.eu
rm -f ~/..zen/game/meteo.anim.eu/meteo.png
curl -m 20 --output ~/..zen/game/meteo.anim.eu/meteo.png https://s.w-x.co/staticmaps/wu/wu/satir1200_cur/europ/animate.png
if [[ ! -f ~/..zen/game/meteo.anim.eu/meteo.png ]]; then
echo "Impossible de vous connecter au service meteo"
exit 1
else
echo "NEED HTML TEMPLATING"
echo "Mise à jour archive points meteo : $ts"
echo $ts > ~/..zen/game/meteo.anim.eu/.ts
PSEUDO=$(cat ~/.zen/game/players/.current/.pseudo 2>/dev/null)
OLDID=$(cat ~/.zen/game/players/.current/.meteo.index 2>/dev/null)
sed s/_OLDID_/$OLDID/g ${MY_PATH}/../templates/meteo_chain.html > /tmp/index.html
sed -i s/_IPFSID_/$IPFSID/g /tmp/index.html
sed -i s/_DATE_/$(date -u "+%Y-%m-%d#%H:%M:%S")/g /tmp/index.html
sed s/_PSEUDO_/$PSEUDO/g /tmp/index.html > ~/.zen/game/players/.current/public/index.html
# Copy style css
cp -R ${MY_PATH}/../templates/styles ~/.zen/game/players/.current/public/
INDEXID=$(ipfs add -rHq ~/.zen/game/players/.current/public | tail -n 1)
echo $INDEXID > ~/.zen/game/players/.current/.meteo.index
echo "LAST VIDEO INDEX http://127.0.0.1:8080/ipfs/$INDEXID"
IPFS=$(ipfs add -Rw ~/..zen/game/meteo.anim.eu/)
echo $IPFS > ~/..zen/game/meteo.anim.eu/.chain
fi

41
adventure/rooms/red.sh Executable file
View File

@ -0,0 +1,41 @@
#!/bin/bash
clear
# Initialise the Title Art
file1="../art/titleart.ben"
while IFS= read -r line
do
echo "$line"
done <"$file1"
echo
# Set up the script for this room. It's a simple one!
sleep 1
echo "Vous entrez dans l'ancienne bergerie."
echo "Un canapé mauve est installé au milieu de l'espace"
echo "Une bache transparente vous sépare du ciel."
echo
echo "Vous êtes dans une serre."
echo "Une seule sortie. A l'Ouest, d'où vous venez."
echo
echo "Que voulez-vous faire?"
# And the choices go here.
while true; do
read -p "> " nsewuh
case $nsewuh in
n ) echo "Une fente dans le mur vous laisse observer une carcasse de voiture. Une vieille 2cv. Un grillage vous empêche de passer." ;;
s ) echo "L'emplacement d'un grand feu se trouve la. Il ne reste que de la cendre." ;;
e ) echo "Une autre pièce remplie de gravats et d'éboulis se trouve devant vous. Impossible d'y accéder." ;;
w ) ./mainroom.sh
exit ;;
u ) echo "Vous vous asseyez dans le canapé. Vous vous sentez immédiatement happé par un nuage."
sleep 2
xdg-open "https://www.copylaradio.com/blog/blog-1/post/le-pas-a-pas-qui-libere-du-grand-mechant-cloud-36#scrollTop=0"
;;
h ) echo "Aucun détail particulier si ce n'est une tache sur le sofa." ;;
* ) echo "Je suis désolé, je ne vous comprends pas. Les commandes sont : n, e, s, w, u et h..";;
esac
done
esac
exit

72
adventure/rooms/start.sh Executable file
View File

@ -0,0 +1,72 @@
#!/bin/bash
clear
# Logic in the game is stored in .ben files. This sample has just one 'logic' file.
# You can add more logic files by simply adding a 'sed' command and appropriate .ben file.
# First off, let us reset the game logic. Use this as an example.
sed -i='' 's/on/off/' ../logic/leverlogic.ben
# Who doen't love ASCII text, right?
# Next up, let's initialise the Title Art
file1="../art/titleart.ben"
while IFS= read -r line
do
echo "$line"
done <"$file1"
echo
# Next up, let's load in the initial introduction. Script is also stored in .ben files.
sleep 5
file2="../script/opening.ben"
while IFS= read -r line
do
echo "$line"
done <"$file2"
read -p "Pressez sur [ENTER] pour démarrer..."
#Okay, now that the introduction is out of the way, we can start the first room!
clear
file1="../art/titleart.ben"
while IFS= read -r line
do
echo "$line"
done <"$file1"
sleep 1
# Here's where you introduce the room to the player. Be sure to tell them if there
# Are exits - but don't give too much away. Make it fun for them to explore!
echo
echo "La téléportation vous a placé debout au centre d'une clairière."
echo "Vous vous trouvez près d'une ancienne bergerie aux gros murs de pierres."
echo "Le toit et une bonne partie des murs sont effondrés."
echo
echo "Tout autour la forêt. Des feuillus. Quelques arbustres épineux."
echo "Sous vos pieds. Le sol est rouge parsemé de cailloux blancs."
echo
echo "Vous pouvez vous diriger selon les points cardinaux."
echo "Au nord un chemin remonte, au sud un passage descend, à l'est, la bergerie, à l'ouest, une trace d'animaux"
echo
echo "Que voulez-vous faire? Les commandes sont : n, e, s, w, u et h."
# Now we wait for their response - and send them somewhere accordingly.
while true; do
read -p "> " nsewuh
case $nsewuh in
n ) ./white.sh
exit ;; # These lines will take the player to a new room - a new script file.
s ) ./brown.sh
exit ;; # Be sure to include 'exit' otherwise the game won't quit properly!
e ) ./red.sh
exit ;;
w ) ./green.sh
exit ;;
u ) echo "Vous ouvrez votre sac il contient une tente, des vêtements, un termos, une scie pliante et un couteau" ;; # Something to say? You can also just echo.
h ) echo "Comment avez-vous pu arriver ici.? Des souvenirs vous reviennent... https://oasis.astroport.com/a-quel-jeu-voulons-nous-jouer/" ;;
* ) echo "Je suis désolé, je ne vous comprends pas. Les commandes sont : n, e, s, w, u et h..";;
esac
done
esac
exit

62
adventure/rooms/white.sh Executable file
View File

@ -0,0 +1,62 @@
#!/bin/bash
clear
# Initialise the Title Art
file1="../art/titleart.ben"
while IFS= read -r line
do
echo "$line"
done <"$file1"
echo
#Setting up the room...
sleep 1
echo "Vous parcourez un chemin qui monte en direction du nord.."
echo "Au sommet de cette petite colline vous découvrez un magestueux chêne"
echo "trônant au centre d'une clairière lumineuse. La forêt à cet endroit"
echo "forme un cercle tout autour..."
echo
echo "Un Astroport fait de vitres, de planches, de tôles et de chevrons"
echo "est posé là. Eclairé par les rayons du soleil."
echo
# Here we're going to check to see if the lever - the only logic we are using in this game - is on or off.
leverstate=`cat ../logic/leverlogic.ben`
if [ "$leverstate" = "on" ]; then
echo "Une poignée est apparue sur la porte de la façade..."
else
echo "Vous en faites le tour..."
echo "Aucune entrée n'est visible."
fi
echo
echo "Pas d'autre chemin praticable que celui d'où vous venez."
echo
echo "Que voulez-vous faire ?"
# Now lets capture this room's actions. Note that here, the actions change depending on whether or not
# the lever is on or off. If it's on, you go elsewhere. If it's off, you don't.
while true; do
read -p "> " nsewuh
case $nsewuh in
n ) echo "Vous vous aventurez dans la forêt plus au nord. Sans boussole, vous allez vous perdre rapidement... " ;;
s ) ./mainroom.sh
exit ;;
e ) echo "Une corniche surplombe un ruisseau qui coule dans le fond de la ravine. Impossible de passer sans équipement" ;;
w ) echo "Vous voilà face à un Jardin luxuriant. Une cloture électrique le délimite et en empêche l'accès." ;;
h ) echo "Vous voyez à l'interieur de la Station une video en cours de projection..."
sleep 2
xdg-open "https://www.youtube.com/embed/Yk-WRXKysXM"
;;
u ) leverstate=`cat ../logic/leverlogic.ben`
if [ "$leverstate" = "on" ]; then
./kroo.sh
exit
else
echo "Vous cherchez une ouverture... Pas la moindre. Impossible d'entrer sans commettre une effraction..."
fi
;;
* ) echo "Je suis désolé, je ne vous comprends pas. Les commandes sont : n, e, s, w, u et h..";;
esac
done
esac
exit

23
adventure/script/opening.ben Executable file
View File

@ -0,0 +1,23 @@
Message de la Confédération Interplanétaire
La planète où vous vous trouvez est en danger. Les menaces sont nombreuses.
Vos gouvernements se disputent les dernières ressources. Le cycle du vivant est perturbé !
Le "contrat social" des 'pays civilisés' vascille. Les technocrates réclament plus de contrôle.
La commission extraterrestre est formelle. Vous êtes en danger.
Heureusement la monnaie libre a été découverte sur votre planète!
Elle s'utilise dans un jeu 'grandeur nature'. Astroport 20:12
Bienvenue dans l'aventure du changement de civilisation.
Les commandes pour vous déplacer et interagir sont
'n' aller au nord,
's' aller au sud,
'e' aller à l'est,
'w' aller à l'ouest,
'u' utiliser,
'h' observer plus en détail.
Ctrl-C pour quitter.
- - -