missionpinball / mpf

Mission Pinball Framework: Open source software to run a real pinball machine.
http://missionpinball.org
MIT License
217 stars 143 forks source link

Physically compensate balls in multiball_locks on ball start #1278

Open jabdoa2 opened 5 years ago

jabdoa2 commented 5 years ago

If the device in the lock has a path to the trough compensate from it at player turn start time before ejecting a ball to the playfield.

evilmopey commented 5 years ago

I would really like to try and solve this issue. but let me make sure I understand it since I have a very casual knowledge of pinball. Once you hit all of the required ball locks for a multiball all of the paths to the trough will be blocked off for enough time to allow balls to get past the trough and then the paths will open again.

while looking at the multiball_lock.py and doing background research I have a few questions: The trough is the the part at the bottom of the machine that leads the ball out of play? What part of the Pin Ball machine would block the trough?

Sorry for the long post and thanks for your time

jabdoa2 commented 5 years ago

Hi evilmopey,

Pinball machines are multiplayer machines. Every player has multiple ball (usually 3) and player take turns (player 1 ball 1, player 2 ball 1, player 1 ball 2 and so on). Consider a machine with a lock (called multiball_lock in MPF) which will give you some multiball. If you lock a ball on your first ball and then your loose your (new) ball before starting the multiball the ball will still be physically there for the next player. There are multiple strategies about what happens when the next player completes the lock and starts the multiball leaving you with an empty lock on your next ball (see http://docs.missionpinball.org/en/dev/game_logic/multiballs/multiball_locks.html for the four strategies in MPF). If you selected the "virtual_only" strategy MPF will give you a multiball nontheless and compensate the missing balls from the trough (where the balls which are not in play are stored below the apron: http://docs.missionpinball.org/en/dev/mechs/troughs/index.html). In some machines it is physically possible to "feed" a ball from the trough (via the launcher http://docs.missionpinball.org/en/dev/mechs/plungers/index.html) directly into the lock (often via a controllable diverter http://docs.missionpinball.org/en/dev/mechs/diverters/index.html). MPF knows how to route those balls (if there is a route). The lock has to request a ball in this case (via a ball_device.request_ball() call to the lock ball device). Makes sense? Let me know if anything is unclear.

evilmopey commented 5 years ago

Thank you for the detailed response it really helped me gain clarity. The one area I am still confused about is how min_virtual_physical differs from physical?

P.S. I am working on the solution and will submit a pull request this weekend.😄

jabdoa2 commented 5 years ago

The four counting strategies are a bit tricky but each of them was used in a certain area of pinball machines. min_virtual_physical = locked ball are counted virtually. If another player steals a ball physically you have to relock them (mostly because the machine does not have an auto launcher). However, this does not allow stealing balls. Physical = physical balls are equivalent to locked balls. This allows ball stealing.

evilmopey commented 5 years ago

I submitted a pull request last night I look forward to any feed back.

jabdoa2 commented 5 years ago

Can't find the PR. Can you post a link to the PR or to your branch?