Vector games 32c3

From Trammell Hudson's Projects

This is our talk for 32c3 on vector retro-gaming and interfacing MAME with XY displays. The talk is the result of a collaboration with Adelle Lin, another NYC Resistor member who is a digital designer with a focus on building playful spaces, games and interaction. If you prefer to watch, the half hour video is online.

History of Vector Graphics

Analog computers

The earliest analog computers used oscilloscopes or plotters to output their results. This EAI680 is displaying the result of a differential equation modeling a dampened pendulum on its Tektronix XY monitor.

The first video game, Tennis for Two in 1958, was built with a similar analog computer and displayed on an oscillograph. The bounce of the ball was implemented as a differential equation, very similar to the one shown on the EAI680.

There is no "source code" for Tennis for Two since it was implemented entirely in hardware. There are relays that control the direction of the ball, comparators that detect when it hits the ground or the net, opamps that implement the differential equation, resistors that simulate drag, and so on.

Adelle worked on a modern recreation of it for Silicon City in collaboration with producer Jeanne Angel, games studio Dozen Eyes and physicist Peter Takacs. Due to the pressure of keeping something running maintenance-free for the five months of the museum exhibit, they used a 4K monitor and emulated the game. During the real demo of Tennis for Two at Brookhaven there were technicians replacing parts as they broke, something that the NYHS wanted to avoid.

Digital computers

Spacewar! from 1962 was one of the first digital video games and used the XY display of the PDP-1 to display the players' ships and weapons, as well as the starfield background. The controls were knobs and buttons on the front panel of the system, although many sites built custom controls to avoid wearing out the official ones.

Storage tube vector displays were very popular for engineering applications since they could draw very high resolution lines and maintain a stable image. They are not well suited for games, however, but allowed very low memory computers to draw incredibly complex images over low bandwidth links.

Storage displays

Storage tube displays are great for very detailed static vector images, but won't work well for games with high framerates. So save your money and don't spend it on a Tek 4014.

Vectorscopes

Vectorscopes like the Tek 1720 were used by TV stations to calibrate their colorbars and being phased out as the stations go digital. As a result these analog displays are plentiful and inexpensive on ebay. They use very fast electrostatic deflection and typically have small screens, but they tend to be super sharp. They also have differential inputs, so that you can don't need a negative output on the DAC.

Vectrex consoles

The Vectrex home game console has a nice large, sharp B&W screen. It is fairly easy to disconnect the original motherboard from the analog CRT driver and route it to the outside of the case to allow a v.st board to be plugged in.

The Vectrex has a somewhat slow magnetic deflection system, which prevents it from drawing as many vectors as the faster electrostatic displays. It is much larger, however, and also offers a Z-input that allows the brightness to be controller without varying the line drawing speed.

Laser projectors

You can use a laser projector as well, but the results are really suboptimal. The physical mirrors have quite a bit of inertia and turning the beam on and off requires time. The refresh rates tend to be low and the images very flickery. Some specialized games might work with very fast (45-60Kpps) galvos, but most arcade games required too many vectors.

The LazyMame project appeared to be making good progress, but I can't find any details or source code since 2008. OpenLase-Mame had some development in 2013, but nothing for three years. Other people have tried a custom Unity plugin to create new laser games, with some success.

MAME

MAME is the Multiple Arcade Machine Emulator and it really lives up to its name: it can emulate thousands of games and cabinets, including nearly every vector arcade game ever made.

Emulating Vector Displays

The "bloom" effect caused by the bright vector lines is one of the features that is most desired by game players. MAME has support for HLSL shaders that blur the bright lines and creates an approximation of the effect. On the left you can see a real Vectrex display and on the right MAME's emulation of a similar effect.

Unfortunately my patch to add support for exporting the vectors to MAME was closed as "an unacceptably hacky way to achieve the intended result". Instead you'll need to clone my tree and follow my instructions on building vector MAME. The majority of the changes are in src/emu/video/vector.cpp and take advantage of the clipping windows that MAME is using to limit the vectors to the onscreen area.

Patches for Raspberry Pi

I've also ported the changes to the stripped-down MAME4AllPi build for the Raspberry Pi. The instructions for Pi vector MAME are similar; you'll need to clone my tree and build it on the Pi. There are quite a few issues that need to be fixed related to joysticks unfortunately.

Playing games

You can play one of the original arcade games, Space Wars from 1977.

Asteroids (1979) is always popular as well. One of the highest grossing games of its era!

Or perhaps Lunar Lander (1978) and Tempest (1980) are more your speed.

There are lots of vector games to emulate. All of the ones in Atari games are there.

So many obscure games! I can't name them all, but have collected the list of Vectrex games as well as all of the vector arcade games listed on Wikipedia.

Taking it further

Custom input devices

Once you have your vector display hooked up the MAME, you'll probably want to take it to the next level. It is fairly easy to build custom USB HID joysticks using Adafruit arcade joysticks, buttons and even coin acceptors.

Tim Bartlett's Raspberry Pi Asteroids console looks great and he has published all of the design files if you want to build your own.

Juergen Mueller build a marvelous Asteroids cabinet with Vectrex display that uses a real Asteroids logicboard, which is just above and beyond.

Creative coding with vectors

If you're tired of playing games, you can always turn the display into a Scope Clock. The Teensy 3 has through-holes for a 32.768KHz clock crystal and backup battery that lets it keep decent time.

You can write games that run directly on the Teensy, like Space Rocks, my Asteroids clone, or art projects like my Twitter Oscilloscope.

Some folks are really taking it to the next level -- vec9 is the first full-scale vector arcade game in decades and has a custom cabinet with a real tank controller.

We've written a simple Processing library to show how to write things that interact with the displays. Sample code is at vst/processingDemo and also available as ProcessingJS, demoed in Swarm and Random Walk.

If this is of interest to you we'll be having a class at NYC Resistor in collaboration with Code Liberation and an exhibition at Baby Castles in early 2016.