Space Invaders and the world of 1’s and 0’s

After leaving South Africa in the late 70’s I worked in London for one of the “big 8” accounting firms, now called the “big 4”.  I remember a multi-day training event where in the evenings we drank a lot of beer, socialized and I discovered the addictive Space Invaders arcade video game which was housed in a large console.  As the commander of the only remaining space ship I had to dodge from side to side to evade incoming missiles and simultaneously destroy the horde of menacing invaders which moved across the screen left to right and lower and lower, and faster and faster all the while to a heart thumping hypnotizing background sound.

I have now completed a 16 week embedded systems IoT (Internet of Things) course with University of Texas, Austin, which was excellent, and one of the last projects was to write the software for Space Invaders and build the hardware. 

inputs and outputs

Above are the inputs and outputs.  The inputs are the slidepot (bottom left) which moves the defender ship horizontally across the screen and the 2 red buttons which are the fire buttons – one fires vertical take off missiles, the other 2 diagonally veering missiles. 

The outputs are the speaker which transmits battle sounds, the LCD screen which shows the field of combat with invaders moving across the sky lower and lower and exchange of missiles and explosions; and 2 signal lights – the green shows success, the red shows failure.

this Cortex TM4C microcontroller is the brains behind the scenes.  we used this powerful device throughout the course

My game software is relatively simple – I do not have levels to attain and the enemy does not move faster as the game progresses.  If my space ship is destroyed then I lose, if the enemy invaders or “sprites” are destroyed first, then I win.  Here is a YouTube video of my software in action –

We used to inhabit an analog world where even our record players and film cameras were analog with the film directly capturing the nuances of the image, and the groove in the record directly transmitting to the pickup stylus the recorded sounds of voice and music.  Now the digital world of 1’s and 0’s intermediates – sound is converted to binary digital sound and images to digital images.  And when we hear the sound through a speaker or headphone it has been converted back to analog sound. 

In the Space Invader game, ADC (analog to digital converter) software is used to convert the movement of the slide pot (which is analog) into a digital signal and DAC (digital to analog converter) is used to convert the sounds of the invaders, the missiles and explosions from digital code to analog output for the speaker.  (It is clever how the invaders are coded to advance digitally across the screen and I would explain the principles except that I will lose most all the readers who have persevered to this point.)

We immerse ourselves increasingly in the digital world for information, socializing, entertainment and transactions.  First the CD players, then the internet, now smart phones and soon more of us will fall under the spell of AR (augmented reality) and VR (virtual reality).

Through VR we will be able to visit world heritage sites and see animals and birds and fish more vividly than we could possibly do in the wild.  But will it be a satisfying experience?  Can there be satisfaction when instead of a strenuous hike, pestered by mosquitoes, to see an isolated waterfall, we ask our digital assistant for the Victoria Falls (the Smoke that Thunders) or the Niagara Falls and we zoom in to all their splendor. 

The world of 1’s and 0’s will enhance our safety (house security & car sensors) and health (personal monitoring sensors, data compilation & analysis) and efficiency.  But for me it has limits and working in the field and growing food is far more satisfying than working out in a gym accompanied by sound and video generated from 1’s and 0’s.  For me live guitar music or theater or a local sport event is more satisfying (most of the time) than the best guitarist, actors or sports heroes, recorded in video? 

Ps1 – the edX Austin MOOC uses the ARM Cortex processor and is challenging unless you are a competent programmer.  There are easier courses and I just started a Coursera course on Arduino hosted by MIPT (Moscow Institute of Physics and Technology) which is for beginners and is fun.

Ps2 – the ADC (analog digital converter) uses successive approximation to discover the unknown analog input and convert it to binary number.  The technique is similar to the process used in a game where a friend imagines a number between (say) 0 and 255 and you have to determine the number and your friend will only tell you if the answer is higher or lower than your guessed number.  So You guess 128 (half of 256); Friend says lower. You guess 64 (half of 128); Friend says lower.  You guess 32; Friend says lower.  You guess 16, Friend says higher.  You guess 24; Friend says higher. You guess 28; Friend says higher. You guess 30; Friend says lower.  You say 29 and friend says that is the answer.  The software follows a similar technique and codes “higher” with a 1 and “lower” with a 0, and at the end of it all has determined the analog number and translated it into 1’s and 0’s. 

Leave a Reply

Your email address will not be published. Required fields are marked *