0% found this document useful (0 votes)
49 views

Programming Pinball Machines

Programming Pinball Machines for Fun and Education Daniel Wong Darren Earl Fred Zyda Sven Koenig University of Southern California Computer Science Department

Uploaded by

juusto kanala
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
49 views

Programming Pinball Machines

Programming Pinball Machines for Fun and Education Daniel Wong Darren Earl Fred Zyda Sven Koenig University of Southern California Computer Science Department

Uploaded by

juusto kanala
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

Programming Pinball Machines for Fun and Education∗

Daniel Wong Darren Earl Fred Zyda Sven Koenig


University of Southern California
Computer Science Department
[email protected] [email protected] [email protected] [email protected]

ABSTRACT
The University of Southern California has recently created
a Bachelor’s Program in Computer Science (Games) and
a Master’s Program in Computer Science (Game Develop-
ment). As part of this effort, we are currently working on
creating a motivational project class on programming pin-
ball machines, where the students interface a PC to an ex-
isting pinball machine and then re-program the pinball ma-
chine with a pinball game developed by them. In Summer
and Fall 2008, we performed a feasibility study with the ob-
jective to develop the computer interface between a PC and
a recent Lord of the Rings pinball machine, the software to
drive the interface, libraries that provide abstractions of this Figure 1: Lord of the Rings Pinball Machine
interface, and a program that uses these libraries to imple-
ment an engaging pinball game. In this paper, we describe
the results of this successful feasibility study. As far as we Computer Interface, Game Development, Pinball Class, Pin-
know, this is the first time that anyone has managed to con- ball Machines, Teaching Computer Science
trol an existing pinball machine completely and re-program
it with a new complete (but simple) pinball game. 1. INTRODUCTION
The faculty members of the Department of Computer Sci-
Categories and Subject Descriptors ence at the University of Southern California believe that
K.3.2 [Computers and Education]: Computer and Infor- teaching computer science hands on via the development
mation Science Education—Computer Science Education, of games helps them to motivate students to learn com-
Curriculum; K.8.0 [Personal Computing]: General— puter science. They have therefore created a Bachelor’s
Games; B.4.m [Hardware]: Input/Output and Data Com- Program in Computer Science (Games) and a Master’s Pro-
munications—Miscellaneous gram in Computer Science (Game Development), which not
only provide students with all the necessary computer sci-
ence knowledge and skills for working anywhere in indus-
General Terms try or pursuing advanced degrees but also enable them to
∗Figure 3 uses parts of images by Cassidy Thomas, obtained be immediately productive in the game-development indus-
from the Internet Pinball Database at www.ipdb.org. The try [19]. In this paper, we describe our experience with
game music of Pinhorse is a mix of “Fearless Flight” from a feasibility study for a motivational project class on pro-
Null Space, “March of the Nucleotides” from Bit Shifter and gramming pinball machines, where the students interface a
other pieces from Castlevania. The pinball project was sup-
ported in part by a grant from the USC Fund for Innova- PC to an existing pinball machine and then re-program the
tive Undergraduate Teaching. Daniel Wong did his research pinball machine with a pinball game developed by them.
in Summer 2008 as a summer scholar in the undergradu- Solid-state pinball machines basically consist of a computer
ate merit research program, funded by the Viterbi School that reads the switches and controls the lights, solenoids,
of Engineering, and received a scholarship from the Rose speakers and the dot-matrix display [13]. A pinball game is
Hill Foundation in Fall 2008. We thank the Orange County determined by the input-output behavior of the computer,
Pinball League for their hospitality.
that is, what outputs the computer activates and when it
activates them in response to its input-output history. The
pinball class will cover how to build a hardware interface to
the pinball machine, how to design and implement the soft-
ware interface for the low and high level real-time control
of the pinball machine (including how to best represent the
rules of the pinball game), and how to write the rules of the
pinball game.

In Summer and Fall 2008, we performed a feasibility study


