P-ROC PINBALL
CONTROLLER

Date: February 2010

Like budding authors and their books, many of us believe we have at least one good pinball design inside us.  So what's stopping us turning the machines of our dreams into reality?

For many, it's not so much assembling the components and building a playfield.  It's probably not the artwork or the wiring either. 

No, for many people, the major stumbling block on the path to pinball nirvana is creating an operating system so you can have rules, display effects and sounds.  It's no good creating your futuristic, all-action Tron-themed pinball if it's got the same rules, sounds and animations as Gilligan's Island.

Pinball manufacturers have never made it easy for customers to modify their software.  These companies were in the business of selling you a new machine, not prolonging the life of the one you already have.  So re-writing Williams/Bally or Gottlieb game code is probably not practical. 

Plus, those system are now 20 years old, or more.  Technology has moved on since then to create more powerful and less power-hungry components.

So, the best way to control your newly designed and built machine is with a new control system, running on a regular computer platform to allow you to use a range of commonly available and well-supported software tools to get your fantasy game up and running the way it should.

Creating a whole new pinball control system – and keeping it flexible, affordable and accessible – is no small task, requiring the careful integration of hardware and software.  So when hardware engineer Gerry Stellenberg created his P-ROC board and teamed up with software developer Adam Preble, they forged something with exciting possibilities.

Gerry got hooked on pinball in 1995 while studying Computer Engineering at Virginia Polytechnic Institute and State University, playing Theatre of Magic in the student centre.  The very day he graduated, Gerry bought his first machine with a plan to connect it to a computer and write his own code for it.  Six months later he’d succeeded, using a digital input/output board and code he wrote himself.

After getting his own Theatre of Magic and pairing it up with an Attack From Mars, his passion for pinball experimentation died down until 2009 when he grew his collection to 11 machines and began thinking about ways to build his own.  He started designing a new control system, with the P-ROC board at the heart.

Gerry Stellenberg
Gerry Stellenberg

But Gerry wasn’t alone in wanting to build his own machine.

When he got his first machine in 2006 – a Williams Police Force – Adam Preble hadn’t played much pinball.  A software writer specialising in APIs (interfaces which provide other coders with easier access to the software’s core functions), Adam had built his machine using the Arduino hardware & software environment.  This prototyping system allowed Adam to drive a DMD and he was subsequently able to wire it into his Whirlwind’s CPU socket to read the switch matrix and control the lamps and solenoids using his own software.

However, the Arduino hardware wasn’t powerful enough to run a full pinball control system, so Adam discovered the P-ROC and teamed up with Gerry to write the software which would allow game designs and rule sets to be developed.

Adam Preble
Adam Preble

The pieces were falling into place and the P-ROC was becoming something others could use to create their own machines.

Pinball News spoke to Gerry and Adam to find out more about the P-ROC and the two software layers used to control it – libpinproc and pyprocgame.  We began by going back to the system’s origins to see how it was created and the way it subsequently evolved.

Gerry: The P-ROC began as an idea for a controller for a homebrew machine I wanted to build and grew from there. There aren't many off-the-shelf choices for homebrew pinball machine control systems, and those that do exist don't have enough I/Os to control all of the features I was designing into my machine. The project really took off, though, when I decided to design in compatibility with various existing driver boards. After getting some feedback on various pinball forums, I realized the P-ROC was something others could use too. Some were building homebrew machines and others wanted to re-theme an existing machine, and most of them didn't want to design their own control systems.


When designing the board, what features did you think it must have?

Gerry: I tried to come up with a list of features that would cover the needs of all of the existing machines I'd seen. This included support for a bunch of switches, a bunch of drivers, and a dot matrix display. Then I added things that I wanted on my homebrew machine, namely support for frequency controlled infrared switch circuits and the ability to be controlled by a computer over USB. After getting feedback on the initial feature list, I added support for the alphanumeric displays found on early WPC machines.


Why did you opt for an external PC to run the software instead of using an embedded processor on an internal card?

Gerry: The phrase 'external PC' is a bit misleading since the PC doesn't need to be outside of the machine's cabinet, especially with the constant advances we're seeing in single board computers. Regardless, the main reasons I opted for a PC instead of an embedded controller are that I wanted to develop my software with a popular high level language and make use of existing, well supported tools. Also, my custom machine would integrate a full size LCD monitor and would therefore require a control system powerful enough to render high resolution graphics during game play.

I also really liked the idea of separating a game's rules logic from the low level control circuitry. I chose to have the P-ROC take care of all of the low level control circuitry automatically (once configured) so that developers wouldn't need to worry about the low level details when writing their game logic on a PC.


Can you give more details on what low level functions the P-ROC performs?

Gerry: The P-ROC controls all of the electronic control circuits on a pinball machine and automatically manages those circuits without needing constants updates (for driver outputs) or queries (for switch inputs) from the PC. For switches, the P-ROC continuously scans both dedicated and matrix switches for state changes and optionally sends new events to the PC for rules processing. For drivers, the P-ROC is told by the PC what patterns to write to each driver, and then it writes those patterns automatically. For instance, the PC can configure the P-ROC to repeatedly blink certain lamps or to drive a specific coil for a specific number of seconds. Further, the P-ROC can be configured to tie switch events to driver changes so that flippers, slingshots, and pop bumpers can react immediately to switch events.

