MEMOCODE Software Design Contest 2014

Space Invaders

Submission deadline extension

This contest is over.


Space Invaders is an all-time classic arcade game from the 70s. It was developed by Tomohiro Nishikado and released in 1978. More information about the game itself is available here.

This design contest uses an emulator for Space Invaders. The code provided is derived from the emulator published on


The objective of the design contest is to make the emulator run (even) faster on the Raspberry PI by proposing software solutions only. This means that it is faster to replay the games, and at the conclusion of the replay arrives at the correct final framebuffer file. Software solutions refer to changes in the original source code without additional hardware support other than what is provided by the Raspberry Pi.

Hardware Platform

The hardware platform to use for the software contest is the Raspberry Pi. Please use the NOOBS install (Version 1.3.7, release date 2014-05-06). The emulator should work using the following instructions with the NOOBS install.

Emulator Download and Setup

Please note that the instructions provided are for setting up the emulator under the NOOBS Raspberry Pi installation. The emulator has two primary operating modes: 1) PlayGame and 2) RePlayGame.

Setup: PlayGame Mode

This mode allows the user to play the game, and record timestamped events of the actions (effectively keypresses) presented to the standard input. These can be directed to a file for replaying the played game again. In order to setup the emulator under this mode the SDL libraries are necessary.
  1. Install using apt-get the SDL libraries. Accept to install all packages apt-get recommends.
      $ sudo apt-get install -y libsdl1.2-dev
  2. Download the emulator source code from here.
  3. Untar the downloaded file.
  4. Compile the source code.
  5.   $ make SDL=1
  6. Play the game.
      $ ./invaders > myfirstgame.replay
      The keys in this mode are as follows.
    • 5 inserts a coin to give one additional credit.
    • 1 starts the game.
    • left and right moves the player.
    • space fires.
    You should see a screen that looks like the following.

Setup: RePlayGame Mode

This mode allows the user to only replay a pre-recorded game, and output its final framebuffer state. SDL is not required for this mode.

  1. Download the emulator source code from here.
  2. Untar the downloaded file.
  3. Compile the source code.
  4.   $ make 
  5. Play a pre-recorded game and output its final framebuffer. myfirstgame.replay is the file with the recorded events, and mygame.pbm is a PBM file of the final state of the framebuffer.
      $ ./invaders myfirstgame.replay mygame.pbm

Checking Framebuffer Contents

The final state of the framebuffer is dumped to the PBM file. You must ensure that it is equivalent to the PBM file generated when running the original (unmodified) version of the game. Since the PBM file is a binary file, you can compare it using the linux command cmp.

Measuring Simulation Performance

The performance numbers will be self-reported. We will measure the simulation time of only the simulation engine using the provided time functions. We have inserted time measurement functions in main.c.


You have to report the following. Make sure that you are setup in RePlayGame mode.

  • An average of 10 simulation runs of the simulation time of original (without modifications) invaders game on your platform.
  • An average of 10 simulation runs of the simulation times of modified (with your changes) invaders game on your platform.
  • Confirmation that the output from using cmp to compare the framebuffer dump of the original game's execution with the modified game's execution are the same.
You will submit the following pieces of information and files in a tar.gz file named as: firstName1_lastName1_memocodesw.tar.gz. The first name is the name of the primary contact author.
  • A text file named in the following way: firstName1_lastName1_summary.txt. This text file should have the simulation times for the original and modified collected using the above information. Here is an example of what the text file should look like.
       /* Authors: firstName1 lastName1, firstName2 lastName2, firstName3 lastName3, ... */
       /* Contact author: firstName1 lastName1 */
       /* Contact email: ( */
       game-960.replay -- original: 20.93525 
       game-960.replay -- modified: 1.230520 
       kyle.replay -- original: 120.93525 
       kyle.replay -- modified: 110.230520 
       short.replay -- original: 10.93525 
       short.replay -- modified: 5.230520 
       /* Results of compare of PBM files. YES if match and NO if no match. */
       game-960.pbm: YES
       kyle.pbm: YES
       short.pbm: YES
  • The source code with the modifications made that generated the above results. Please make sure to include the generated PBM files when using the modified version as well.
  • Please send the tar.gz to the contest chair below.


( )