(Topic ID: 254006)

Teaching "Machine Learning" / AI to play Pinball?

By okayestpinballer

4 years ago


Topic Heartbeat

Topic Stats

  • 14 posts
  • 10 Pinsiders participating
  • Latest reply 4 years ago by jackd104
  • Topic is favorited by 1 Pinsider

You

Linked Games

No games have been linked to this topic.

    Topic Gallery

    View topic image gallery

    wargames (resized).jpg
    pin_ml (resized).png
    #1 4 years ago

    Are there any examples of people using ML (Machine Learning) / AI to play pinball? How do the "machines" end up playing? I know a tiny amount about ML, but not enough to really understand what is trying to be achieved. Is it something as simple as attempting to hit the moving ball with the flippers to keep it in play or to actually learn the rules of a specific game and shoot the correct shots to achieve a high score?

    The topic is something I've always wondered about, but the post here was inspired by a Tweet I saw today:
    https://twitter.com/simonwaight/status/1184280497607700482

    Pinball AI/MLPinball AI/ML

    Then there is this Reddit post where someone used ML/AI to teach an iPhone (and some extra hardware to flip the flippers / press Start, etc) to play Pinball:
    https://www.reddit.com/r/MachineLearning/comments/744lb8/p_pinball/

    Know of any others?

    We have self-driving cars, but do we have self-playing pinball games?

    #2 4 years ago

    I think the AI would have to know the machine rules. There is a video where this was done with super mario bros. The AI would learn to progress by not dying. It knew what death looked like in memory is my guess. When it encountered the death state it would remember where and when it happened as well as what it was doing when it happened. Example: walk right on level 1-1 until mario hits the goomba. Next time it'll try jumping on/over that obstacle until it clears it. Same thing with a pit. First time it'll jump 1 tile width. If that does not work next time jump 2 tile widths, etc. If it gets past the goomba it'll do this trial and error process over and over each time it dies until it finally reaches the game over state where it has actually won the game. I'd think the pin AI would do something similar using a camera so it knows where to hit each shot. Imagine if you never missed a shot once you learned where to flip as the ball rolls down the flipper. It'd be interesting to see how it handles multiball. This is all conjecture of course. I don't know how the pin AI actually works. Just basing it off what I read about AI on game emulation. Very interesting.

    If the AI does not know the rules it'd try to keep the ball in play and learn what shots will allow it to do that. Once it learns that it can hit the left ramp on phantom of the opera which returns to the right flipper it'll just do that over and over because it knows it won't drain.

    #3 4 years ago

    I would assume the computer spends a lot of time analysing timing and ball velocity to make shots on the fly. The rules would be hard programmed into the software so that it knows the values of different things. At that point, the software would use estimated chances of hitting a particular shot, what points and progress it provides, and then makes a decision on what to shoot for. Or it could just continuously combo the center ramp because it's Data East Star Wars and that's good points

    I would love to see a modern John Henry competition. This robot vs Keith Elwin. Keith would probably do better because of his ability to nudge the ball. (But the robot might win from attrition by boring Elwin to sleep)

    #4 4 years ago

    There's various ways to approach this with AI. I don't know about this exact example, but in general the specific game rules would not need to be programmed into the software. A more advanced system would have a goal such as maximizing the score. The program would need to have access to the state of the machine, such as knowing what switches are triggered and/or what lights are lit, and how much and when the score is increased. The more it plays, the more it would learn how to navigate a path through different states of the machine to maximize score. In such a system, it naturally learns the "rules" or at least how to maximize its score which is an approximation of learning the rules. Any particular state is given a desirability value (or score, not to be confused with pinball scoring). The program learns how to navigate a path of states to maximize scoring. Some variability or randomness is added into the system, so different tactics (flip timing or angle) are tried and evaluated from each state. Rather than pinball rules, more primitive knowledge could be pre-programmed, such as the drain switch being given a large negative score.

    Anyway, that's a kind of general approach that can be used with many types of games, such as chess.

    A program might learn to make an easy shot with high degree of accuracy, and just repeat it continually as well, which would be pretty boring. But such scenarios can be avoided by attributing a higher value to achieve higher scoring per time period.

    #5 4 years ago

    For sure the computer need not know the game state- rather it will learn optimal strategies through play. The real issue is the tens to hundreds of thousands of games it would need to learn this. Not sure I could live in the same house as the computer learning pinball- this could take a very very long time.

    That said I would start with an EM. And since I have a few EM and also use machine learning this idea is something I have toyed with over the years- its conceptually simple- use a ball that has enhanced contrast and a camera and wire up the flippers and plunger and away you go. Sadly I have no time and will never get around to this. Super cool topic!!

    I would love to hear a lot of granular details from someone who attempts this. Super cool idea.

    #6 4 years ago

    If the AI can't nudge the game, it won't stand a chance against a human. Unlike many other games pinball is also physical.

    #7 4 years ago

    Didn't JOSHUA try to learn, almost got us into Global Thermonuclear War.
    Bad idea if you ask me.

    wargames (resized).jpgwargames (resized).jpg
    #8 4 years ago
    Quoted from HighVoltage:

    There's various ways to approach this with AI.

    HighVoltage is essentially correct. Possible but very, very, very difficult. The model would take a lot of time to develop and you would need to a lot of data from the environment; score, states of lights & switches, and ball position, velocity and angle. Plus to have the same chance as a good player, the computer would have to be able to physically nudge the machine.

    I would think you would need an ANN algorithm over over supervised machine learning. Machine learning would work for something like the Phantom Flip on Monster Bash - but not a complete game that can navigate a ruleset and maximize scoring.

    Hmm... fun to think about.

    #9 4 years ago

    Digital twin technology could help where data is captured from human's playing the game. That data could be used as the learning set. So not only capturing the real-time state of the machine and ball but the external forces from the user (nudging).

    #10 4 years ago

    BTW, the computer shouldn't need the rules programmed into the model. It should essentially learn like we do. It might be computationally more efficient to run against a simulation (virtual pin) than to physically play to learn.

    #11 4 years ago
    Quoted from konjurer:

    BTW, the computer shouldn't need the rules programmed into the model. It should essentially learn like we do. It might be computationally more efficient to run against a simulation (virtual pin) than to physically play to learn.

    Yeah, I only mentioned hardwiring the rules into the software because it would significantly speed up teaching the machine. (Could you imagine if it had to figure out a game like JJP POTC?) Plus it may be able to find strategies that work better for its own shot accuracy.

    #12 4 years ago

    AI playing pinball? Ugh, no thanks. Pinball is for humans and humans only.

    #13 4 years ago

    Ai in machine learning wouldn’t need to know the rules to start with. It would just have to know that getting points is the objective. It would then learn the best way to get points through countless iterations or trial and error. It could be simulated first, doing millions of games in simulation ina short amount of time. Them moved to a real machine to hone.

    #14 4 years ago
    Quoted from jackd104:

    Ai in machine learning wouldn’t need to know the rules to start with. It would just have to know that getting points is the objective. It would then learn the best way to get points through countless iterations via trial and error. It could be simulated first, doing millions of games in simulation in a short amount of time. Them moved to a real machine to hone.

    Reply

    Wanna join the discussion? Please sign in to reply to this topic.

    Hey there! Welcome to Pinside!

    Donate to Pinside

    Great to see you're enjoying Pinside! Did you know Pinside is able to run without any 3rd-party banners or ads, thanks to the support from our visitors? Please consider a donation to Pinside and get anext to your username to show for it! Or better yet, subscribe to Pinside+!


    This page was printed from https://pinside.com/pinball/forum/topic/teaching-machine-learning-ai-to-play-pinball?hl=adol75 and we tried optimising it for printing. Some page elements may have been deliberately hidden.

    Scan the QR code on the left to jump to the URL this document was printed from.