Detect stuck balls
Problem
Inevitably, the ball will get stuck occasionally. Sometimes due to the physics engine, sometimes due to an oversight in the table design. It would be good to have some kind of reset mechanism when this happens. There are two problems here: Detecting when a ball gets stuck, and making it 'unstuck'.
Detection
The easiest solution I can think of would be to check whether the ball is moving around. The algorithm would go something like this:
- Record the ball's position x times per second
- Check if distance between the two furthest apart points recorded in the past y seconds exceeds threshold z
- Also check if the player is holding down a flipper button or, alternatively, if the ball is in contact with a flipper. This ensures the ball won't be reset when held by a flipper. The only problem I see with this is that it could still lead to false positives when table authors trap balls in the play field intentionally. Maybe we could allow author's to place triggers that suspend stuck detection for any balls inside.
Resolution
Teleport the ball back to the exit kicker and eject it into the plunger lane. Log a warning to communicate what just happened to the table author.
Well, table nudge will eventually be implemented. Don't you think that'll be sufficient? For VPX, it seems to be the case anyway.
I'll weigh in here with my own opinion. I would prefer to follow as close as possible to how real tables work - i.e. as @freezy suggested, nudging to dislodge the ball from wherever it got stuck.
If that fails implementing a "reposition ball function" to simulate how it is done in tournaments. The director is called over, the glass lifted, the ball is "located" and repositioned at their discretion to a specific location. This location would be defined during table design (so table designers would have to add support for this once the feature is implemented). This exists over and above existing ball search functionality.
I see this working as follows:
- ball stuck on left of playfield (within bounds), reposition to lower left flipper (must be cradled up)
- ball stuck on right of playfield (within bounds), reposition to lower right flipper (must be cradled up)
- ball stuck in other location (i.e. it fell off the table or out of table boundaries), place into plunger lane
In a way, this feature could be turned on / off for all tables without any change to the actual table design other than a couple of typical set of coordinates to position the ball at various places and a standard way of handling balls (including active and not active).
Just my 2 cents worth.
Sounds good - but the tricky part is still the detection. Rather than just looking at the flipper when the ball doesn't move, which doesn't cover all the other zillion use cases authors will come up with for blocking balls deliberately, I would instead go like this:
Given that no ball is moving:
- Wait x seconds for ROM ball search, timer resets on key press
- Wait y seconds for table nudge, resets on key press other than nudge
- Wait another z seconds for ball movement
- If still no ball movement, show a non-blocking notification to the player that by pressing
<whatever key>, they can reposition the ball (like @bernarma described) - Keep the ball reposition function active for n seconds, or disable it after execution.