with a Lord of the Rings pinball machine, see Figure 1 (left). resent the rules of the pinball game), as will frequently arise
Our objective was to develop the hardware interface between during game development. These tasks require understand-
a PC and the pinball machine, the software interface to drive ing of concepts from operating systems, concurrent processes
the hardware interface, libraries that provide abstractions and rule-based expert systems (such as black-board systems)
of this software interface, and a program that uses these as well as software engineering. Furthermore, many com-
libraries to implement an engaging pinball game. In this puter science majors might not have practical experience
paper, we describe the results of this successful feasibility with playing sounds, speech and music.
study. As far as we know, this is the first time that anyone
has managed to control an existing pinball machine com- How to write the rules of the pinball game? The
pletely and re-program it with a new complete (but simple) students need to have a good understanding of what makes
pinball game. pinball games engaging. For example, pinball players look
for variability in game play via different modes but also the
2. THE PINBALL CLASS opportunity to make multiple shots and work on multiple
objectives, switching among them as opportunities present
The pinball class will be a semester-long capstone class for
themselves. Thus, the rules of pinball games need to get
students that have already taken some traditional computer
designed carefully, including the shots, modes and scoring.
science classes and now have to use a variety of knowledge
The user interface also needs to get designed carefully, in-
and skills that they have acquired in these classes to solve
cluding the lights, sounds, speech, music and information
a larger problem, namely to develop a way of programming
displayed on the dot-matrix display, both to communicate
a pinball machine easily and to create a pinball game that
the state of the pinball game to the user (which requires
is playable, engaging and entertaining. Fundamentally, the
user-interface skills that some students will be familiar with)
pinball class will be a design class. Some of the design prob-
and set an appropriate mood for the current state (which re-
lems are from computer science and thus look familiar to
quires artistic skills typically not taught to computer science
computer science students, for example, designing software
students).
for writing the rules of the pinball game. Other design prob-
lems are not from computer science and thus unfamiliar to
The students will form teams that include students with
computer science students, for example, how to design an
majors different from computer science, such as electrical
engaging pinball game. The students need to solve the fol-
engineering and arts, since the task requires a variety of ex-
lowing technical problems as part of the pinball class:
pertise and talent. Each team will determine its own path
to develop and program a pinball game. The pinball class
How to build and program a hardware interface to
will not prescribe any path to a good solution. In fact, there
the pinball machine? We have decided that we will pro-
is no material available on the internet about how to pro-
vide students with the hardware interface for the initial offer-
gram pinball machines and create engaging pinball games.
ings of the pinball class since many computer science majors
Thus, the teams can try out ideas, make mistakes and learn
might not have practical experience with TTL/CMOS logic
from them, similar to problem-based learning [15, 1] and
and simple electronics.
learning by design [11]. They will be assisted in two ways.
First, the students will read papers on related topics, such
How to implement software for the low and high
as how to form project teams, how to design operating sys-
level real-time control of the pinball machine? The
tems for embedded applications, how to design black-board
students need to let lights blink, that is, switch them on
systems, how to program concurrent processes, what makes
and off at the correct times. They need to form complex
pinball games engaging and how use lights, sounds, speech,
light patterns of light with the many available lights. They
and music to set an appropriate mood. Thus, the readings
need to detect patterns of switch closures and determine
will cover not only topics from computer science but a vari-
the mode based on them. They need to synchronize the
ety of other disciplines as well. Second, the students will use
lights, sounds, speech, music and information displayed on
pin-up sessions to foster ideas by bringing groups together
the dot-matrix display, which is important because the var-
for brainstorming and to share their work with others and
ious output modalities take different amounts of time and
hear their feedback [9]. In several iterations of research and
compete for the available output resources. For example,
reflection cycles, the students will brainstorm about ideas,
a sound effect and an animation on the dot-matrix display
try them out, and report on their experience, which forces
take different amounts of time and are long enough that
them to explain their ideas to other students and justify
the situation might change, which might require a different
them [11].
sound effect and a different animation. On one hand, it is
not satisfactory to stop the old sound effect and animation
before they are finished. On the other hand, it is not satis- 3. ADVANTAGES OF A PINBALL CLASS
factory either to delay the new sound effect and animation Traditional computer science classes usually cover individual
long beyond the event that prompted them. There are dif- topics in hardware and software, such as computer architec-
ferent ways how the necessary hierarchical control structure ture, operating systems, artificial intelligence and software
can be implemented, for example, with a blackboard struc- engineering. Traditional computer science classes typically
ture on which concurrent processes operate. Thus, the stu- emphasize individual work, resulting in disjoint knowledge
dents need to experiment with different ways of implement- with an insufficient ability to solve complex problems. Fi-
ing the hierarchical control structure to achieve real-time nally, traditional computer science classes often present the
control, assign scarce resources, manage the complexity of students with homework that requires them to use the mate-
the software and make it easily adaptable to changing the rial that was taught immediately preceeding the homework,
specifications of the pinball game (including how to best rep- which means that the general approach to the solution is
known in advance. The pinball class will reinforce the mate-
rial covered in traditional computer science classes but will
also give students a more holistic view of computer science.
It will teach or reinforce a variety of skills, including hard-
ware skills, computational thinking skills, software engineer-
ing skills and programming skills. It will also teach a vari-
ety of skills that are not taught in traditional computer sci-
ence classes, including creativity, design skills, artistic skills,
problem-solving skills and teamwork skills (including collab-
oration and communication skills). The students, for exam-
ple, will learn to work as part of heterogeneous teams and
respect students with different expertise. All of these skills
are important job skills that are seldomly taught at univer-
sities.

A pinball machine is a game. Traditional game develop-


ment classes have advantages similar to the pinball class [6].
However, pinball machines have the advantage over other Figure 2: Playfield and Underside
games that they cover aspects of hardware and robotics in
addition to aspects of software. A pinball machine is essen-
tially also a robot, given that it interfaces to the physical
world. Traditional robotics classes cover software and hard-
ware. However, pinball machines have the advantage over
robots that they are cheaper, much easier to maintain and,
if necessary, can even be serviced by readily available pin-
ball technicians for a small fee. Their low level control is Orthanc Balrog Palantir POTD Ring Magnet
simple and the resulting behavior thus robust, resulting in
a motivational experience. Also, the students can concen-
trate on developing the high-level behavior, which will allow
them to write the software from scratch in one semester. At
the same time, programming pinball machines is not trivial
since it requires knowledge of different areas of computer
science and the size of the resulting code is substantial and Arrow Lamps Pop Bumpers Loop Diverter
thus needs to get managed carefully.
Figure 3: Important Playfield Parts
4. THE PINBALL PROJECT
There is a substantial overhead in creating a pinball class
since it requires both hardware and software development. pleted pinball game was demonstrated at the biannual demo
In Summer and Fall 2008, we performed a feasibility study day of the GamePipe Laboratory in December 2008 to stu-
with one faculty advisor (Sven Koenig) and three students of dents, faculty members and representatives from the game
very different background who were interested in program- industry.
ming pinball machines: Daniel Wong was an undergraduate
student in electrical engineering and computer science and 5. THE PINBALL MACHINE
responsible for the computer and software interface; Darren We decided to work with a used solid-state Lord of the Rings
Earl was a Master’s student in computer science and respon- (LOTR) pinball machine from Stern Pinball of Chicago, cur-
sible for game programming; and Fred Zyda was a Ph.d. rently the only manufacturer of pinball machines. Stern Pin-
student in computer science and also responsible for game ball produced about 5,100 of these pinball machines, starting
programming. Our objective was to develop the hardware in 2003. Used LOTR pinball machines cost about $3000-
interface between a PC and a pinball game, the software $3500. The layout of their playfield is flexible and not par-
interface to drive the hardware interface, libraries that pro- ticularly theme-specific, see Figure 2 (left) for the layout and
vide abstractions of this software interface, and a program Figure 3 for some of the important playfield parts. LOTR
that uses these libraries to implement a engaging pinball pinball machines are highly rated for playability and need
game. Daniel created the hardware and software interface in to be used in creative ways to create engaging pinball games
Summer 2008. Darren and Fred designed and implemented since we do not want to alter the playfield physically. We
the pinball game as part of “Designing and Implementing control the pinball machine via its I/O Power Driver Board,
Games on Pinball Machines” (CSCI499) at the University which was used by all Sega and Stern pinball machines with
of Southern California (USC) in Fall 2008, while Daniel re- a WhiteStar or WhiteStar II board system (roughly from
fined the hardware and software interface. Daniel worked 1995 to 2004). Thus, we expect the hardware interface to
on the hardware and software interface for approximately the pinball machine and software to be usable with a variety
200 hours in Summer 2008 and 75 hours in Fall 2008, split of pinball machines from Stern.
roughly half and half between the hardware and software
interface. Darren and Fred worked on the pinball game for The input devices of the LOTR pinball machine consist of
approximately 3 hours a week during Fall 2008. The com- the 58 playfield switches, see Figure 2 (right), and the 7 ded-
Figure 4: CPU/Sound and I/O Power Driver Boards

Figure 6: New Hardware Architecture

plasma dot-matrix display (DMD). It includes the Image


ROM. The CPU/Sound Board determines which image from
the Image ROM to display. The Display Controller Board
then retrieves the image and generates it on the DMD.

6. THE HARDWARE INTERFACE


One extreme of programming the LOTR pinball machine
Figure 5: Original Hardware Architecture is to reprogram its ROMs. However, a reverse engineering
effort is very difficult without any available documentation
for the proprietary boards other than the LOTR manual.
icated switches, which correspond to switches that humans The other extreme of programming the LOTR pinball ma-
interact with (such as the left and right flipper buttons). The chine is to replace all boards. However, this is costly and
LOTR pinball machine supports up to 64 playfield switches, time-consuming since there more than 100 input and output
arranged in an 8x8 matrix. The controller reads the playfield devices. We therefore decided to replace the CPU/Sound
switches by software polling. It strobes each column and Board with a PC. We decided to interface the PC to the
then reads the row signal after it has gone through RC filters pinball machine via a small number of existing connectors,
(for noise filtering) and a comparator (for signal buffering) namely the connectors A-E in Figure 4, rather than sol-
to create a stronger steady signal. The LOTR pinball ma- dering wires onto the existing boards, which would make
chine supports up to 8 dedicated switches. The controller it difficult to both make additional pinball machines pro-
reads the dedicated switches directly. The output devices grammable and transform them back into their original state
of a LOTR pinball machine consist of the lights (namely 80 (which means that they would lose retail value). We also
lamps, 9 flash lamps and 19 LEDs) and 23 low and high cur- decided to interface the PC to our own Display Controller
rent solenoids (including 2 slingshots, 3 vertical upkickers, 3 Board because we wanted to be able to generate images on
pop bumpers, 2 flippers, 1 loop diverter, 1 ring magnet and the DMD on the fly rather than having to store them in the
1 Balrog motor), see Figure 2 (right). They also consist of a Image ROM. Finally, we decided to use the PC speakers for
pair of speakers and the dot-matrix display. The lamps are sounds, speech and music. Thus, the pinball game can play
arranged in a 10x8 matrix and need to be strobed, similar to arbitrary sound files with the high-level commands provided
the switches, at approximately 1ms to minimize flickering. by SDL. The LOTR pinball machine is thus controlled by
The LOTR pinball machine is controlled by the following the following new components, see Figures 1 (right) and 6:
components, see Figures 4 and 5:
The PC is used for programming and running the game
The CPU/Sound Board processes the input signals and code. We use a Dell Outlet Inspiron 530 PC with an Intel
generates the control signals for the speakers, the Display Core 2 Quad Q6600 Kentsfield 2.4GHz processor and the de-
Controller Board and the I/O Power Driver Board. It in- fault installation of OpenSuse 10.3 Linux, except that we re-
cludes the 8-bit 68B09E microprocessor, the CPU Game compiled the kernel with support for a high-resolution timer
ROM and the Sound/Voice ROM. and installed libraries for the Digital I/O Board (NIDAQmx
driver) and serial communication (libserial). The PC costs
The I/O Power Driver Board drives the output devices. $469, and Linux costs $0.
It includes registers that hold the status of each output de-
vice. The CPU/Sound Board sets the data of these registers. The DMD Board interfaces the PC to the DMD. We use
The I/O Power Driver Board then activates the output de- a Parallax Propeller, an 8-core 32-bit microprocessor. Each
vices accordingly. of its cores (called cogs) is capable of running independently
of the others. We use one cog to drive the DMD at about
The Display Controller Board controls the 128x32 70Hz, the recommended refresh rate. We use one cog to
munication (a USB connector as a virtual COM port), see
Figure 7:

The Display Controller Interface interfaces the pinball


game to the DMD Board. It repeatedly grabs the content
of the screen and transfers it to the DMD Board. Thus,
the pinball game can create arbitrary graphics on the fly
with the high-level commands provided by SDL. The Display
Controller Interface can display approximately 15 frames per
second on the DMD, which is sufficient for full motion ani-
mation.
Figure 7: New Software Architecture
The Digital I/O Board Interface interfaces the pinball
game to the Digital I/O Board. It consists of two layers:
handle the serial connection with the PC at about 115.2k The Hardware Interface Layer communicates with the
Baud. Finally, we use one cog to process the data received Digital I/O Board via the NIDAQmx driver to read the
from the PC. When data is received from the PC, the Serial switches and drive the lights and solenoids. For example,
Cog hands it over to the Processing Cog, which writes the it converts the desired status of the lights and solenoids into
data to memory, forming an image. The Display Driver Cog byte representation, places the address of the register onto
then reads the image and drives the DMD to display it. The the address bus, the data of the register onto the data bus
images are double buffered to create a steady image on the and finally clocks the register to save the data.
DMD. The Parallax Propeller Demo board costs about $80.
The Behavior Layer uses the Hardware Interface Layer
The Intermediate Switch Detection Board filters and to implement behaviors for every output device. Pinball
buffers the incoming switch signals similar to what the games need to contain a main loop that repeatedly calls
CPU/Sound Board did before. The parts of this custom- the Main Loop Function of the Behavior Layer to read the
made board cost about $30. current status of the switches and set the current status of
the lights and solenoids. The Main Loop Function detects
The Digital I/O Board interfaces the PC to the I/O Power both levels and edges of switches by monitoring the history
Driver Board and the Intermediate Switch Detection Board. of the switch status. It activates the lights and solenoids
We use a National Instruments PCI-6509, a high-current according to behaviors that the pinball game can set via
96-channel 5V TTL/CMOS Digital I/O card. We chose the function calls.
PCI-6509 for its ample ports, its support for 5V TTL/CMOS
levels which makes it compatible with components on the The Behavior Layer implements three different behaviors:
I/O Power Driver Board, and its ability to source or sink up The standard behavior for lights and solenoids is to turn
to 24mA of current which enables it to drive the data bus on (= activate) immediately and then turn off (= deacti-
of the I/O Power Driver Board. Its 96 channels are orga- vate) after a set period of time. The second behavior is for
nized into 12 ports of 8 channels each. To read the playfield those solenoids that need to stay on for extended periods of
switches from the Intermediate Switch Detection Board, we time and thus are typically individually fused, namely the
use one port as output to strobe the column and one port as flippers, the ring magnet, the loop diverter and the Balrog
input to read the row signal. To read the dedicated switches motor. Their behavior is identical to the standard behavior
from the Intermediate Switch Detection Board, we use one but they require pulse-width modulation to limit the amount
port as input. To set the data of the registers of the I/O of current going through them, which reduces the amount of
Power Driver Board, we use two ports as outputs, one for heat and allows them to stay on longer. Thus, the behavior
the address of a register and one for the data to be written needs to activate and deactivate them repeated while they
into that register. The PCI-6509 costs $299, and its cabling are turned on. The third behavior is for the Balrog, which
kit costs $259. acts as a door that opens and closes. Its behavior needs to
set the relay to the desired turning direction and then turn
All cables connect to the Intermediate Switch Detection on the Balrog motor.
Board to keep the cabling organized. The custom-made
Molex connectors and header pins cost about $40. The to- The Behavior Layer performs safety checks to prevent fuses
tal cost of all additions is approximately $708 plus the cost and transistors from blowing. These safety checks are the
of the PC. We expect to be able to reduce this cost to ap- result of trial and error. They implement conservative time-
proximately $300 plus the cost of the PC with an embedded outs for all solenoids driven by pulse-width modulation. For
system currently in development. example, the loop diverter automatically turns off after one
minute, and the Balrog motor turns off immediately when
7. THE SOFTWARE INTERFACE Balrog is completely open or closed. The safety checks im-
plement timeouts of half a second for the lights and all other
The software interface allows a pinball game to control all as-
solenoids since they need to be active only for fractions of a
pects of the pinball machine via function calls. It is written
second.
in C/C++ and provides the interface between the pinball
game and the Digital I/O Board via the NIDAQmx driver
and the pinball game and the DMD Board via serial com- 8. CURRENT STATUS / FUTURE WORK
We encountered the following difficulties during the project:
First, we had the LOTR manual available but not much fur-
ther documentation. Thus, we had to develop parts of the
hardware and software interface via trial and error, which
was especially problematic for the I/O Power Driver Board,
DMD and LEDs. Second, we had to develop the safety
checks via trial and error, blowing many fuses and some
transistors in the process. Third, the hardware and software
interface were more complicated than necessary due to our
design decision to interface the PC to the I/O Power Driver
Board via a small number of existing connectors. For exam-
ple, we needed to design the Intermediate Switch Detection
Board to replicate part of the original CPU/Sound Board,
and we needed to strobe the playfield switches and lamps.
The playfield switches cannot be strobed too quickly (oth-
erwise the data will not have time to propagate through the
wires), and the lamps cannot be strobed too slowly (other-
wise a watchdog timer on the I/O Power Driver Board resets
the system). Fourth, the PC needs to run fast both to strobe Figure 8: State Diagram of Pinhorse
the lamps sufficiently fast (to prevent them from flickering
and the watchdog timer from triggering) and to control the
solenoids with precision. Fifth, the software interface suf-
fers from slight inconsistencies in timing due to our design
decision not to use an operating system with a real-time
kernel since the system load then determines how often the
software interface gets called in the main loop, which deter-
mines the flickering of the lamps and the precision of control
of the solenoids. We mitigated this effect by recompiling the
Linux kernel with support for a high-resolution timer with
an accuracy of 1ns and gave the pinball game high priority
so that other processes would interrupt it less.
Figure 9: Shotmap of Pinhorse
The software interface is now fully functional, with three
minor issues: First, the software interface is currently able
to display only two colors on the DMD but is already de-
shots to advance the game. This can make them unexcit-
signed to use software modulation to produce three levels of
ing for expert players since they quickly become monotone.
grayscale. Second, the software interface does not perform
In multiplayer mode, pinball games keep a score for each
all necessary safety checks to guard against unreasonable
player, with little to no change in game play. This can make
game programmers. For example, the flow of current that
them unexciting for nonexpert players since the expert play-
results from activating all solenoids at once can blow fuses
ers in the group can keep the pinball in play for long periods
and potentially damage the I/O Power Board. Third, the
of time and the nonexpert players are then idle most of the
software interface still suffers from minor inconsistencies in
time.
timing: The lamps flicker subtly (although this is barely no-
ticeable); the ring magnet is not always able to catch the
This experience made us settle on three design goals: First,
pinball and throw it backwards; and the force applied by
we wanted to design a pinball game where the sequence of
the vertical upkickers is not completely consistent. We are
shots required to win the game is determined during the
now working on creating an embedded system to produce
game and can thus be different each time the pinball game
the control signals for the pinball machine, which will solve
is played. Second, we wanted to design a multiplayer game
the inconsistencies in timing, lower the total cost by replac-
where each player directly influences the game of the other
ing the Digital I/O Board and reduce the number of cables
player. Finally, we wanted to design a pinball game that
required by handling all data transfer through serial com-
limits the playtime of each player.
munication.
To satisfy the three design goals and ensure that our pinball
9. DESIGNING A NEW PINBALL GAME game would be different from the original pinball game of
When we set off to design a new pinball game, we first had LOTR pinball machines, we designed a pinball game based
to understand what makes pinball games fun. We attended on the concept behind Horse. Horse is a game played on a
a meeting of the Orange County Pinball League (at least one basketball court where the first play makes a shot that the
of whose players was ranked in the top 20 in 2008 accord- second player must duplicate from the same position on the
ing to pinballrankings.com), where we were able to play 15 court. We adapted this concept to pinball by dividing the
different pinball machines. We also observed expert pinball play into two roles: a shot establisher and a shot matcher.
players and asked them questions about their strategies. We The first player completes a series of shots within a fixed
learned that pinball games seem to follow a fairly strict for- amount of time with no restrictions on his play. His goal is
mula where the players need to make a series of predefined to create a sequence of shots that is difficult to match either
due to its length or the skill required to make the individual from the point of view of the player and thus loosely re-
shots. Once his time is up, the flippers become disabled flect the absolute positions of the lights. The lights are
and the pinball drains. The second player then attempts to grouped hierarchically, for example, into circles, arcs and
replicate this sequence of shots within the allotted time. If arrows. Lighting functions operate on these groups and can
he is successful, he is allowed to complete additional shots access the system time and maintain state to realize complex
with no restrictions on his play to improve his score, see light patterns, such as rotating half circles, expanding rings,
Figure 8. A full game would eventually consist of several balls with time-dependent radii and strobing lights. Each
iterations with players switching roles and keeping running light pattern has several configurable parameters, such as
totals of their performance. the velocity of progression, acceleration, start coordinates
and duration. More than one light pattern can be active at
We defined seven possible shots based on the physical layout any time.
of the playfield, namely the left orbit (A), middle orbit (D),
right orbit (G), left ramp (B), center ramp (E), right ramp Pinhorse defines about 20 groups of lights and uses light
(F) and the Orthanc tower (C), see Figure 9. These are the patterns in several ways. For example, Pinhorse strobes
shots that skillful players can make reliably. If the player Palantir at an increasing rate after a Palantir hit to indicate
hits the Palantir (chosen for its unique lighting characteris- the amount of time left before the loop diverter and Balrog
tics and visibility), the loop diverter and Balrog open for a close again. For the first player, Pinhorse confirms that a
short amount of time. The loop diverter opens to make the shot was established with a quick flash of light. The speed
Orthanc tower shot easier, and the Balrog opens to enable of a rotating half circle across the entire playfield indicates
the center ramp shot. These dynamics allow skilled play- the amount of remaining time. For the second player, Pin-
ers to make substantially more difficult shot sequences. We horse indicates the next shot to be made with a ball of light
quickly learned that replicating a sequence of shots is almost with time-dependent radius centered on the corresponding
impossible for regular players without intervening shots and blinking arrow lamp to catch his attention. As with the first
thus relaxed the rules to allow intermediate shots by the player, the speed of a rotating half circle of lights indicates
second player. For example, if the first player defines the the remaining time. However, the animation is restricted to
shot sequence “left orbit” and “right ramp,” then the second a small group of lights near the flippers as to not interfere
player can replicate it with the shot sequence “left orbit,” with the indication of shots. In the bonus mode, all lights
“right orbit” and “right ramp.” We call the resulting pinball on the board are strobed to signify the accomplishment of
game Pinhorse. the second player.

10. IMPLEMENTING THE GAME Pinhorse uses sound effects to inform the players of the out-
comes of their actions. For example, Pinhorse plays voice
Shots consist of sequences (usually of length two) of switch
recordings to reinforce which shot the second player is ex-
edges in quick succession, which allows Pinhorse to detect
pected to make next, which greatly improved the player ex-
whether the shot was sufficiently strong to complete success-
perience. Pinhorse also uses sound effects to encourage the
fully and what the direction of the shot was. Some shots con-
second player to act quickly when his time runs out. Finally,
sist of more than one sequence of switch edges, which allows
Pinhorse plays background music during game play.
the player to complete it in different ways. Pinhorse adds
every switch edge to a small buffer and then scans the buffer
in an attempt to match a shot (shot recognition). For the 11. CURRENT STATUS / FUTURE WORK
first player, recognized shots are added to the end of a queue. Pinhorse was intended to help us improve the computer and
For the second player, recognized shots are compared to the software interface and demonstrate the feasibility of writing
first shot in the queue. If they match, the first shot in the a pinball game within a semester. The Pinhorse program
queue is removed (shot matching). Pinhorse knows that the consists of about 680 lines of code, the helper classes for
second player has matched all shots of the first player once shot recognition, shot matching and light patterns consist of
the queue is empty and then starts a bonus mode where the about 1600 lines of code, and the software interface consists
second player can make extra shots to increase their score. of about 2500 lines of code. Almost all of this code can be
reused to speed up the development of future pinball games
Pinball games require both visual and audio cues to com- and to increase their complexity.
municate the current state of the game to the players and
create the right mood. Pinhorse uses the DMD to display Pinhorse works well, with three minor issues: First, Pin-
the current player, the number of shots made by the first horse occasionally fails to detect shots due to switch edge-
player or the number of shots still to be made by the sec- detection errors and adjustment problems. For example, the
ond player, the next shot to be made by the second player pinball can sometimes squeeze by the upper switch of the
and the remaining time. However, since the pinball action right orbit without triggering it, which could be prevented
is fast paced, Pinhorse makes extensive use of the lights to only by adjusting the switch position. Second, pinball games
give visual cues to the player. enter a ball-find mode when the pinball gets stuck some-
where and no switches trigger. Pinhorse, however, has very
Pinhorse uses a variety of lighting effects. The software short rounds and thus enters the ball-find mode only when
interface addresses the lights according to the architecture the pinball is missing at the end of the round. A stuck pin-
imposed by the I/O Power Driver Board. We therefore im- ball thus ends the turn of a player. Finally, the first player
plemented a wrapper that allows Pinhorse to reason about can define as many as 10 to 12 shots in the 60 seconds that
lights by Cartesian coordinates. These coordinates are de- we allotted for each round, which can be difficult for the sec-
rived as the projections of the lights onto the playfield glass ond player to replicate. Pinball Horse could be made easier
with a system of power-ups that the second player can earn the hardware and software interface to program a complete
with particular shots and that then increase their remaining (but simple) pinball game that makes use of all of these
time or turn off features of the pinball machine that ran- aspects. Thus, our project extends the start of the art sub-
domize the movement of the pinball, such as the slingshots stantially. Additional information and a video of Pinhorse,
or pop bumpers. our pinball game, in action can be found on our webpages
at idm-lab.org/pinball.
12. RELATED WORK / CONCLUSIONS
Several universities have recently introduced game develop- 13. REFERENCES
ment classes, see for example the issue of the Communi- [1] H. Barrows. How to Design a Problem-Based Curriculum
for the Preclinical Years. Springer, 1985.
cations of the ACM on “Creating a Science of Games” [18],
[2] J. Bork. Controlling a pinball machine using Linux. Linux
the proceedings of the First to Third Annual Microsoft Aca- Journal, 139, 2005.
demic Days Conference on Game Development in Computer [3] J. Bork. Reverse engineering a microcomputer-based control
Science Education and the proceedings of the ACM Techni- unit. Master’s thesis, Industrial Technology, Bowling Green
cal Symposium on Computer Science Education, including State University, Bowling Green (Ohio), 2005.
[14]. Game development classes typically develop only soft- [4] D. Clark. An inexpensive realtime testbed - the pinball
ware that does not interface to the physical world, such as player project. In Proceedings of the IEEE Workshop on
real-time strategy games. Real-Time Applications, pages 86–88, 1994.
[5] D. Clark. Progress toward an inexpensive real-time testbed:
The pinball player project. In Proceedings of the Real-Time
Simulations of pinball machines have, in research, been Educational: Second Workshop, pages 72–79, 1997.
used to develop and evaluate machine learning algorithms [6] D. Cliburn. Games across the curriculum: Can we quantify
[10, 17, 16]. In teaching, they have been used to teach artifi- their effectiveness? (birds of a feather session). In ACM
cial intelligence as part of “Artificial Intelligence” (CS6361) Technical Symposium on Computer Science Education,
at Georgia Institute of Technology (USA) in Winter 1999 2007.
taught by Sven Koenig (one of the authors of this paper). [7] R. Cohen. Designing an experimental pinball wizard. The
Electronic System Design Magazine, 19, 1989.
Actual pinball machines have, in research, been used to [8] S. Gustafsson, J. Munoz, S. Norell, D. Real, and Y. Xiao.
Smart pinball project - final report. Technical report,
study hybrid system control [12] and to develop and evaluate Skolan för Elektro- och Systemteknik, Royal Institute of
machine learning algorithms by an undergraduate student of Technology, Stockholm (Sweden), 2004.
Sven Koenig (one of the authors of this paper) at Georgia [9] J. Holbrook, B. Fasse, and J. Gray. Creating a classroom
Institute of Technology (USA) in 1999. In teaching, they culture and promoting transfer with ’launcher units’. In
have been used to teach real-time and embedded systems as American Educational Research Association, 2001.
part of “Introduction to Embedded and Real-Time Program- [10] M. Johnson. Algorithms for pinball simulation, ball
ming” (CS160) at Brown University (USA) in Spring 2007, tracking and learning flipper control. Master’s thesis,
Department of Electrical Engineering and Computer
“Smart Product Design Laboratory” (ME218a) at Stanford Science, Massachussetts Institute of Technology, Boston
University (USA) in 2007, “Designing with Microcontrollers” (Massachussetts), 1993.
(EE476) at Cornell University (USA) in Spring 2007 and [11] J. Kolodner, D. Crismond, J. Gray, J. Holbrook, and
“Special Topics in Electrical Engineering: Pinball Machine S. Puntambekar. Learning by design: From theory to
Project” (ENEE 488Q) at the University of Maryland at Col- practice. In Proceedings of the International Conference of
lege Park (USA) in Spring 1997. A similar effort existed at the Learning Sciences, pages 223–229, 1998.
Brooklyn College (USA) around 1997 [5]. Pinball machines [12] G. Lichtenberg and J. Neidig. An example of hybrid
systems control: The pinball machine. Technical Report
have also been used to teach signal and image processing 2003.13, Lehrstuhl für Automatisierungstechnik and
as part of “Project Course in Signal Processing and Digital Prozessinformatik, Ruhr-Universität Bochum, Bochum
Communication” (EQ2430/EQ2440) at Kungliga Tekniska (Germany), 2003.
Högskolan (Sweden) in Spring 2004 and “Project: Pinball” [13] M. Rossignoli. The Complete Pinball Book. Schiffer, 1999.
(EOH 2004) of the ACM Special Interest Group for Com- [14] N. Sturtevant, H. Hoover, J. Schaeffer, S. Gouglas,
puter Architecture at the University of Illinois at Urbana M. Bowling, F. Southey, M. Bouchard, and G. Zabaneh.
Champaign (USA) in Spring 2004. Multidisciplinary students and instructors: A second-year
games course. In ACM Technical Symposium on Computer
Science Education, 2008.
One of these efforts attempted to build a pinball machine [15] S. Williams. Putting case-based instruction into context:
from scratch, which allows them to customize the hardware Examples from legal and medical education. Journal of the
for easier control. Other efforts used old electro-mechanical Learning Sciences, 2(4):367–427, 1992.
pinball machines, which are easier to control than newer [16] N. Winstead. Some explorations in reinforcement learning
solid-state pinball machines. The state of the art in con- techniques applied to the problem of learning to play
trolling a pinball machine was as follows: Some efforts con- pinball. In Proceedings of the AAAI-03 Workshop on
trolled the flippers by modifying the hardware [4]. Some Entertainment and AI/A-Life, pages 1–5, 1996.
tracked the ball via input from the playfield switches [12] or [17] N. Winstead and A. Christiansen. Pinball: Planning and
learning in a dynamic real-time environment. In AAAI-94
an overhead camera [8, 7]. The most sophisticated project so Fall Symposium on Control of the Physical World by
far mimicked the microcomputer-based control unit to read Intelligent Agents, pages 153–157, 1994.
the switches and control the solenoids [3, 2]. We, on the [18] M. Zyda. Creating a science of games. Communications of
other hand, provide a hardware and software interface that the ACM, 50(7), 2007.
controls all aspects of an existing solid-state pinball machine [19] M. Zyda and S. Koenig. Teaching artificial intelligence
(including the lights, solenoids, DMD and speaker) without playfully. In Proceedings of the AAAI-08 Education
needing to modify its hardware. Furthermore, we have used Colloquium, 2008.

You might also like