The P-ROC also controls a dot matrix display. It has multiple frame buffers to ensure smooth animations, and it can drive up to 16 brightness levels for colored effects.


Which generations of machines does the P-ROC currently support and what plans do you have to extend that further?

Gerry: In addition to supporting various homebrew needs, the first revision of the P-ROC supports all WPC machines as well as the last two generations of Stern machines (Whitestar and SAM). This includes most of the Bally/Williams and Stern machines from the last couple of decades. Whether or not the P-ROC is enhanced in the future to support more machines depends on how well the current board is accepted by the pinball community. If there's significant interest, I'd be happy to expand the P-ROC product line.

Gerry with the P-ROC board
Gerry with the P-ROC board

How difficult was it to make a single controller board that supports different generations of machines from multiple manufacturers?

Gerry: Pinball machine control systems are relatively simple compared to the types of products I design for a living. It was fairly obvious to me that supporting the various types of machines required the P-ROC's control circuitry to be highly configurable; so I designed in an FPGA (Field Programmable Gate Array) as the brain of the P-ROC. Whether I chose an FPGA because I use them in my day job or because it's the right solution for this type of product is up for debate, but having over 10 years of experience with them made the design cycle go very smoothly.

The FPGA at the heart of the P-ROC board
The FPGA at the heart of the P-ROC board

The difficulties were figuring out the differences between the various control systems and deciding on configuration options that would make it easy to set things up to work with each system. For instance, WPC and Stern systems use opposite signal polarities on their driver circuits; so the driver polarities had to be configurable. Further, WPC systems use individual enable lines for the various groups of drivers (coils, lamp matrix, etc), whereas Stern encodes the enable lines into a 4-bit bus; so the P-ROC needed a configuration option for choosing how the enables would be driven. The full list of differences includes dozens of items.

The biggest difficulty was putting all of the necessary connectors for each system onto a single circuit board and making that board fit into all of the supported machines. Using an FPGA proved helpful here too as it reduced the need for a lot of external components. I sometimes describe the P-ROC as just an FPGA surrounded by a bunch of connectors. While that's not exactly accurate, there are very few discrete logic components.

The P-ROC board layout
The P-ROC board layout

Does the P-ROC need a high powered computer or one with any special requirements?

Gerry: I guess it depends on the complexity of the game software people might develop, but running game software on par with even the most modern commercial machines is easily done on a minimally-powered PC. Since the P-ROC communicates with a PC over USB, just about any machine running any OS (Windows, OS X, Linux, etc) can control a pinball machine.  Further, USB probably won't disappear from new PCs for the foreseeable future; so the first revision P-ROC should have a very long lifetime.

I've done all of my development and testing using standard desktop and laptop machines, but there are a number of very inexpensive, small footprint single board computers that would likely function very well with a P-ROC and be almost invisible in a machine's backbox.


How difficult is it to install a P-ROC in an existing machine?

Gerry: It's very easy. Disconnect and remove the existing CPU board, install the P-ROC using the appropriate mounting plate, and reconnect the cables. Then move the DMD cable from the DMD controller board to the P-ROC and connect the supplied USB cable to the P-ROC and to a computer. To avoid any confusion, I created a spreadsheet showing how P-ROC connectors map to the connectors on existing CPU boards.


Can a P-ROC be used to modify an existing machine's original software?
Gerry: This question comes up often. A lot of people wish they could change a few features in a machine's original software or even add some new features. Unfortunately, the P-ROC won't help them do that. It does not provide a way to read existing ROM images, and it will not help people obtain original software source code.


What about sound and video? Does the P-ROC provide access to existing machines' sound and video controller boards and the sound and video clips stored on them?

Gerry: The P-ROC does not play audio or video through the audio or video boards in existing machines, and it doesn't provide a mechanism for accessing the sound and video clips from the ROMS on those boards. For audio, sounds are played by the PC, though they can be played through a pinball machine's speakers by either wiring the PC's line-out to the existing machine's audio board or by installing a separate audio amplifier. For video, the P-ROC connects directly to a dot matrix display and therefore does not rely on the control circuitry from an existing video card. However, dot matrix displays need a power source; so it's typically easiest to use the existing video board for that purpose.


If someone wanted to start writing their own software to run on their machine, where would they start?

Gerry: Luckily, Adam joined the project right around the time the first prototype boards came back from manufacturing. He architected a very clean programming interface that makes it relatively easy for people to get started with custom game programming, regardless of their understanding of the P-ROC and low level pinball control elements.

Adam: We decided early on that there should be at least two programming layers: a low level software interface that allows the programmer fairly direct access to the hardware without making any assumptions about how they would want to interact with it (this became known as libpinproc), and one or more higher level frameworks built on top of that low level interface. Right now there's one framework available, pyprocgame. We thought it was important that the developer be able to choose the level at which they wanted to interact with the P-ROC. Additionally, we chose to make the software open source so it's all there for you; you can modify it at any level you like.


