Fun With Pinball

Game Design Example

Designing a game from scratch like those on the Games page may seem like a daunting task at first, but like many design problems it breaks down into several simpler, easier to understand problems.  Using The Puzzle game as a guide let's recreate parts of its design from the ground up using its component parts.  It might be useful to review the video at the end of The Puzzle's description to better understand the steps below.  If switches and electric current are unfamiliar, a visit to the Switches and Electric Current lesson might be helpful.

Standard Relays vs Trip Relays

The Puzzle uses two different kinds of relays to manipulate most of its switches: standard relays and trip relays.  Standard relays activate only when an electric current passes through their coils and then relax and return to their rest position (with the help of a spring) when the current is cut off.  Since the relay coils consume power and can heat up when active, standard relays are usually activated for only short periods of time.

The coils in trip relays are also active only when an electric current is applied, but they are built into a spring loaded assembly that trips when the coil is activated and stays tripped until mechanically reset by a separate solenoid.  (Trip relays behave much like circuit breakers that trip electrically, but need to be mechanically reset.)  Trip relays can remain in either the set or the tripped state indefinitely without consuming any power and are used to hold a bit of information for longer periods of time.

In other words, standard relays can only indicate whether or not something is currently activating the relay while trip relays indicate whether the coil was activated at any time since the relay was last reset.  In The Puzzle, trip relays control the six lights that indicate how much of the combination has been uncovered.  Once at trip relay has been tripped, its light turns on and stays on until the game is reset at the start of the next game.

Rules, Equations and Circuits

The game behavior is determined by a set of rules.  These rules can be described with sentences or as a set of equations.  Sentences are helpful for understanding or explaining the game behavior to someone else.  Equations are useful for designing the circuits that enforce the rules.

As a brief introduction consider a simple vending machine that counts credits and lights a bulb when 2 credits have been received.  The vending machine accepts tokens worth either 1 credit or 2 credits.  The rule for this part of the vending machine would be:

  • Light the bulb when one 2 credit token or two 1 credit tokens are deposited.

The equation for the vending machine could be:

  • (Light the bulb) = (2 credit token deposited) OR ((first 1 credit token deposited) AND (second 1 credit token deposited))

This equation and others below use a form of simplified algebra called Boolean algebra, sometimes called Boolean logic.  In Boolean algebra, all results and variables are limited to just two values: true and false (or 0 and 1, or on and off); no other values are used.  And there are just three basic functions used: AND, OR and NOT.  While this may seem like a trivial way to represent a rule it is in fact the way most digital semiconductor chips are designed and developed.

The equation above can be translated into a circuit using an arrangement of switches.  Note that the symbols used for switches are those used by electromechanical pinball machine designers through the 1970s.  They are not to be confused with the symbols used for capacitors which won't be used in this discussion.

Puzzle_Design_symbols_1Switch symbols used in EM pinball machine schematics

Using these switch symbols the circuit for the vending machine equation might look like this:

Puzzle_Design_vendingCircuit for the simple vending machine

Here the battery provides electric current to the light bulb, but the bulb only lights if the top switch closes, OR if both of the bottom switches close.  The two bottom switches are connected in a line, or in series, so current can only flow through them if both are closed.  This matches the AND part of the equation from above.

The two bottom switches are wired along side, or in parallel with, the top switch.  This matches the OR part of the equation.  Together the arrangement of the switches matches the equation and the rule from above.

The First Trip Relay

In The Puzzle, trip relays are used to indicate how much of the combination has been identified.  As each correct button is pushed in the sequence, a trip relay is activated which turns on one of the indicator lights.  The rule for the first trip relay is very simple: activate the first trip relay when the first button of the combination is pressed.  The equation would just be:

  • (Activate Trip Relay 1) = (1st combination button pressed)

The circuit for this equation might look like this:

Puzzle_Design_sch_1A circuit to activate Trip Relay 1

Here the coil for the first trip relay is activated only when the switch under the first button in the combination is pressed; all other combination buttons are ignored.  Once the button is pressed Trip Relay 1 will remain tripped until a new game is started.

The Second Trip Relay

The rule for the second trip relay is a little more complicated: activate the second trip relay when the second button of the combination is pressed, but only if the first button of the combination has already been pressed.  The equation would be:

  • (Activate Trip Relay 2) = (Trip Relay 1 is tripped) AND (2nd combination button is pressed)

The circuit for this equation could be:

Puzzle_Design_sch_2A circuit to activate Trip Relay 2

