Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a ball event raised during multiball when at max ball count causes issues once all balls drained from playfield #1857

Open
bernarma opened this issue Dec 11, 2024 · 4 comments

Comments

@bernarma
Copy link

I have a multiball configured at the start to be the maximum for the machine - 6 balls. There are add a ball events. If an add a ball event is triggered when the maximum number of balls are active on the playfield a warning is raised in the log file (which is correct), but there is an undesirable effect on the game logic after all balls drained (which can be seen in one of my game unit tests).

I have confirmed before the ball drains that there are no active ball saves. If I remove the add-a-ball event from being handled, no ball from the trough is attempted to be sent back into the playfield, if I leave the add-a-ball event in, see the warning during multiball, drain balls after all active balls saves have expired, the multiball still ends but when all balls drain, the bonus mode starts but balls are pushed back into the playfield.

I would assume that the engine would handle this logic (as opposed to placing conditions around the add-a-ball event). Would this be safe to assume?

If this description is sufficient I'll leave it as that, otherwise if further information is required, I'll setup a test MPF project to replicate the problem.

@avanwinkle
Copy link
Collaborator

This is expected behavior, because the conditions of add-a-ball during multiball are not obvious one way or the other. In some situations (like yours) the add-a-ball should only add up to a certain number of balls, but in other situations the added balls should be saved so that the player still earns them and reaps the benefits.

We try and avoid deriving game logic from the max balls number, because that number doesn't guarantee the number of available balls in play (e.g. plenty of games have more balls than are needed at any one time, which allows them to continue functioning if one gets stuck and the operator isn't around to liberate it).

Therefore in your situation, a condition on the add-a-ball is appropriate. I would set the condition based on the balls_in_play value rather than max_balls, for the reason noted above.

@bernarma
Copy link
Author

Thanks... that makes sense and I am happy to add the guard condition (which is what I did as my workaround after I posted), but I still have this major issue...

If I miss a guard condition on the add a ball event when it fires, a warning is raised (expected behavior)...

But... during that multiball once balls start draining, I have had numerous problems (which is repeatable in every case) where it would act as if all balls have drained even when multiple balls are still active on the playfield and then ends the multiball prematurely and the current ball resulting in a ball_ending event.

This I do believe to be an issue.

@avanwinkle
Copy link
Collaborator

That's entirely likely, MPF is known to have some challenges when it comes to counting balls. Typically this can come from:

  • multiball_locks and multiballs locking physical balls and misconfigured replacement strategy
  • ball devices having entrance/eject settings such that some balls are never detected and ejects "fail"
  • unexpected balls entering the playfield (double-ejects, usually) greater than the number of balls in play

If you can share a sample minimal mode and logs, we should be able to see where the ball count is getting wrong and see what device needs to be adjusted. Thanks!

@bernarma
Copy link
Author

I am looking into this problem further... I created this unit test locally in the MPF project - test_MultiBall.py.

I also added this entry to the config.yaml file for that multiball file.

machine:
    balls_installed: 3
    def testAddABallWhenAtMaxBalls(self):
        self.fill_troughs()
        self.start_game()
        self.assertAvailableBallsOnPlayfield(1)

        # start mb
        self.post_event("start_or_add")

        # three balls on pf
        self.advance_time_and_run(10)
        self.assertEqual(2, self.machine.playfield.balls)

        # add a ball
        self.post_event("start_or_add")
        self.advance_time_and_run(10)
        self.assertEqual(3, self.machine.playfield.balls)

        # add a ball when at max balls in table
        self.post_event("start_or_add")
        self.advance_time_and_run(10)
        self.assertEqual(3, self.machine.playfield.balls)

I would have expected the playfield to report 3 (last line) but instead it reports 4. Looking at the code for multiball I can't see any reference to the maximum balls in the pinball machine but it should influence the playfield count as it is physically impossible for the playfield count to exceed the actual balls available unless this value represents the virtual number of balls on the playfield.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants