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.
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:
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.