Underground 2 Revived
Play Need for Speed: Underground 2 (2004) in Chrome and Firefox with WebGPU graphics, Web Audio, up to 120 fps widescreen, controller support, free roam and Online races with friends. Fan project, not
Cave: A short console text adventure from the early days, written to try out creating a text adventure with a save file: a cave, a chest, a hole, and three ways for it to end. Type SAVE at any choice
GamesPythonGitHub @Stephenson-SoftwareOnlineOwner unconfirmed
Have you tried it? One tap is enough. No sign-in needed.
Owners of public repositories under a personal GitHub account can sign in to verify ownership and manage the introduction themselves. No administrator approval is needed.
Sign in, generate a verification file, and commit it to this repository’s default branch within 30 minutes. Files on other branches or forks do not count. Then check the file below to manage the project without administrator approval. Keep the file to retain your access.
If needed, you will go to sign-in. After signing in, return here and press your chosen verification button again.
Run /nomorevibe verify in your project folder to verify ownership and manage the introduction yourself.
Verify in one minuteAsk about other verification options
Testing out text adventure creation and saving/loading.
Translation pending
Taken from the repository README
Loading the full README.
Read the full README ↗A short console text adventure, written to try out text adventure creation and saving/loading.
Python 3, standard library only. (It was written for Python 2 and ported to Python 3 when it was put in the browser.)
python3 maincode.py
The game may be started from any working directory; the save path is resolved relative to maincode.py itself.
Answers are typed at the > prompt; case and surrounding spaces do not matter (yes, YES and Yes are the same answer).
YES or NO — whether a save file exists, whether to enter the cave, and whether to open the chestDOWN or LEAVE — at the hole in the chestSAVE — at any decision after the opening question, to save progress and quitAny other answer ends the game with That wasn't an option!. A save made earlier is kept, so answering YES to the opening question next time resumes from it.
Ending input (Ctrl-D, or Ctrl-Z then Enter on Windows) or pressing Ctrl-C quits the game without saving.
Progress is written to savefile.txt beside maincode.py — the copy tracked in this repository. Typing SAVE records the name of the decision the player stopped at, and answering YES to the opening question resumes from it. Answering YES when that file is empty or absent is not an error; the game reports that no save was found and starts from the beginning. Whitespace around the saved decision name is ignored; any other contents, or a save file that can't be opened or isn't text, are reported as an unreadable save file, and answering NO starts a new game, which clears it. If the save file can't be written (for example, the game is in a read-only directory), a new game still starts with a warning that saving won't work, and typing SAVE reports that the game couldn't be saved instead of crashing. Because the file is tracked, playing the game leaves a modification in the working tree; git checkout -- savefile.txt discards it.
The tests in tests/ play the game with scripted answers and check every ending, saving and loading. They use only the standard library and save to a temporary file, so savefile.txt is left untouched:
python3 -m unittest discover -s tests -t .
The same game, unmodified, runs in a browser tab under tak's console runtime (Python via Pyodide): https://cave.play.danielstephenson.dev, listed with the rest at danielstephenson.dev/play. To build and serve it locally (needs tak installed):
python3 web/build_zip.py
python3 -c "from tak.web.serve import main; main(root='.', title='Cave')"
Pushes to master deploy it to arcade (.github/workflows/browser.yml).
Licensed under the Stephenson Software Non-Commercial License (Stephenson-NC). See LICENSE.