When I first started programming, one of the games we would play on the old teletype machines was a simple moon lander game. The premise is you would use your thrusters to softly land on the moon. Moon Lander was my take of that program a few years later.
A trip down memory lane.
I actually enjoyed playing Moon Lander. The original game had a pretty simple design. It had three basic parameters: speed, fuel and thrust. You decide how much thrust to apply, and in turn how much fuel you burn. The original program was turn based, where each turn you would decide how much thrust to apply. The game would then print out your speed and fuel available. To be successful, you needed to watch your acceleration and make sure you didnt run out of fuel.
In my ZX81 version, it is somewhat similar. Your lunar models is accelerating towards the ground and the game prints the speed in the corner. If you can land with 1.2 or less speed, then you succeeded. The catch, you have to get to the landing spot. Unlike the older text only game, I tried to add a little arcade action. And it works.
Not so easy.
The game isnt the easiest, but that actually is a good thing. Loading it up to play it again, I was surprised how much fun it was. It didnt take too many attempts to land successfully, but that doesnt mean I was good yet. I did get into a rhythm at one point, landing multiple times in a row. Sadly, it didnt last. Im not complaining, though. That is what makes a game fun.
Now, the graphics arent as great. The game isnt slow, but does flicker a bit more than I prefer. There are a few graphical glitches as well, such as the landing pad being hard to see sometimes. But those dont detract from the overall game. Sure, it isnt perfect, but it isnt bad eitherespecially in the context of when it was written.
Some interesting code.
It is always fun looking back on my old code. I can usually tell how things changed as the program developed. Most of my programs use lines numbers that increment by ten. For example, 10, 20, 30, etc. In this case, there are a number of lines that are in between those. That is a clue that I added them as the program developed.
I usually have a plan in my head as I worked on the programs. Occasionally, those ideas arent fully baked. In this case, I could tell that I added some of the game elements afterwards. That seems to be the clearing of the screen between moves and printing the speed. The speed is pretty important as it helps give the player an indication how they are doing.
There are a couple of interesting things I hadnt seen in other programs of mine. The first is the the C$ variable. I used a
DIM to set it, which clears it with a space by default. Its actually a rather clever bit of code. Im surprised I didnt use it before.
In a similar vein, I used a
STR$ before printing the speed. The ZX81 uses floating point numbers which are notorious slow. The
STR$ command will convert a number into string like it would look if printed. This is a useful command, but not usually in this context. Im sure my thought was it would be faster or less jarring than just printing a number. Printing a number is pretty slow already, so I can understand why I was trying something new. In my testing, I dont see any difference. But was interesting to see the attempt.
There was some other code that was interesting to see. There is an F$ variable that is set and tested within the code. Im pretty sure that was meant to manage fuel, the other attribute of the original game. However, I didnt see anyplace where I actually adjust it. It must be one of those ideas that I started to work on, but just never implemented.
A lot of opportunity.
Although the game is a lot of fun, there is a lot of opportunity to improve the game as well. I really want to reduce the flickering. I have a couple of ideas of how to correct that. Part of that is removing that large array.
The other problem is the landing pad. It is hard to see sometimes. I found myself getting lost at times figuring out where the ends were. A simple fix is to use different characters that make it easier to identify the landing zone. That might not be realistic, but this is a game after all.
The biggest change, though, is to make the speed more visual and remove the number. This had two advantages: speeding it up, and making it easier to see what your speed is. At the same time, making the file work and also display it would add another element to the game.
The game surprised me, not expecting it to be that exciting. Given that, Ive already started work on the changes above. Ill share those next month. I also feel this would be a good game to convert to assembly as well. I think the speed would really improve the games flickering and maybe allow for some additional features. But that idea is for the future. Enjoy the game for now.