What built-in functionality does the pyprocgame give to the game programmer?

Adam: This is an area where we've spent a lot of time in the development of pyprocgame. As you can imagine there's a lot of core functionality that needs to exist in nearly every game, regardless of each machine's theme and playfield features. Things like ball trough management, the service mode, score displays, high score entry, and so on. So we developed a lot of it hoping that new game developers could then spend most of their time implementing machine specific functionality, such as rulesets. Here's an overview of what's available:

  • Basic coil/lamp/switch control
  • Mode-oriented game framework for switch event handling
  • Lamp shows that work by running a "script" text file that looks something like a musical staff
  • DMD management and support for animations, bitmap fonts, layers, etc.
  • Ball/Player/Score tracking
  • Service mode with standard switch, lamp, coil tests
  • Trough management, ball save, and ball search
  • Drop target modes
  • High score entry

I should emphasize that although we've provided this core functionality, you can easily use or not use whatever you like. If you don't like the way the score display works, you can write your own to take its place. Or you can modify ours, since the source is provided.

A few weeks ago I made a video that demonstrates a few of these built-in features. Keep an eye out for the lamp shows and the DMD demos, particularly at the end.

Just to give you an idea of how simple it can be to generate some pretty cool effects, one of the more recent things I've been working on is 16-color DMD support in pyprocgame. You can see the results in the following video.  The program that generates this effect is pretty basic. It's about 70 lines, including whitespace, and the most complicated part of it is just changing the direction of the movement when it reaches the edge of the frame.

What kind of programming knowledge does someone need to have if they want to write their own game?

Adam: It's important to have some basic programming knowledge. If you've ever taken an "Intro to Computer Science" class you'll be in good shape. In order to take full advantage of pyprocgame, you'll want to know a bit of Python and have a fair understanding of object oriented programming. Gerry spent some time putting together a full example game for Judge Dredd. This makes a great resource for figuring out how to use pyprocgame. We also have a skeleton game that you can use as a starting point for any other game you want to develop.


Why did you choose Python as the programming language for pyprocgame?

Adam: We had a few criteria for the language: that it be available on Windows, Mac, and Linux, reasonably speedy, fairly easy to understand for newcomers, and that it be a dynamic language. I think Python fits those criteria pretty well. With pyprocgame we're able to run our main game loop at upwards of 400 cycles per second, which is more than fast enough. In fact, anything over about 30 cycles per second would suffice. It also has some nice features which enable us to provide unique features in pyprocgame like handling specific switch events by simply defining a method in a class. You can even define a switch handler method that only triggers after a switch has been closed for X milliseconds. This is really useful in pinball for cases where you need to wait for the ball to settle before taking action.


Is this powerful enough to make a game that's commercial quality?

Adam: I don't want to be too bold here, but yes, I believe it is. It would take a lot of work, but we've packed a lot into pyprocgame: lots of DMD graphics support, including very clean score displays, and we think the overall architecture of the mode system it employs gives developers the power they need to create a real game. We don't provide much in the way of sound effects and music, but the pygame library can be used to add that. The hardest part is going to be the artwork and, as with any game, creating a fun and interesting ruleset and adding polish.


Does the combination of a P-ROC and computer enable game features that aren't possible with the original CPU boards?

Gerry: Absolutely! Having a PC running the game software makes it possible to integrate any number of new features into pinball machines. One idea I'd like to see implemented is adding network support to allow people to choose which software to run from an online repository, to track player and game statistics online, and to allow head-to-head competitions or to have multiple players in different locations playing a cooperative, multi-player game. Another idea I've seen discussed is using an external device like a keyboard or mobile phone to control aspects of a machine. In reality, the number of new features this system supports is limited only by the imaginations of the people developing new game software.


How would you like to see P-ROC-based projects develop in the long term?

Gerry: Besides just seeing people write their own custom games, I would love to see some people in the pinball community get together and write commercial quality, open source games. Pinball is loved by a highly diverse group of people. I've personally met extremely talented hardware engineers, software developers, sound engineers, and artists who share a love for pinball. I have no doubt that they are capable of getting together and creating game software that rivals the polish of existing game software. The machines we all own are platforms capable of providing endless hours of entertainment, but it sometimes becomes boring to play the same software over and over again. High quality, custom game software could extend the lives of the machines in our homes and possibly even make them seem new again.


Where can people go for more information about the P-ROC and pyprocgame software?

Gerry: www.pinballcontrollers.com has P-ROC product information and both a wiki and a forum where people can post information about their projects or learn more about the P-ROC and associated software efforts. Adam and I post our own progress to the forums, and we monitor them frequently. If people have additional questions, they can either post them to the appropriate forum or email me directly at [email protected].


The P-ROC is available to purchase right now, with different mounting options available for WPC, WPC95 and Stern host machines.  It can also be bought without any mounting hardware if you are building your own machine from scratch.

The price excluding shipping is $329 for WPC variants and $334 for Sterns, including the USB cable to connect it to a computer. Orders can be made through the pinballcontrollers.com site.

 

Back to the Learn page

Back to the front page