I couldn't leave well enough alone. All that analyzing and nitpicking of the original Space Lander made me wonder what it might be like if I had rewritten it. Almost 28 years later, here is the reborn version of Space Lander 2011.
I tried to stay true to the original, keeping most of the key graphics and game play elements intact. Beyond the code tweaks, however, I did fix a few issues such as the movement glitches. I added some new features as well. Overall, I think you'll find the program just as fast, but a lot more fun. Don't trust me? Well then, go give it a try. Just don't forget to come back!
Let's start with the obvious stuff, how the game plays. I overhauled most of the text positioning, but tried to keep most of the original text. I changed the controls to use the bottom characters instead of the top number keys. Movement now works, with the sides of the screen now acting as a back stop instead of wrapping around. The biggest change is that once you say you want to land, the landing pad is displayed first and you can now guide the craft onto it. Unlike before this gives you the opportunity to stick the landing, even if you didn't guess quite right. The program randomly places the landing pad, so you have a few more options as well. But, there is still a bit of guess work involved as you only have 10 moves to guide the space craft in. Fortunately, unlike the original, you are now provided three lives in order to rack up as many points before you crash your last space lander. All these changes make the game a bit more entertaining, without completely removing some of the original's frustration.
Beyond the cosmetic changes, you'll find Space Lander looks a lot different under the hood. Even if you don't know ZX81 BASIC, I added enough comments to make it fairly easy to read through. The game is now a giant loop, running through each landing until you run out of lives. I removed most of the redundant code where I could, although I did replicate the movement code given that optimizing it wouldn't have added much. I made judicious use of GOSUB routines to aid with program flow, but there are a few GOTO's due to the limitations of BASIC. I also removed most of the silent PAUSE commands and replacing them with text and a key press to continue. I did keep one of the pauses as I found it jarring to clear the screen and then immediately expect the player to move the craft to the landing pad. Adding the score and lives required adding some extra text as well. Overall, the code should be much more readable and concise.
The actual game play mechanics are tighter, while allowing the new game play elements to be added. For instance, the original 13 lines of code that allowed the player to move the space lander where reduced to 6. This was done while still adding in the new boundary checks. The landing sequence, which was 27 lines of code, is now only 19 including the new functionality. Size wise, the 2011 version is ~500 bytes bigger, not including the stack which is bigger in Space Lander 2011 due to being saved in 16K. But remember that there are now 16 lines of comments compared the original 3. Removing those, gets you within 100 bytes of the original. I'm also sure I could get this game to play in the ZX81's limited 2K of memory. Not bad given all improvements.
I have to admit, I'd forgotten how fun it was to program on the ZX81. Sure, it is a bit slow and renumbering can be a bear. But overall, the simplicity of BASIC is very appealing, especially next to the complexity of the languages available today. Given a few more hours, I could have continued tweaking the code, adding in additional effects and such. In the end though, the ability to crank out playable game in an evening is quite satisfying. That almost instant gratification is what I miss the most.
Until next time, enjoy!