From a8116f42ea6b364c9c63c0a18e37fa90df5fbe4e Mon Sep 17 00:00:00 2001 From: Cat Flynn Date: Sun, 9 Feb 2025 15:44:54 +0000 Subject: [PATCH] feat: initial commit --- crash.md | 30 +++++++++ game.sh | 186 ++++++++++++++++++++++++++++++++++++++++++++++++++++ sketches.md | 26 ++++++++ 3 files changed, 242 insertions(+) create mode 100644 crash.md create mode 100755 game.sh create mode 100644 sketches.md diff --git a/crash.md b/crash.md new file mode 100644 index 0000000..3cbcc4a --- /dev/null +++ b/crash.md @@ -0,0 +1,30 @@ +mushroom martians + + +``` + ___________ + / \ +/ \ +| \|/ | +| --o-- | +| /|\ | +\ / + \___________/ +``` + + +CRASH! rocks fall and bounce with a sickening scratch on metal. the roar of the landing jets is briefly drowned out, but they keep the dust blown clear and maybe divert some of the lesser shrapnel. after a few seconds they can be heard again, but fade as the descent stage lists to the side and accelerates away to crash at a safe distance. a couple of small cracks and scrapes are heard as the debris settles, before silence takes hold again. noon sunlight illuminates the dust in the atmosphere, illuminating a circular patch in an otherwise lightless void. + +``` + ___________ + / \ +/ \ +| \|| +| --o| +| /|| +\ / + \___________/ +``` + +it's mid-afternoon when the next sound is heard, and the patch has shifted. a mechanical whirring begins low, and spools up to a steady whine, before stopping suddenly. after a few seconds, it repeats, then again, for a total of six times. the dust has completely settled now; the air is clear, the shadows sharp. at the edge of the patch, and the centre of the debris field, an angular metal assemblage begins to unfold. dust obscures detail upon it. a cylindrical stalk lifts away from the top surface, and a brilliant white patch is exposed, having been protected from the dust on impact. the stalk folds up until it is vertical, whereupon it clicks into place, locked. an oblong shape at its tip swivels a fraction in each axis, up and down, left and right stopping between each as if distracted. the patch shifts further, and the stalk and its box are cast into a dull red shadow. + diff --git a/game.sh b/game.sh new file mode 100755 index 0000000..c308bd9 --- /dev/null +++ b/game.sh @@ -0,0 +1,186 @@ +#!/usr/bin/env bash + +# find mushroom +# break wheel +# examine rock +# deplete power +# reset to beginning +# print status: battery +# print status: wheels +# generate a map of where we have been + +playintro=0 + +# $1 message +echowait () { + echo $1 + read -s -n 1 +} + +intro () { + echowait "CRASH!!!" + echowait "ah!!" + echowait "..." + echowait "...uh oh. hmm. uh. huh. hmmmm." + echowait "i appear to have fallen through the surface..." + echowait "...into some kind of tunnel?" + echo "" +} + +[ $playintro -eq 1 ] && intro + +maxbattery=10 + +depletebattery () { + battery=$((battery-1)) +} + +# position id +# start roughly in the middle +# vertical movement +/- battery +# horizontal movement +/- 1 +# this setup allows for different "cells" of different values which can be hashed for fun and profit +# without actually needing to do any 2d math or *shudder* collision detection +# making the number of columns equal to double the battery means that we can never reach the edge of the map +posid=200 # (2*maxbattery)^2/2 + +# $1 direction +# north, east, south or west +move () { + echo "you move $1" + depletebattery + + case $1 in + "north") + posid=$((posid-maxbattery*2)) + ;; + "east") + posid=$((posid+1)) + ;; + "south") + posid=$((posid+maxbattery*2)) + ;; + "west") + posid=$((posid-1)) + ;; + esac + + checkhazard +} + +# TODO: generate a map +# TODO: put hazards on the map +# 80 random cells out of ~400 (calculated from maxbattery^2) +hazards=($(shuf -i 0-400 -n 120)) +#echo "${hazards[@]}" +# split the hazard cells proportionally into sand traps and hard rocks + +checkhazard () { + # are we in a hazard cell? + for hazard in "${hazards[@]}"; do + [ $posid -ne $hazard ] && continue + + echowait "you got stuck in sand!" + echowait "expended extra energy to escape" + depletebattery + + # hard rocks break wheels + done +} + +# is there something to find upon examination? +mushrooms=($(shuf -i 0-400 -n 200)) + +# inentory should be persistent between runs +inventory=0 + +examine () { + # are we in a hazard cell? + for mushroom in "${hazards[@]}"; do + [ $posid -ne $mushroom ] && continue + + echowait "there's something growing here! found a mushroom, yay!!!" + + inventory=$((inventory+1)) + done +} + +# lightning mushrooms +# round mushrooms + +run=0 +while [ 1 ] +do + run=$((run+1)) + echo "day $run" + echo "...awake and fully charged!" + + if [ $run -eq 2 ] + then + echowait "...waht?" + echowait "i was down in the tunnel and my batteries died..." + echowait "how did i get back?" + echo + # we need to make this visually distinct so it's not confusing... + echowait "i can help with that!" + echo + echowait "AHHHHHHH" + echo + echowait "whoa there! its ok!" + echowait "i saw ya down there in the depths and figured" + echowait "you's prolly what made this here light-hole." + echowait "figured you came from up there so maybe you's a light-thing!" + echo + echowait "you're a... you're a..." + echo + echowait "brave n mighty rescuer, yup. that's me. name's splork, nice to meet ya!" + echo + echowait "..." + fi + + + # we have access to the shop after the first run. + if [ $run -gt 1 ] + then + echowait "well heya there my rovy pal! what can i do ya for?" + + gum confirm "sell 3 mushrooms for +1 battery?" + if [[ $? -eq 0 ]] # compare last exit code + then + if [ $inventory -lt 3 ] + then + echowait "oooo, sorry, you need 3 mushrooms for that!" + else + inventory=$((inventory-3)) + maxbattery=$((maxbattery+1)) + fi + fi + fi + + battery=$maxbattery + + while [ $battery -gt 0 ] + do + # print debug status + #echo "pos: $posid battery: $battery" + + # print status + echo "battery: $battery mushrooms: $inventory" + + case $(gum choose "move" "examine" "exit") in + "exit") + gum confirm && exit 1 + ;; + + "examine") + echowait "you look around and see many interesting things!" + depletebattery + ;; + "move") + move $(gum choose "north" "east" "south" "west") + esac + done + + echowait "my battery is low and it's getting dark ;-;" + +done diff --git a/sketches.md b/sketches.md new file mode 100644 index 0000000..47a4af5 --- /dev/null +++ b/sketches.md @@ -0,0 +1,26 @@ +# bash sketches + +I love making games but i find the friction to starting and subsequently working on projects to be high. friction could be from: + +* game engines icky +* no art assets +* boilerplate boilerplate boilerplate + +this hampers my ability to complete things, even if those things are tiny prototypes. really i would like to be able to jump into any project at any time. i want to minimise the time and energy it takes from having an idea to getting feedback as to whether its any good, even if that first feedback is just to myself. + +at the moment i am spending a lot of time in the terminal making graphs with python and matplotlib. i am also compiling essays with pandoc. i am used to working in the shell to build useful things quickly, so i wonder, how useful might the shell be for making a slightly-more-than-paper game prototype? + +i will try to explore an idea as quickly as i can using charmbracelet/gum to give myself some nice interactive input. + +i am hoping this approach will help me to identify the key components of the design quickly. + +* movement +* hazard placement +* battery +* story +* progression + +at this early sketch stage being able to shift my attention from one component to another is crucial to hammer out the vibe. i can move from hazard probabalities and progression to writing a script in the space of a few lines. + +i've made pseudo-cells to avoid having to write any actual 2d logic, as well as stay away from anything actually graphical. thre are a few art styles that could work, and don't want to start down the path of one now - better to stay high level, we can work out the specifics of space and time later. +