In this circuit, the Trip Relay 1 switch in the middle represents a switch that is normally open as shown here, but closes when Trip Relay 1 (from the previous circuit above) has tripped.  With two switches in its circuit, Trip Relay 2 will only activate after Trip Relay 1 has been activated and when the second combination button is pressed.

Trip Relays 3-6

This same rule can be used by all the remaining trip relays if it is generalized to: activate the trip relay if the correct button is pressed and the previous trip relay has already been activated.  The circuits for Trip Relays 3-6 below look the same as the circuit for Trip Relay 2 above:

Puzzle_Design_sch_3A circuit to activate Trip Relays 3-6

The Score Reels present a problem

While the player tries to determine the combination, The Puzzle counts the number of times any of the combination buttons was pressed on a pair of score reels on the back of the game.  Each score reel works with a single solenoid that advances the score by one each time the solenoid is activated.  The rule for the score reel is just: add one to the score reels when any combination button is pressed.  The equation would be:

  • (Add 1 to the Score Reel) = (1st button pressed) OR (2nd button pressed) OR (...) OR (6th button pressed)

The circuit for this equation could be:

Puzzle_Design_sch_4A circuit to activate the Score Reel

While this circuit would work, the switches from the six combination buttons were already used in the trip relay circuits above.  Each switch can only be used once so we could only use the trip relay circuits or this score reel circuit but not both.

Creating copies of switches

To get around this problem we can use standard relays to close two switches each time one of the combination buttons is pressed.  This provides copies of each combination button switch that can be used in different circuits.  For example:

Puzzle_Design_sch_5A circuit to create copies of switches

With this circuit, the Button 1 Relay (A) switch and the Button 1 Relay (B) switch behave the same as the 1st combination button switch so we can use one in the trip relay circuit and the other in the score reel circuit.  This demonstrates how a standard relay can be used to generate multiple events (trip a relay and advance the score reel) from a single event (press a button).

To create copies of all six of the combination button switches we need a relay for each one:

Puzzle_Design_sch_6Relays to create copies of the combination button switches

Note that the circuit drawing does not specify how many switches each of the Button Relays has.  Ultimately each relay will need to be configured with as many switches as the design requires.

The revised Trip Relay circuit

Now that copies of the combination button switches are available the Trip Relay circuit can be revised to use them:

Puzzle_Design_sch_7Revised Trip Relay circuit using copies of the button switches

The revised Score Reel circuit

And the Score Reel circuit can be revised to use its own button switch copies:

Puzzle_Design_sch_8Revised Score Reel circuit using copies of the button swtiches

But there are two Score Reels

You may have noticed that the circuit above only works for the 1s digit score reel.  The 10s digit score reel should only advance when the 1s digit is 9.  If the 1s digit is not 9 only the 1s digit advances (e.g. from 08 to 09), but if the 1s digit is 9, both score reels advance (e.g. from 09 to 10) .  Note that there is a switch built into most score reels just for this purpose that closes when the score reel is in the 9th position.

So the rule for the 10s digit score reel is:

  • Add 1 to the 10s digit score reel each time a button is pressed if the 1s digit score reel is 9.

Or the rule could be reworded to:

  • Add 1 to the 10s digit score reel each time the 1s digit score reel advances if the 1s digit score reel is 9.

The equation for the 10s digit score reel is:

  • (Add 1 to the 10s score reel) = (Add 1 to the 1s score reel) AND (1s score reel is 9)

And the circuit for both score reels becomes:

Puzzle_Design_score_reelsCircuit for the 10s and 1s score reels

The schematic above shows that any button press will activate the 1s score reel, but the 10s score reel only activates if a button is pressed when the 1s score reel is in the 9th position.

Starting a New Game

More complicated circuitry is required to start a new game.  The first thing that needs to happen in any pinball machine or similar game like The Puzzle is that the hardware needs to be reset to a known starting point.  In this case the score reels need to be reset to 00 and the lights all need to be turned off. 

The score reels need to be reset to 00 from whatever arbitrary score was left from the previous game.  The tricky part is that the score reels have no way of knowing what score is showing on the reels and no way of knowing how many times they need to advance to return back to 0.  Early game designers realized however that you don't really need to determine how many times a score reel needs to advance to reach 0, you just need a way to stop advancing once you reach 0.

This observation simplifies the design, and is the reason that score reels have two circuits built into them.  One circuit advances the score reel unconditionally when the score reel is activated and is used to accumulate points during the game.  The other circuit advances the score reel only if the score is not showing 0.  This circuit is used at the beginning of the game to reset the score reels to 0.  A simple score reel circuit might look like this:

