2014 – Astrogun

As the Jerusalem mini Makerfaire (for the second year) approached, Avishay Orpaz & I wanted to come up with something to show. We created the ASTROGUN. The ASTROGUN is a sort of augmented reality game that has the player attempting to blast quickly approaching asteroids before being hit.


The game is pretty simple – the player stands and has to shoot Asteroids that are coming towards him from any direction, before they hit him. A RADAR-like view helps the player locate the Asteroids around him. The most interesting thing is the display system.  We built a HUD – heads up display – which is a display that shows an image overlaid on the background.

In the heart of the Astrogun lies a Raspberry Pi computer. An IMU card connected to it (Sparkfun’s MPU-9150 breakout board) providing it with the ability to sense the orientation the unit’s orientation. Having this information, the Pi is able to draw the various elements (Asteroids, bullets, explosions), as seen from that specific angle. When the player moves, the graphics move ayour’ccordingly, giving the “object in the room” sense.


The display system comprises of two main elements: an LCD panel and a beamsplitter glass (also known as Teleprompter glass). This glass has a unique feature – it is both transmissive (like a window) and reflective (like a mirror). The player, looking through the glass sees both the image behind the glass and the image projected from the LCD.
Anyone who is familiar with basic optics will immediately notice that I’m a little bit cheating here. The system lacks one important component – a collimation lens. In real HUD systems, this lens projects the imager image to infinity, creating an illusion that the graphics is in fact “on” the object the user is looking at. In our case, the short development time hindered us from complex optical structures. Nevertheless, the experience of object-in-the-room is still there, to some degree.


As for the software, the game is not very computationally demanding (set aside the graphics rendering process, which is handled by the GPU). The development time, on the other hand, was definitely demanding. Therefore, Python was a natural choice. I used the excellent Pi3D library to create the graphics, while the rest of the game logic is written in pure Python. In order to determine the orientation, I used the RTIMULib library, which reads the sensors and fusions its data into orientation angles (I also contributed aPython binding module for that library, which was written for this project). Sound effects are played using the PyGame library.

Finally, the mechanics. Most of the electronics (RPi, IMU, power supplies and a few more) were fitted nicely within the body of a toy gun, which was sourced from a local toy store. The display system, which comprises the LCD, its controller and the beamsplitter glass are held in position by a glass epoxy structure which positions them in the location and angle required (the glass and the LCD must be positioned in a 45 degree angle, otherwise the image will be distorted). The Raspberry Pi is connected to the controller using an HDMI cable. The trigger of the gun had an electric contact for its original purpose (flashing LEDs and making noise), and it was re-routed to one of the GPIO pins.

It’s definitely reminiscent of the arcade classic, Asteroids. The primary difference is that the player has no space ship and does not move through space. Instead, the player is stationary, has a first person view and can rotate 360 degrees and look up and down. The radar screen in the corner will give you a rough idea of where the asteroids are coming from. Then it’s up to you to actually locate them and blast them into oblivion before they destroy you.

The game is built around a Raspberry Pi computer canadianviagras.net. This acts as the brains of the operation. The Pi interfaces with an MPU-9150 inertial measurement unit (IMU). You commonly see IMU’s used in drones to help them keep their orientation. In this case, we where using it to track the motion and orientation of the blaster(the Astrogun) – nine degrees of freedom with this setup.

The Pi generates the graphics and sends the output to a small, high-brightness LCD screen. The screen is mounted perpendicular to the player’s view so the screen is facing “up”. There is a small piece of beam splitting glass mounted above the display at approximately a 45 degree angle. This is a special kind of glass that is partially reflective and partially translucent. The result is that the player sees the real-world background coming through the glass, with the digital graphics overlaid on top of that. It’s similar to some heads-up display technologies.


All of the electronics fit either inside or mounted around a toy gun. The display system was attached with a custom-made fiberglass mount.

All the source code of the project is available through GitHub. Unfortunately, the mechanical structure is ad-hoc and not documented 😉

We also got a review in Hackaday: