From 501ff072860f104dade1bdf639d2f28d87ec91a6 Mon Sep 17 00:00:00 2001 From: fred Date: Sat, 5 Mar 2022 02:16:41 +0100 Subject: [PATCH] Add adventure.sh text game to Astroport --- AddScenario.txt | 113 +++++++++++++++++++++++++++++++++++++++++++++++++++ add.scenario.sh | 5 --- adventure.sh | 35 ++++++++++++++++ art/bigfinish.ben | 9 ++++ art/supper.ben | 10 +++++ art/titleart.ben | 9 ++++ install.sh | 2 +- logic/leverlogic.ben | 1 + rooms/bigroom.sh | 56 +++++++++++++++++++++++++ rooms/brown.sh | 59 +++++++++++++++++++++++++++ rooms/end.sh | 89 ++++++++++++++++++++++++++++++++++++++++ rooms/gameroom.sh | 59 +++++++++++++++++++++++++++ rooms/green.sh | 38 +++++++++++++++++ rooms/grue.sh | 36 ++++++++++++++++ rooms/kroo.sh | 50 +++++++++++++++++++++++ rooms/kroo2.sh | 40 ++++++++++++++++++ rooms/mainroom.sh | 45 ++++++++++++++++++++ rooms/red.sh | 41 +++++++++++++++++++ rooms/start.sh | 72 ++++++++++++++++++++++++++++++++ rooms/white.sh | 63 ++++++++++++++++++++++++++++ script/opening.ben | 28 +++++++++++++ story.fr.txt | 13 ++++++ test/magic8.sh | 26 ++++++++++++ tools/VISA.new.sh | 57 +++++++++++++++++--------- 24 files changed, 931 insertions(+), 25 deletions(-) create mode 100644 AddScenario.txt delete mode 100644 add.scenario.sh create mode 100755 adventure.sh create mode 100755 art/bigfinish.ben create mode 100755 art/supper.ben create mode 100755 art/titleart.ben create mode 100755 logic/leverlogic.ben create mode 100755 rooms/bigroom.sh create mode 100755 rooms/brown.sh create mode 100755 rooms/end.sh create mode 100755 rooms/gameroom.sh create mode 100755 rooms/green.sh create mode 100755 rooms/grue.sh create mode 100755 rooms/kroo.sh create mode 100755 rooms/kroo2.sh create mode 100755 rooms/mainroom.sh create mode 100755 rooms/red.sh create mode 100755 rooms/start.sh create mode 100755 rooms/white.sh create mode 100755 script/opening.ben create mode 100755 test/magic8.sh diff --git a/AddScenario.txt b/AddScenario.txt new file mode 100644 index 00000000..447df87c --- /dev/null +++ b/AddScenario.txt @@ -0,0 +1,113 @@ +BashVenture - Adventure for Bash +================================= + +You are in a git repository. Code surrounds you. There are directories to the north, south, east, and west.
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:
+``` +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. +
Bash-ing? See what I did there? + +Comments, questions, suggestions? [Get in touch.](mailto:mail@bennunney.com). + diff --git a/add.scenario.sh b/add.scenario.sh deleted file mode 100644 index 5064008f..00000000 --- a/add.scenario.sh +++ /dev/null @@ -1,5 +0,0 @@ -# Add a new scenario branch to the interactive terraforming solutions -# Choose element type -# Choose enhancement -# Choose play / fork -# Record new branch diff --git a/adventure.sh b/adventure.sh new file mode 100755 index 00000000..cfacf97f --- /dev/null +++ b/adventure.sh @@ -0,0 +1,35 @@ +#!/bin/bash + +# This Launch script is based on 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 + +if [[ ! -d ~/.zen/game/rooms ]]; then +homefolder=$(pwd) +newgame="$HOME/.zen/game" + +mkdir -p $newgame + +cp -r rooms $newgame/rooms +cp -r art $newgame/art +cp -r script $newgame/script +cp -r logic $newgame/logic +fi + +echo "Chargement..." +echo +sleep 3 + +cd $newgame/rooms +./start.sh + +cd "$homefolder" +rm -r $newgame + +echo +exit diff --git a/art/bigfinish.ben b/art/bigfinish.ben new file mode 100755 index 00000000..8ca22cfc --- /dev/null +++ b/art/bigfinish.ben @@ -0,0 +1,9 @@ + _______ _ ______ _ + |__ __| | | ____| | | + | | | |__ ___ | |__ _ __ __| | + | | | '_ \ / _ \ | __| | '_ \ / _` | + | | | | | | __/ | |____| | | | (_| |_ + |_| |_| |_|\___| |______|_| |_|\__,_(_) + + + \ No newline at end of file diff --git a/art/supper.ben b/art/supper.ben new file mode 100755 index 00000000..e1806a8a --- /dev/null +++ b/art/supper.ben @@ -0,0 +1,10 @@ + _____ _ _ + / ____| (_) | | + | (___ _ _ _ __ _ __ _ __ _ ___ ___| | + \___ \| | | | '__| '_ \| '__| / __|/ _ \ | + ____) | |_| | | | |_) | | | \__ \ __/_| + |_____/ \__,_|_| | .__/|_| |_|___/\___(_) + | | + |_| + + \ No newline at end of file diff --git a/art/titleart.ben b/art/titleart.ben new file mode 100755 index 00000000..7d552079 --- /dev/null +++ b/art/titleart.ben @@ -0,0 +1,9 @@ + _ _ _ ____ ___ _ ____ + / \ ___| |_ _ __ ___ _ __ ___ _ __| |_ |___ \ / _ \ _ / |___ \ + / _ \ / __| __| '__/ _ \| '_ \ / _ \| '__| __| __) | | | | (_) | | __) | + / ___ \\__ \ |_| | | (_) | |_) | (_) | | | |_ / __/| |_| | _ | |/ __/ +/_/ \_\___/\__|_| \___/| .__/ \___/|_| \__| |_____|\___/ (_) |_|_____| + |_| + + --- Un JEu de terraformation de Planète Forêt Jardin --- + diff --git a/install.sh b/install.sh index d61bd941..7747331b 100755 --- a/install.sh +++ b/install.sh @@ -54,7 +54,7 @@ for i in git fail2ban inotify-tools curl net-tools libsodium* python3-dev python fi done -for i in build-essential tree fim qrencode jq bc gawk ffmpeg sqlite dnsutils v4l-utils vlc mp3info musl-dev openssl* cargo detox nmap httrack html2text ssmtp imagemagick ttf-mscorefonts-installer libcurl4-openssl-dev; do +for i in build-essential parallel tree fim qrencode jq bc gawk ffmpeg sqlite dnsutils v4l-utils vlc mp3info musl-dev openssl* cargo detox nmap httrack html2text ssmtp imagemagick ttf-mscorefonts-installer libcurl4-openssl-dev; do if [ $(dpkg-query -W -f='${Status}' $i 2>/dev/null | grep -c "ok installed") -eq 0 ]; then sudo apt install -y $i fi diff --git a/logic/leverlogic.ben b/logic/leverlogic.ben new file mode 100755 index 00000000..cfb931e4 --- /dev/null +++ b/logic/leverlogic.ben @@ -0,0 +1 @@ +off diff --git a/rooms/bigroom.sh b/rooms/bigroom.sh new file mode 100755 index 00000000..994e79ba --- /dev/null +++ b/rooms/bigroom.sh @@ -0,0 +1,56 @@ +#!/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 vous dirigez vers le mur ouest." +echo +sleep 3 +echo "Un long plan de travail se trouve devant vous. Sur le coté de nombreux bocaux" +echo "certain, eating a very elaborate looking dinner." +sleep 2 +echo "Weird." +echo +sleep 3 +echo "There appears to have been a place laid at the table for you." +echo +sleep 5 +echo "Suddenly nervous, you take a seat and look around at the other diners." +echo "Are these the people who summoned you here? You try to ask them, but" +echo "seem to be rendered more speechless than a test subject in a portal game." +echo +sleep 5 +echo +echo "A waiter brings out a tray and places it in front of you. Lifting the lid," +echo "you find a weird rainbow coloured pill in front of you. Very 'Martix', you think" +echo "to yourself. What does this mean? Are you supposed to take the pill?" +echo "Is this some kind of test? And who ARE these people?!" +echo +sleep 5 +echo +echo "What would you like to do?" + +while true; do + read -p "> " nsewuh + case $nsewuh in + n ) echo "You get up and look around. Not much over here." ;; + s ) echo "You take a look at the decor of the room. It's pretty nice." ;; + e ) echo "There's a curtain - but no window behind it. How odd." ;; + w ) echo "WHO ARE THESE PEOPLE?!" ;; + u ) ./end.sh + exit ;; + h ) echo "You hug the person next to you. He feels cold, and doesn't move." ;; + * ) echo "I'm sorry, I don't understand you. Commands are: n, e, s, w, u and h.";; + esac +done + +esac +exit diff --git a/rooms/brown.sh b/rooms/brown.sh new file mode 100755 index 00000000..f9c82ffa --- /dev/null +++ b/rooms/brown.sh @@ -0,0 +1,59 @@ +#!/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 "Le mot SCAN clignote sur l'écran..." + else + echo "La machine affiche l'heure qu'il est $(date +"%H:%M")" + 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 "L'écran fait défiler le texte 'VISA SVP'" + else + sed -i='' 's/off/on/' ../logic/leverlogic.ben + echo "Vous touchez le clavier. L'écran se met à clignoter... " + fi + ;; + h ) echo "Le terminal est réalisé avec un mini ordinateur Raspberry Pi. Il porte un logo - MadeInZion - 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 diff --git a/rooms/end.sh b/rooms/end.sh new file mode 100755 index 00000000..aea230e0 --- /dev/null +++ b/rooms/end.sh @@ -0,0 +1,89 @@ +#!/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 "You swallow the pill, and suddenly rainbows are all around you." +echo +sleep 4 +echo "You look down to find that you're riding a unicorn. On a rainbow." +sleep 3 +echo +echo "A motherfucking UNICORN." +sleep 4 +echo +echo "This is ridiculous. Surely this is some kind of dream? You pinch" +echo "yourself to try and wake up. Wait, you're feeling dizzy..." +echo +sleep 5 +echo "You blink, and are surprised to find yourself laying in bed." +echo "You check your phone - it's 5am, and definitely Thursday. Huh." +echo "I guess it was all a dream." +echo +sleep 7 +echo "You go to get out of bed and suddenly spot a tiny marbel figurine on" +echo "your bedside table. It's a beautifully carved kitten." +echo +sleep 5 +echo "How the hell did that get there?" +sleep 5 +echo +echo "Unable to work out what is dream and what is reality, you shrug your" +echo "shoulders and pick up the figurine. It hasn't transported you anywhere" +echo "this time... but how did it get here? What does it mean?" +echo +sleep 7 +echo "Your phone buzzes. It's a call from a withheld number. You don't usually" +echo "answer those, but you get the feeling that this call might be important." +sleep 5 +echo +echo "You answer the call, and an electronic voice says five words to you" +echo "before the line goes dead." +sleep 3 +echo +echo "Just five words." +sleep 7 +echo +echo "THE KITTEN IS WATCHING YOU." +echo +sleep 9 +echo +file1="../art/bigfinish.ben" +while IFS= read -r line +do + echo "$line" +done <"$file1" +echo +echo +read -p "Press [ENTER] to exit..." +echo +clear +file1="../art/titleart.ben" +while IFS= read -r line +do + echo "$line" +done <"$file1" +echo +echo "Thank you for playing the demo of BashVenture. Pretty random storyline, I know," +echo "but the aim was to show off the functionality, not win a pulitzer prize." +echo +echo "Whoever you are, wherever you're from - live long and prosper. Keep smiling!" +echo +echo " - @BenNunney" +echo + +# That's all, folks! + +exit \ No newline at end of file diff --git a/rooms/gameroom.sh b/rooms/gameroom.sh new file mode 100755 index 00000000..0046ac92 --- /dev/null +++ b/rooms/gameroom.sh @@ -0,0 +1,59 @@ +#!/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 "Un tout petit ordinateur" +echo "sat on a desk in the middle of it. Is that... YES!" +echo "Steam is installed, and it looks like the entire library of" +echo "games is installed! This is one epic gaming rig." +echo +echo "The only way out is east, back the way you came... but..." +echo "shiny. Maybe it'd be rude NOT to sit down and game a little." +echo +echo "What would you like to do?" + +while true; do + read -p "> " nsewuh + case $nsewuh in + n ) echo "WALL EQUALS TRUE." ;; + s ) echo "Nope. Wall." ;; + w ) ./kroo2.sh + exit ;; + e ) echo "You were going to go east, then you took a wall to the face." ;; + u ) echo + echo "You sit and game. And game. And game. You forget about time," + echo "and food, and people. You realise that you cannot get up. You can't" + echo "move. You are stuck to the chair." + echo + sleep 4 + echo "Days go by. Weeks. You've played game after game, but..." + echo + echo "Your body is giving up. With your final breath you come to realise that" + echo "you cannot live on gamerpoints alone. You close your eyes for the last time." + sleep 4 + echo + echo + echo "YOU ARE DEAD." + echo + read -p "Press [ENTER] to try again..." + ./mainroom.sh + exit + + ;; + h ) echo "You hug the computer. Nerd." ;; + * ) echo "I'm sorry, I don't understand you. Commands are: n, e, s, w, u and h.";; + esac +done + +esac +exit diff --git a/rooms/green.sh b/rooms/green.sh new file mode 100755 index 00000000..d3e56110 --- /dev/null +++ b/rooms/green.sh @@ -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 diff --git a/rooms/grue.sh b/rooms/grue.sh new file mode 100755 index 00000000..b5d5e059 --- /dev/null +++ b/rooms/grue.sh @@ -0,0 +1,36 @@ +#!/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 "This is a long room, and ask you walk down it, you see a person." +echo "Finally! Another person! You start to run toward the shadowy figure" +echo "but then stop dead. This isn't... no... it can't be. It's... it's..." +echo "IT'S A GRUE." +sleep 3 +echo +echo "No. NO! You cry, as he sits you down and, rather than beating you to" +echo "death, starts to read you some of his Grue Poetry. It's awful. Your" +echo "brain starts to melt and, as a result, your nose starts bleeding." +echo +sleep 5 +echo "You start to feel dizzy. You can't think straight. As you fall to the" + echo "floor, your own blood and brains all around you, you begin" + echo "to wonder why the grue didn't just kill you quickly like" + echo "most do. Bloody liberal arts students." + echo + echo "You slip into unconciousness." + sleep 4 + echo "YOU ARE DEAD." + echo + read -p "Press [ENTER] to try again..." + ./mainroom.sh + +exit \ No newline at end of file diff --git a/rooms/kroo.sh b/rooms/kroo.sh new file mode 100755 index 00000000..afe60009 --- /dev/null +++ b/rooms/kroo.sh @@ -0,0 +1,50 @@ +#!/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 bon feu." +echo +echo "A l'Ouest se trouve un mur où sont suspendus tuyaux, ustensiles et bocaux" +echo "Un écran et clavier d'ordinateur se situent à l'Est" +echo "Derrière vous, la porte par où vous êtes entré est toujours 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. Le feu est envoutant. Vous vous relaxez un instant." ;; + s ) ./bigroom.sh + exit ;; + e ) ./gameroom.sh + exit ;; + w ) ./grue.sh + exit ;; + u ) echo "Choisissez une zone vers où vous diriger dans la pièce pour pouvoir agir." ;; + h ) echo "La chaleur est agréable. Sur votre gauche une cuisine, à votre droite un salon" ;; + * ) echo "Je suis désolé, je ne vous comprends pas. Les commandes sont : n, e, s, w, u et h..";; + esac +done + +esac +exit diff --git a/rooms/kroo2.sh b/rooms/kroo2.sh new file mode 100755 index 00000000..ebdb5e36 --- /dev/null +++ b/rooms/kroo2.sh @@ -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 \ No newline at end of file diff --git a/rooms/mainroom.sh b/rooms/mainroom.sh new file mode 100755 index 00000000..d8b4d8a4 --- /dev/null +++ b/rooms/mainroom.sh @@ -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 diff --git a/rooms/red.sh b/rooms/red.sh new file mode 100755 index 00000000..d7d84245 --- /dev/null +++ b/rooms/red.sh @@ -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 diff --git a/rooms/start.sh b/rooms/start.sh new file mode 100755 index 00000000..c7924571 --- /dev/null +++ b/rooms/start.sh @@ -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 près d'une batisse en ruine." +echo "C'est une ancienne grange faites de gros murs de pierre." +echo "Le toit et une partie des murs sont effondrés." +echo +echo "Vous disposez d'un sac à dos et d'une bouteille isotherme." +echo "Le soleil est déjà haut dans le ciel." +echo +echo "Vous pouvez vous diriger selon les points cardinaux." +echo "Nord, Sud, Est, Ouest." +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 et des vêtements chauds." ;; # Something to say? You can also just echo. + h ) echo "Vous vous souvenez..." ;; + * ) echo "Je suis désolé, je ne vous comprends pas. Les commandes sont : n, e, s, w, u et h..";; + esac +done + +esac +exit diff --git a/rooms/white.sh b/rooms/white.sh new file mode 100755 index 00000000..b8adf406 --- /dev/null +++ b/rooms/white.sh @@ -0,0 +1,63 @@ +#!/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 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 porte sur la façade est entrouverte. Vous devriez entrer..." + 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 vous perdez rapidement... " + exit ;; + s ) ./mainroom.sh + exit ;; + e ) echo "Vous arrivez le long d'une corniche qui surplombe un ruisseau qui coule dans le fond de la ravine. Impossible de passer" ;; + w ) echo "Vous voilà face à un Jardin luxuriant. Une cloture électrique en délimite et empêche l'accès." ;; + h ) echo "Vous apercevez à l'interieur 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 essayez de trouver une ouverture... Impossible d'entrer." + 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 diff --git a/script/opening.ben b/script/opening.ben new file mode 100755 index 00000000..946eca84 --- /dev/null +++ b/script/opening.ben @@ -0,0 +1,28 @@ +La planète où vous vous trouvez est en danger. +La 5 ème extinction de masse du vivant est en cours! +Les gouvernements de ce monde se disputent ses dernières ressources. + +Le "contrat social" de votre pays n'est plus en mesure de garantir sécurité et bonheur? +La commission extraterrestre est formelle. Votre vie est en danger. + +Vous pouvez changer cela. +La confédération interplanétaire diffuse ce programme à destination des terrestres extraordinaires. + +Plus que l'argent, l'art des gens mis en oeuvre crée la valeur de votre monde. + +Ete-vous prêt à découvrir ce monde parallèle? +Optenez votre visa MadeInZion. Démarrez le JEu. + +Vos commandes pour se déplacer et interagir sont +'n' aller au nord, +'s' aller au sud, +'e' aller à l'est, +'w' aller à l'ouest, +'u' utiliser un objet, +'h' observer plus en détail. + +Ctrl-C pour quitter. + + - - - +L'équipe des terraformeurs vous attend. + - - - diff --git a/story.fr.txt b/story.fr.txt index ae60a37e..e0f24fd4 100644 --- a/story.fr.txt +++ b/story.fr.txt @@ -15,3 +15,16 @@ Ainsi vous disposerez d'une grande variété de choix pour créer votre Astropor Le climat de votre région est le premier critère. Choisir les bons matériaux, les bonnes techniques, apporter le plus de bénéfice pour un cout minimal. +Climat tempéré +* Construisez dans une zone bien exposé au soleil durant l'hiver +* Isolez bien votre sol, toit et murs pour garder la chaleur +* Installez de larges fenètres au sud et de petites au nord + + +Maison passive +Jardin sol vivant +Eau chaude + +Puit canadien +Compost Papin +Mur en canettes diff --git a/test/magic8.sh b/test/magic8.sh new file mode 100755 index 00000000..d8a12ae7 --- /dev/null +++ b/test/magic8.sh @@ -0,0 +1,26 @@ +#!/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 "" + +exit 0 diff --git a/tools/VISA.new.sh b/tools/VISA.new.sh index 05fdc34c..3e9f42ba 100755 --- a/tools/VISA.new.sh +++ b/tools/VISA.new.sh @@ -11,6 +11,11 @@ MadeInZion DIPLOMATIC PASSPORT ============================================= A cryptographic key pair to control your P2P Digital Life. Solar Punk garden forest terraforming game. + +Création de votre PSEUDO, votre PLAYER, votre PASS (diceware) : vos identifiants du JEu +Création de votre SALT PEPPER : votre compte Gchange et portefeuille June. +Création de votre clef DUNITER : votre clef d'accès Cesium ( 100 LOVE <=> 1 DU ) +Création de votre clef IPNS : votre balise de publication dans le réseau IPFS " ################################################################################ MY_PATH="`dirname \"$0\"`" # relative @@ -23,7 +28,8 @@ SALT=$(${MY_PATH}/diceware.sh 4 | xargs) PEPPER=$(${MY_PATH}/diceware.sh 4 | xargs) [[ $1 != "quiet" ]] && echo "-> PEPPER : $PEPPER" -[[ $1 != "quiet" ]] && echo "ENTREZ UN PSEUDO" && read PSEUDO +[[ $1 != "quiet" ]] && echo "CHOISISSEZ UN PSEUDO" && read PSEUDO +PSEUDO=${PSEUDO,,} #lowercase PLAYER=$(${MY_PATH}/diceware.sh 1 | xargs)${RANDOM:0:2}$(${MY_PATH}/diceware.sh 1 | xargs)${RANDOM:0:2} [[ ! $PSEUDO ]] && PSEUDO=$PLAYER [[ $1 != "quiet" ]] && echo "-> $PSEUDO : $PLAYER" @@ -44,32 +50,44 @@ echo "$PLAYER" > ~/.zen/game/players/$PSEUDO/.player echo "$SALT" > ~/.zen/game/players/$PSEUDO/login.june echo "$PEPPER" >> ~/.zen/game/players/$PSEUDO/login.june +[[ $1 != "quiet" ]] && echo "Rendez-vous sur https://gchange.fr +Utilisez ces identifiants pour rejoindre le réseau JUNE + $SALT + $PEPPER +" G1PUB=$(python3 ${MY_PATH}/key_create_dunikey.py "$SALT" "$PEPPER") -mv /tmp/secret.dunikey ~/.zen/game/players/$PSEUDO/ -qrencode -s 6 -o $HOME/.zen/game/players/$PSEUDO/QR.png "$G1PUB" +[[ ! $G1PUB ]]; then + [[ $1 != "quiet" ]] && echo "Désolé. Nous n'avons pas pu générer votre clef Cesium automatiquement." +else + mv /tmp/secret.dunikey ~/.zen/game/players/$PSEUDO/ + qrencode -s 6 -o $HOME/.zen/game/players/$PSEUDO/QR.png "$G1PUB" -secFromDunikey=$(cat ~/.zen/game/players/$PSEUDO/secret.dunikey | grep "sec" | cut -d ' ' -f2) -echo "$secFromDunikey" > /tmp/${PSEUDO}.sec -openssl enc -aes-256-cbc -salt -in /tmp/${PSEUDO}.sec -out "/tmp/enc.${PSEUDO}.sec" -k $PASS 2>/dev/null -PASsec=$(cat /tmp/enc.${PSEUDO}.sec | base58) && rm -f /tmp/${PSEUDO}.sec -qrencode -s 6 -o $HOME/.zen/game/players/$PSEUDO/QRsec.png $PASsec + secFromDunikey=$(cat ~/.zen/game/players/$PSEUDO/secret.dunikey | grep "sec" | cut -d ' ' -f2) + echo "$secFromDunikey" > /tmp/${PSEUDO}.sec + openssl enc -aes-256-cbc -salt -in /tmp/${PSEUDO}.sec -out "/tmp/enc.${PSEUDO}.sec" -k $PASS 2>/dev/null + PASsec=$(cat /tmp/enc.${PSEUDO}.sec | base58) && rm -f /tmp/${PSEUDO}.sec + qrencode -s 6 -o $HOME/.zen/game/players/$PSEUDO/QRsec.png $PASsec -[[ $1 != "quiet" ]] && echo "-> G1PUB QRCODE : $G1PUB" -[[ $1 != "quiet" ]] && echo "SEC $secFromDunikey" + [[ $1 != "quiet" ]] && echo "-> G1PUB QRCODE : $G1PUB" + [[ $1 != "quiet" ]] && echo "SEC $secFromDunikey" +fi + +[[ $1 != "quiet" ]] && echo "Rendez-vous sur https://cesium.app et utilisez les mêmes identifiants pour accéder à votre portefeuille JUNE" cp $HOME/.ipfs/keystore/$KEYFILE ~/.zen/game/players/$PSEUDO/ -qrencode -s 6 -o "$HOME/.zen/game/players/$PSEUDO/IPNS.png" "/ipns/$IPNS" +qrencode -s 6 -o "$HOME/.zen/game/players/$PSEUDO/IPNS.png" "http://localhost:8080/ipns/$IPNS" -[[ $1 != "quiet" ]] && echo "PLAYER LOCAL REPOSITORY ~/.zen/game/players/$PSEUDO/" +[[ $1 != "quiet" ]] && echo "*** Espace Interplanétaire Activé : ~/.zen/game/players/$PSEUDO/" +[[ $1 != "quiet" ]] && echo "*** Création de votre balise IPNS : http://localhost:8080/ipns/$IPNS" # PASS CRYPTING KEY openssl enc -aes-256-cbc -salt -in "$HOME/.zen/game/players/$PSEUDO/login.june" -out "$HOME/.zen/game/players/$PSEUDO/enc.login.june" -k $PASS 2>/dev/null openssl enc -aes-256-cbc -salt -in "$HOME/.zen/game/players/$PSEUDO/secret.dunikey" -out "$HOME/.zen/game/players/$PSEUDO/enc.secret.dunikey" -k $PASS 2>/dev/null openssl enc -aes-256-cbc -salt -in "$HOME/.zen/game/players/$PSEUDO/$KEYFILE -out" "$HOME/.zen/game/players/$PSEUDO/enc.$KEYFILE" -k $PASS 2>/dev/null -## MORE SECURE ?! USE opengpg +## TODO MORE SECURE ?! USE opengpg, natools, etc ... +# ${MY_PATH}/natools.py encrypt -p $G1PUB -i ~/.zen/game/players/$PSEUDO/secret.dunikey -o "$HOME/.zen/game/players/$PSEUDO/secret.dunikey.oasis" -G1PUB=$(cat ~/.zen/game/players/$PSEUDO/secret.dunikey | grep 'pub:' | cut -d ' ' -f 2) -${MY_PATH}/natools.py encrypt -p $G1PUB -i ~/.zen/game/players/$PSEUDO/secret.dunikey -o "$HOME/.zen/game/players/$PSEUDO/secret.dunikey.oasis" +[[ $1 != "quiet" ]] && echo "Sécurisation de vos clefs par chiffrage SSL... $PASS" ################################################# # !!!! # DEV MODE. REMOVE FOR PRODUCTION STATION FORGET PASS @@ -84,11 +102,12 @@ ln -s ~/.zen/game/players/$PSEUDO ~/.zen/game/players/.current rm -f ~/.zen/game/players/$PSEUDO/$KEYFILE rm -f ~/.zen/game/players/$PSEUDO/secret.dunikey -[[ $1 != "quiet" ]] && echo "____MANUAL REMOVAL COMMANDS____" +[[ $1 != "quiet" ]] && echo "_____DEBUG PLAYER REMOVE COMMANDS____" [[ $1 != "quiet" ]] && echo "rm -Rf ~/.zen/game/players/$PSEUDO" -[[ $1 != "quiet" ]] && echo "ipfs key rm $PSEUDO > /dev/null" -[[ $1 != "quiet" ]] && ls -a ~/.zen/game/players/$PSEUDO +[[ $1 != "quiet" ]] && echo "ipfs key rm $PLAYER > /dev/null" +[[ $1 != "quiet" ]] && echo "_____DEBUG PLAYER REMOVE COMMANDS____" -[[ $1 == "quiet" ]] && echo "$PSEUDO" +[[ $1 != "quiet" ]] && ls -al ~/.zen/game/players/$PSEUDO +[[ $1 == "quiet" ]] && echo "$PSEUDO = $PLAYER" exit 0