Puzzle_Design_sch_9A simple score reel circuit

To see the difference in how the two circuits behave, watch the video at the end of the Score Reels section.

Now that we have a way to stop the score reels from advancing past 0, the question remains: how many times must the score reels be activated to reset all scores back to 00?  (Remember that each time a score reel is activated it advances just one position.)  The answer is that each score reel will need to advance up to nine times to reset back to 0.  If a score reel is showing a score of 9 it only needs to be activated once to reach 0, but if it is showing a score of 4 it needs to be activated six times to reach 0.  The worst case is a score reel showing 1, which needs to be activated nine times to reach 0.  A score reel showing 0 will not advance during reset since the switch that opens when the score reel shows 0 prevents any further advancement.

What pinball machines, and The Puzzle do to reset score reels to 0 is to try to activate each score reel ten times through the reset circuit that will stop the reel at 0.  This guarantees that whatever score is showing before the game is reset will end up at 00 by the end of reset.  The reason reels are activated ten times, and not the minimum nine times will become clear in a moment.

The Score Motor is used to open and close the switches that activate the score reels during reset.  Each group of switches on the score motor activates at a specific time as the motor turns, as shown in the Motor Sequence Chart:

Motor Sequence ChartMotor Sequence Chart

In this chart the black rectangles indicate when and for how long each group of switches on the score motor is activated when the score motor runs through one cycle.  For example the switches in group 1C activate once at the very beginning of the cycle, while those in group 4A activate five times during the cycle. Watch the first video in the Score Motor section for a better understanding of how the motor sequence chart describes the actions of the score motor.

The Puzzle uses one of the switches in group 4A to activate the reset circuits in the score reels.  The score motor is in fact activated for two consecutive cycles during reset so the switch that resets the score reels closes ten times, guaranteeing that any remaining score will be reset back to 00.  The Puzzle could try to close some other switch the minimum required nine times, but that would be an unnecessary complication.  The tenth switch closing is just ignored by the reset circuit in the score reels.

Rules and equations can certainly be used to describe the following circuit for resetting the score reels but until the meaning of the various relays and switches is understood the rules and equations would only confuse the issue.  Instead, the circuit is explained as a sequence of events below.

Puzzle_Design_sch_10Circuit for resetting the score reels

Referring to the Motor Sequence Chart above will help to clarify the following sequence of events defined by this circuit.

The Reset 1 relay at the top of the schematic drawing activates when the player presses the Reset button to start a new game.  While the player might push the button just momentarily, the Reset 1 relay remains active because it closes a switch (on the 2nd line of the drawing) that keeps it active after the Reset button has been released.

When the Reset 1 relay activates, it closes another switch that in turn activates the score motor (in the middle of the drawing) and starts it running.  As the motor runs through its first cycle, a switch mounted to it in group 4A closes repeatedly (at the bottom of the drawng) which advances both score reels unless they have reached 0.  In this first cycle, the score motor closes the 4A switch five times advancing each score reel up to 5 places.

Near the end of the first cycle, a motor switch in group 1B (third line of the drawing) closes, which combined with a switch from the still active Reset 1 relay activates the Reset 2 relay.  Just after the Reset 2 relay is activated, a motor switch in group 4C opens (2nd line of the drawing) which deactivates the Reset 1 relay.  At the end of its first cycle, the score motor keeps running into its second cycle because a switch on the Reset 2 relay is closed (middle of the drawing).

During the score motor's second cycle, the switch in group 4A closes five more times to complete the resetting of the score reels.  While that's happening, a motor switch in group 4B (4th line of the drawing) opens which deactivates the Reset 2 relay.  At this point the only thing keeping the score motor running is a motor switch in group 2B (middle of the drawing).  This switch opens at the very end of the cycle and lets the score motor come to a stop without entering a third cycle.

While the score reels are resetting during two consecutive motor cycles, the trip relays need to be reset too so the lights go out in preparation for a new game.  This is done with a single large solenoid below the trip relays.  It activates briefly at the end of the first motor cycle (just after the Reset 2 relay activates) when a motor switch in group 4C closes as shown here:

Puzzle_Design_sch_11A circuit to reset the trip relay bank

Even though the motor switch in group 4C above closes once in each motor cycle, the large trip relay bank reset relay doesn't activate again during the second motor cycle because by then the Reset 2 relay has deactivated and the rightmost switch above has opened.