A TESTBED FOR REAL-TIME PROGRAMMING IN JAVA:
THE PINBALL PLAYER PROJECT

        Welcome to the Pinball Player Project! We are developing a system to allow students to learn Real-Time programming. The goal of the project is to create an inexpensive system, that teaches the concepts of creating a Real-Time program. The system is something students can relate to, playing pinball. The coding of the system is primarily in Java, with the camera driver written in C language. The current version, due to the C code, operates only on the FreeBSD operating system.We hope to be able to have the entire system coded in Java, at some point, and thereby cross platform.

        Why pinball? The system needs to be something inexpensive and safe, and the control needs to be easy for the students to control. Pinball is something that humans can play. Because of that, students are able to easily grasp the concept of play, and the strategies involved. Arcade games are relatively inexpensive (around $100 for an as-is system, to $2,500 for a new one). A camera costs around $200, with some higher-end models costing a few hundred dollars. A simple digital I/O interface cost around $100. Computer have come down in price over the years. A basic computer system can be bought for under $1000. So for around $2000, you can acquire all the parts needed to have your own pinball project in your school or university.

        This will be an educational tool for students to develop real-time programs that will interact with the pinball machine and camera. For beginning courses, students can deal with how to interact with the pinball machines, flippers and sensors, time-critical responses and simple strategies. For more advanced courses, they can add to the controls of the system, try and play for higher scores, aiming for targets, and network play. There is also an engineering aspect involved. The students can tap into built in sensors of the pinball machine. For example, the bumpers and targets in the game. This will allow the student to figure out which targets are already knocked down and which need to be aimed for.

There are various measurements that can be made about each game:

The number of times each ball is hit by the flippers.

The amount of time each ball stays in play.

The score each ball or total balls for the game receive.

The number of balls that can be in play at once.

The number of machines that can be controlled.

The time required to set up a new pinball machine.

The quality of play for a network player.

        Contests can be held among students to see who has built a better program. Of course, they would all have to use the same quality of hardware, otherwise a faster CPU system would outperform a lesser CPU. The students would use the above measurements as goals of their system.

You can read about the project from a paper written in Real-Time Systems Education II,
Progress Toward an Inexpensive Real-Time Testbed: The Pinball Player Project - PDF format.
Requires a PDF viewer such as Acrobat Reader.
Progress Toward an Inexpensive Real-Time Testbed: The Pinball Player Project - PostScript format.
Requires a PostScript viewer such as GhostView.

Download the beta version.

6/18/01 beta version 2 released.


A pinball machine is not required. There is an option to have the system track your hand movement to interact with things on the screen. As long as you have a system that runs FreeBSD and you have a QuickCam camera, it should work fine. It has been tested only on the B/W camera and expects to receive a B/W image.

Read the system documentation.


An introduction to how the system operates

        There is a QuickCam camera connected to the computer, from which the computer can see what is going on in the game. The computer has a digital I/O board, that connects to the flippers in the pinball machine. Flipping the flippers is very simple. There is no need to have a mechanical device pressing the flipper buttons. We have connected to the wires of the flipper buttons in the game and close the circuits electronically. Thereby making the flippers flip. Currently the plunger is not electronically controlled, however we are working on replacing it with a solenoid.

The system is multithreaded. The following are the threads in the system.

FrameGrabber - Grabs a frame from the Camera.

Analyze - Finds the objects, called Blips, in the frame.

Stub/Strategy - Stub filters out the Blips found and determines which one is the ball. Strategy then decides, based on the ball's position, wether or not flip a flipper.

Display - Displays the frame on the screen with a cross hair on the ball.

        The Strategy contains a Stub for the system. This allows the Strategy to have an indirect connection to the pinball machine. Because of this, the Strategy can be played on another system. We have implemented a RemoteStub which allows the Strategy to play across the network. We have various strategies that we have created. In order to organize them, we have turned the strategies into players. A player is made up of each of the threads in the system. There is a default class StdPlayer which defines which threads are to be used in the system. A new player can new extend StdPlayer and define it's own threads.

        The system has a digital I/O board that has relays connected to the Flippers. Sending a 1 to a relay raises the flipper, a 0 lowers it. So controlling the pinball machine itself is fairly simple.

        The system has Buffers floating around in the order of the threads that are listed above. A Buffer contains the frame from the Camera, and any data found by the threads that it visits, such as the Blips found in the frame. The frame obtained from the Camera, is an array that contains grayscale index values for the pixels. The system "sees" by taking the current frame and the previous frame and doing a binary difference to see what has changed. Based on these changes it can find movement. The shapes found are turned into Blips, and are then filtered out to find the one that is the size of the ball. The system filters out the Flippers, because as they move they could be thought to be the ball.

Diagram of the threads in the system

Diagram of the threads in the system when playing over the network

Diagram of the circuitry connecting the I/O to the flippers

Diagram of the ball tracking algorithm


Images of the system

Image of the pinball machine

Close up of the QuickCam

View of the relays setup for the flippers

View the playing field of the pinball game, Jacks to Open made by Gottlieb in May 1994.

Image from system shows the statistics of game play

Image of start menu. The start menu sets up some parameters in the system.

View a streaming video of the system in play. Requires Real Player.

High Quality - for LANs (needs 150Kbps)
Med Quality - for 56K modems
Low Quality - for 28.8K modems

New Pinball Machine:
High Quality - for LANs (needs 128Kbps)
Med Quality - for 56K modems
Low Quality - for 28.8K modems

The pinball project's framework applied to new uses. Very interesting video shows the
computer interpreting Morse code, controlling a robot, having a laser pointer control
the mouse, and more!

High Quality - for DSL or LANs (300k)
Medium Quality - for ISDN lines (100k)
Low Quality - for 56k modems


E-mail

For questions or comments about The Pinball Player Project,
contact Prof. Dayton Clark, pinball@sci.brooklyn.cuny.edu

You are visitor


Site designed by Lawrence Goetz

Copyright 1997-2001 Dayton Clark & Lawrence Goetz