https://github.com/skx/lighthouse-of-doom Skip to content Sign up Sign up * Why GitHub? Features - + Mobile - + Actions - + Codespaces - + Packages - + Security - + Code review - + Project management - + Integrations - + GitHub Sponsors - + Customer stories- * Team * Enterprise * Explore + Explore GitHub - Learn and contribute + Topics - + Collections - + Trending - + Learning Lab - + Open source guides - Connect with others + The ReadME Project - + Events - + Community forum - + GitHub Education - + GitHub Stars program - * Marketplace * Pricing Plans - + Compare plans - + Contact Sales - + Education - [ ] [search-key] * # In this repository All GitHub | Jump to | * No suggested jump to results * # In this repository All GitHub | Jump to | * # In this user All GitHub | Jump to | * # In this repository All GitHub | Jump to | Sign in Sign up Sign up {{ message }} skx / lighthouse-of-doom * Sponsor Sponsor skx/lighthouse-of-doom * Notifications * Star 15 * Fork 0 A simple text-based adventure game 15 stars 0 forks Star Notifications * Code * Issues 3 * Pull requests 0 * Discussions * Actions * Security * Insights More * Code * Issues * Pull requests * Discussions * Actions * Security * Insights master Switch branches/tags [ ] Branches Tags Nothing to show {{ refName }} default View all branches Nothing to show {{ refName }} default View all tags 1 branch 3 tags Go to file Code Clone HTTPS GitHub CLI [https://github.com/s] Use Git or checkout with SVN using the web URL. [gh repo clone skx/li] Work fast with our official CLI. Learn more. * Open with GitHub Desktop * Download ZIP Launching GitHub Desktop If nothing happens, download GitHub Desktop and try again. Go back Launching GitHub Desktop If nothing happens, download GitHub Desktop and try again. Go back Launching Xcode If nothing happens, download Xcode and try again. Go back Launching Visual Studio If nothing happens, download the GitHub extension for Visual Studio and try again. Go back Latest commit @skx skx Rug-behaviour only triggers once ... 830b5fb Apr 26, 2021 Rug-behaviour only triggers once This prevents weirdness if a player gets the rug, drops it, then gets it again. 830b5fb Git stats * 70 commits Files Permalink Failed to load latest commit information. Type Name Latest commit message Commit time .github Added release-scripts Apr 26, 2021 .gitignore Support simple encryption Apr 26, 2021 Makefile Make clean works as expected Apr 26, 2021 README.md Document z80 changes Apr 26, 2021 encrypt.c Support simple encryption Apr 26, 2021 game.z80 Rug-behaviour only triggers once Apr 26, 2021 globals.h Added CLS, EXIT, and BYE commands Apr 25, 2021 handlers.c Added CLS, EXIT, and BYE commands Apr 25, 2021 inventory.c Minor cleanups Apr 24, 2021 items.c Minor cleanups Apr 24, 2021 main.c Removed hardcoded implementation of "EXAMINE" Apr 24, 2021 util.c Minor cleanups Apr 24, 2021 world.c Removed hardcoded implementation of "EXAMINE" Apr 24, 2021 View code The Lighthouse of Doom Plot C Implementation Building & Running It Z80 Implementation Changes Building & Running It Downloading It Bugs README.md The Lighthouse of Doom This repository contain a simple text-based adventure game, implemented twice: * C Implementation * Z80 Implementation My intention was to write a simple text-based adventure game to run under CP/M. Starting large projects in Z80 assembly language from scratch is a bit of a daunting prospect, so I decided to code a simple game in C to get the design right and to avoid getting stuck in too many low-level details. Plot * You're inside a lighthouse (trapped? doesn't really matter I guess). * You see a boat on the horizon, heading your way. * But "oh no!", the lighthouse is dark. + The boat will surely crash if you don't turn on the main light. The game is over, when you either fix the light, or find another solution. If you do not achieve victory within a turn-limit the boat runs aground, and death will consume you all. (It is a very big boat!) C Implementation The implementation is mostly concerned with creating the correct series of data-structures, which are essentially arrays of objects. Because if we can make the game table-based we simplify the coding that needs to be done - we don't need to write per-object handlers anywhere, we can just add pointers to tables/structures. The C implementation defines most of the important things in the file globals.h such as: * The structure to define a location. * The structure to define an object. The game-state itself is stored in a couple of global variables, there isn't too much state to care about: * The current location (i.e. index into location-table). * A list of any items you're carrying. * The number of turns you've taken. + Incremented by one each time you enter a command, be it recognized or not. * Whether you won/lost. Building & Running It Build the game by running make, and then run ./lighthouse If you get stuck you can see command by entering help. Z80 Implementation The Z80 implementation is based upon the C-implementation, with a few small changes. The implementation uses a simple set of structures: * A command-table to map input-commands to handlers. * An item-table to store details about each object in the game. * A person table to store telephone messages. Along the way I did realize that having fixed inventory slots made the coding more of a challenge, so I made the location of each object a property of the object itself. Changes * The Z80 version has more easter-eggs (Try typing "xyzzy" a few times). * There is no grue in this version. + It will come. * The Z80 version can be built with the text-strings, and game code, protected by simple XOR encryption + Stops you looking through the binary for hints. + Run make release to build the protected version, and make game to build a rare version. Building & Running It Ensure you have the pasmo assembler installed, then build the code by running make game, or make release. In either case the output will be a binary named lihouse.com which you should be able to run upon your system - or under a CP/M emulator. Downloading It If you look on our release page you can find the latest stable build. Transfer lihouse.com to your system, and run LIHOUSE to launch it. Bugs Report them as you see them :) Steve About A simple text-based adventure game Topics game z80 z80asm console-application cpm Resources Readme Releases 3 release-0.3 Latest Apr 26, 2021 + 2 releases Sponsor this project * * https://steve.fi/donate/ Learn more about GitHub Sponsors Packages 0 No packages published Languages * C 97.3% * Makefile 2.2% * Shell 0.5% * (c) 2021 GitHub, Inc. * Terms * Privacy * Security * Status * Docs * Contact GitHub * Pricing * API * Training * Blog * About You can't perform that action at this time. You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.