I look back at one of the first video games that I remember having fun playing: it was Lunar Lander created by Atari. Not only was it a game in the arcade which cost a shiny quarter per play, but it also ran on the TRS-80 computers in my schools computer lab which were free for me to use. I liked that deal especially as I was learning how to use BASIC programming to make the pixels move on the screen of those computers. For me, and many kids of my generation, computer games, very basic computer games, were our draw to computers. I poured through computer magazines which had listings of the BASIC code for games that I typed in, line after line. Debugging was going through the code again line-by-line until I found each of my typos. I then started on my own ideas: using a for/next loop, I was able to make a spaceship fly across the screen just like I saw the Kirk’s Enterprise accelerate to warp speed. I was hooked.
That’s how I started coding- that’s why I started my path in software at the age of 11 with games like Lunar Lander.
When I was sent an AdaFruit PyBadge by a colleague in December to experiment with, I immediately thought back about the games like Lunar Lander that inspired me as a young boy to start coding.
The Adafruit PyBadge is a mini $34.95 computer that you can code with MakeCode Arcade, CirciutPython, or Arduino. You write the code on a computer and download it to the device which has a small color screen, buttons, lights, sensors, and a speaker, and various connectors to enable all sorts of other circuitry. I immediately thought of Lunar Lander but I also heard about the NASA Perseverance mission to Mars that was underway and thought I might try to create something similar for the Perseverance mission by the time it lands on Mars on 2/18/2021.
Once I started researching the mission, I realized that it was way more complex than the lunar lander. My challenge was to make a game around the landing of this rover on Mars. Here are the steps:
- Capsule enters Mars atmosphere and decelerates with heat shield
- Capsule slows down with parachute
- Heat shield ejected
- Lander drops out of capsule and starts rockets
- Lander gets close to surface and lowers rover to ground with cables
- Lander flies off
- Rover starts it mission to explore Mars looking for signs of ancient life.
My mission was to create a game around that so I started building it with MakeCode Arcade, using the drag and drop interface to make something fun. MakeCode is a web-based programming environment for kids that can be used to program MineCraft, hardware devices like the BBC micro:bit, Lego Mindstorms and games. My first experience with MakeCode was to animate the BBC micro:bit on the bag I use for my journaling/art supplies, which I’ve shared on Thingiverse. MakeCode Arcade is a version of MakeCode that makes it easy to build games with sprites, animations, and interactivity. The beauty of MakeCode is that you can switch between the graphical block-based programming and the code view to see that they do the exact same thing – a great way to “graduate” to text-based coding.
I was able to get pretty far but I ran out of time as the actual Perseverance rover will land on Mars in two days. I’ve shared the source code so anyone could try it out and use it as a starting point for their own experimentation. The amazing part about the Perseverance mission is that the whole landing sequence will have to be done via computers without direct human controls, most likely with artificial intelligence, since the time it takes for radio signals to travel between Mars and the Earth is between 4.3 and 21 minutes.
The gameplay is this: once the lander is detached from the capsule, use the down arrow to slow the descent. Once close to the surface, press the A button to release the lander. The lander can then explore the surface of Mars by pressing the left and right button, pressing A again to send a pulse looking for water underground. That’s as far as I got with the time that I had. Anyone is free to tinker, modify, and adapt it, just please share with me what you do with it. I’d love to see where this goes.
I think that the possibilities for kids today to learn coding and build fun games that can be loaded onto a tiny computer is so cool. The block-based programming makes is so easy to learn the basic concepts of coding and creating fun games. I printed a basic case for the PyBadge with my 3D printer and here’s my Perseverance game playing on it.
What can your young coder create today?