A Tale of Pinball and Programming
Ever since I was a young boy I played the silver ball
These words will surely sound familiar for The Who fans, and will probably ring true for people who like Pinball.
Pinball is an old game that is still being played and produced to this day. Its origins are debatable, given how it changed throughout its history, but it is safe to say that it reached its most recognizable form as a game where a ball moves on top of a tilted board, the ball is plunged up by a spring launcher and you can shoot the ball at various targets with the aid of two or more flippers, all while you avoid the ball being drained in the bottom of the table.
Pinball is a mechanical game in nature, physics does all the heavy lifting of the game: gravity pulls the ball down towards lanes and flippers that shoot the ball up, hitting and bouncing off of all sorts of gadgets. The table reacts to the player through lights, sounds, shakers and displays, being triggered by different sets of switches and solenoids in an intricate set of rules that increase your score – tracking your progress and allowing you to compete with other players for high scores.
Lower playfield of Stern’s 2022 Rush during a multiball mode. Three balls are being juggled using the flippers avoiding the drain down in the middle.
As a kid, I was fascinated with this game. I had a corridor in my house that was slightly tilted like a Pinball playfield, and I used to mock Pinball tables in that corridor with bricks, shoes, toys and everything else I could find. I would spend my time with a rubber ball there, coming up with the craziest designs I could think of.
Pinball machines are actually very expensive so having a machine at home is very rare. With the boom of home consoles, an alternative for going to an arcade and spend your quarters to play some ball was to have a digital Pinball game for your console. Not the same as a real machine, but still cool regardless. Two games that I played at lot were Sonic Spinball and Crüe Ball, both for the Sega Genesis, with the latter being my favorite: a Pinball game with a banger soundtrack where you destroy brains, skulls, tornadoes, statues and speakers in a mission to turn a volume knob to 10 so that Heavy Metal can rule the world.
Crüe Ball by Electronic Arts, 1992, on the Sega Genesis. Heavy Metal, VU meters, crawling brains, drop targets that spell BANGER.
Computers found their way out of the offices into regular homes as PCs, naturally they also had their own share of digital Pinball games for leisure. It’s fair to say the most known example is Space Cadet, the 3D Pinball game that came bundled with Windows. I would play Space Cadet trying to complete all the missions.
I eventually grew tired of playing Crue Ball and Space Cadet over and over, I wanted new Pinball games for the PC and a search for new games led me to a discovery that would change everything.
Visual Pinball⌗
I was searching for new Pinball games when I came across Visual Pinball. This one was different from a mere Pinball game, it was a program that allowed you to create, edit and play your own Pinball tables.
I was thrilled with the prospect of creating my own Pinball. I installed it and quickly found my way through the editor that was actually intuitive – at least for someone already familiar with Pinball.
The program also came with simple templates that you could use as a starting point, I would create one from a template and add my own ideas to it, adding bumpers, ramps, kickers, spinners, lights, all of the stuff normally present in a Pinball table. I had some fun with my designs – well as best as I could design a table anyway – but there was one serious problem: none of the things in the table were actually interacting with the ball as one would expect them to. My Pinball tables were stagnant and boring.
Interface showing the playfield in its editable state
The crucial part of a Pinball game is how things interact when they get hit by the ball. Points are scored, lights flash in sequence, messages appear on the display, targets are dropped, bonuses are added – this is what makes Pinball fun and that’s what my tables were lacking.
The two tables that came with the download, however, were not lacking any of that. One of them was an original design, straightforward yet fun to play, but the other one was a replica of High Speed by Williams.
The replica was extremely detailed, it had all the original artwork layered and textured onto the playfield, walls, posts, bumpers and spinners, and mostly importantly for my endeavors, the game rules were implemented as the original. I am not sure if including all of this artwork was legal – or even if this table was officially packaged by VP devs or just bundled by whoever hosted the installer – but it showcased how the VP engine could be used to bring classic Pinball machines to the PC, even ones full of intricate details and rules.
Upper playfield of Williams’ 1986 High Speed, showing bumpers, targets, spinners, lights, a ramp with diverters, orbits, a kicker and an upper flipper. Not an easy task to replicate in Visual Pinball.
Scripting⌗
Then how did Visual Pinball managed to make this table work as the original? The name of the program was a hint all along, there was a window in the editor where you could script the table using Visual Basic.
Script window showing table code
The template tables had basic scripting to them, yet I had no idea how any of that worked, all I saw was a bunch of funny colored text. But I could load the High Speed table and see the script in all of its glory. I didn’t have a manual or tutorial of how this worked – not that it would have helped me greatly anyway – but I had a full working reference at hand, one that I could edit and test the changes by playing in it.
Curious, I started scrolling through the lenghty code spotting interesting bits. The items that were placed in the editor had all unique names, and I could find the same names being referenced in the code, things like:
Sub bumper1_hit()
AddScore 50
PlaySound "bumper.wav"
End Sub
AddScore 50
, I wonder what that does… Well, I played the table, I know what happens when the ball hits the bumper, it adds 50 points to the score, that’s gotta be it. Okay, maybe I should copy this to my own table… what, an error? This stuff is hard. Look, there’s aSub AddScore(pts)
somewhere else in the script, it has some code that does addition, looks like there is code to update a display in it too. Cool, this seems to be working now, I can add points to my table! I wonder what else I can do with scripting…
For anyone with coding experience this will look very obvious. The game scripting was based on events, the Visual Pinball engine invoked functions based on the name of the item on the table and what type of event that triggered it. Entities had events that you could subscribe to by creating a function and properties that you could change from anywhere in the code. The table would reflect the properties being changed and this allowed the game to work like a proper Pinball machine.
That ignited my interest in programming. I wanted to script my own Pinball tables, that led me down a path to figure out what were variables, conditionals, functions, loops… and bugs of course. I could make the table do whatever I commanded it to, I was unstoppable – except when I had a typo somewhere. I wasn’t a mere user of the computer anymore, the computer became my creation tool, it was doing things that it didn’t know how do before, all I needed was to figure out how to speak its cryptic language.
Soon enough that would expand to other things in the computer. It all had to be coded somehow, I just needed to learn how to do that outside the confines of the script editor of a Pinball emulator.
That was my first experience with coding. My curiousity would have probably led me down this path in one way or another, but I can’t help but think fondly of how Pinball got me started with programming.
References⌗
https://www.ipdb.org/machine.cgi?id=6845
https://www.ipdb.org/machine.cgi?gid=1176
https://armchairmaestro.com/2020/04/04/music-meets-gaming-crue-ball/