(Topic ID: 254006)

Teaching "Machine Learning" / AI to play Pinball?


By okayestpinballer

5 months ago



Topic Stats

  • 14 posts
  • 10 Pinsiders participating
  • Latest reply 5 months ago by jackd104
  • No one calls this topic a favorite

You

Linked Games

No games have been linked to this topic.

    Topic Gallery

    There have been 2 images uploaded to this topic. (View topic image gallery).

    wargames (resized).jpg
    pin_ml (resized).png

    #1 5 months 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/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 5 months 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 5 months 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 5 months 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 5 months 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 5 months 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 5 months ago

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

    wargames (resized).jpg
    #8 5 months 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 5 months 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 5 months 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 5 months 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 5 months ago

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

    #13 5 months 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 5 months 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.

    Promoted items from the Pinside Marketplace
    $ 12.50
    Playfield - Decals
    Pinball Haus
    $ 74.00
    Cabinet - Armor And Blades
    Id Rather Play Pinball
    $ 54.00
    Playfield - Toys/Add-ons
    Lermods
    $ 86.95
    Cabinet - Shooter Rods
    Super Skill Shot Shop
    From: $ 220.00
    $ 48.00
    Cabinet - Other
    ModFather Pinball Mods
    $ 999.00
    Pinball Machine
    Mircoplayfields
    $ 29.95
    Playfield - Toys/Add-ons
    ULEKstore
    $ 45.00
    Playfield - Toys/Add-ons
    Just 3D Mods
    From: $ 9.99
    $ 74.00
    Cabinet - Armor And Blades
    Id Rather Play Pinball
    From: $ 22.00
    $ 5.00
    Playfield - Decals
    Doc's Pinball Shop
    $ 15.00
    Playfield - Decals
    Iron Monger Decal Out of stock
    Flashinstinct
    $ 229.99
    $ 65.00
    Playfield - Toys/Add-ons
    G-Money Mods
    From: $ 220.00
    Playfield - Toys/Add-ons
    CzTV Mods
    $ 65.00
    Cabinet - (Alt) Translites
    Pinball Haus
    $ 42.00
    Playfield - Toys/Add-ons
    The MOD Couple
    $ 114.00
    Lighting - Backbox
    The MOD Couple
    $ 9,099.00
    Pinball Machine
    Operation Pinball
    $ 54.99
    Cabinet - Shooter Rods
    Lighted Pinball Mods
    $ 18.95
    From: $ 42.00
    Cabinet - Shooter Rods
    ModFather Pinball Mods

    Hey there! Got a moment?

    Great to see you're enjoying Pinside! Did you know Pinside is able to run thanks to donations from our visitors? Please donate to Pinside, support the site and get anext to your username to show for it! Donate to Pinside