Skip to content

Commit

Permalink
Merge pull request #535 from arthurkehrwald/patch-3
Browse files Browse the repository at this point in the history
Fix ball devices page
  • Loading branch information
avanwinkle authored Nov 29, 2024
2 parents 3e62e51 + ac641d0 commit 4bd636a
Showing 1 changed file with 1 addition and 98 deletions.
99 changes: 1 addition & 98 deletions docs/mechs/ball_devices/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,104 +49,7 @@ Here's a diagram which shows the relationships between the various
states. A device can only transition from its current state to one of
the states an arrow is connected to.

![image](/mechs/images/ball_device_fsm_diagram.png)

When you configure ball devices in MPF, you configure the list of other
devices that a ball device can eject to. This allows MPF to have an
understanding of the "chain" of devices and enables it to route balls
to where they need to go. ([Diverters](../diverters/index.md) also figure into this chain, meaning MPF can ensure that
diverters are set properly as it's routing balls around.)

Here's a simplified example of how the "chain" of ball devices works:

A simple modern machine would have a minimum of three ball devices:

* The trough
* The plunger lane
* The playfield (remember in MPF, the playfield is technically a ball
device)

When you configure your ball devices, the trough is configured so that
the plunger lane is its eject target, the plunger lane is configured
with the playfield as its eject target, and the playfield is configured
to know that it drains into the trough. So you have a complete loop of
devices.

This means that, for example, if the playfield wants another ball (like
for a multiball), MPF knows that the playfield gets balls from the
plunger lane, and if the plunger lane doesn't have a ball, MPF knows
that the plunger lane can get a ball from the trough.

Pretty cool!

Of course in a real machine, you'll have a lot more than the three ball
devices listed above.

Picking a random machine as an example, *Judge Dredd* has eight(!) ball
devices:

1. [The trough](../troughs/index.md)
2. The right [plunger lane](../plungers/index.md)
3. The left plunger lane
4. The Sniper VUK
5. The Hall of Justice VUK
6. The Deadworld orbit thingy
7. The crane
8. [The playfield](../playfields/index.md)

MPF keeps track of how many balls are in each ball device at all times,
and it knows which devices are in the process of ejecting (and which
target devices they're ejecting to), so it also knows if balls get
stuck along the way.

Ball devices support all sorts of settings and events. You can also
configure counting delays to account for balls bouncing around before
they settle, you can specify how devices confirm that balls have
successfully ejected, as well as dozens of other options that allow MPF
to support every known type of device in every pinball machine ever
created. (Seriously.)

A *ball device* is any physical thing in a pinball machine which is able
to hold (i.e. "capture") a ball and then release it. (Either
automatically or based on some action by the player.) Examples of ball
devices include the trough, the plunger lane, VUKs, poppers, playfield
locks, etc.---basically anything that can hold a ball. (Even the
playfield is technically a ball device since balls rolling around are
"in" the playfield device.)

Ball devices are usually made up of switches (which are typically used
to count how many balls the ball device has) and coils (which are
typically used to eject a ball from a device.) Most games have several
ball devices. At a minimum they'll have the device that holds the ball
when it drains and the playfield.

Ball devices are probably the most important element of MPF (because no
one likes it when a machine gets confused about where the balls are) and
something we've spent a lot of time on. They work hand-in-hand with
MPF's Ball Controller to keep track of where all the balls are at any
given time.

In MPF, ball devices are implemented as [finite state
machines](https://en.wikipedia.org/wiki/Finite-state_machine).

Each ball device is responsible for managing its own state, which can
be:

* idle
* missing_balls
* waiting_for_ball
* waiting_for_ball_mechanical
* ball_left
* wait_for_eject
* ejecting
* failed_eject
* eject_confirmed

Here's a diagram which shows the relationships between the various
states. A device can only transition from its current state to one of
the states an arrow is connected to.

![image](/mechs/images/ball_device_fsm_diagram.png)
![image](/docs/mechs/images/ball_device_fsm_diagram.png)

When you configure ball devices in MPF, you configure the list of other
devices that a ball device can eject to. This allows MPF to have an
Expand Down

0 comments on commit 4bd636a

Please sign in to comment.