How I Taught an AI to Play Pokemon Emerald

แชร์
ฝัง
  • เผยแพร่เมื่อ 21 มิ.ย. 2020
  • In this video I go over the tools and techniques that I used to program an AI to play Pokemon Emerald!
    Computerphile A* search video: • A* (A Star) Search Alg...
    Sebastian Lague minimax search video: • Algorithms Explained -...
    Blog / Transcript: remptongames.com/2020/06/22/h...
    Github: github.com/RemptonGames/Pokem...
  • เกม

ความคิดเห็น • 114

  • @RemptonGames
    @RemptonGames  4 ปีที่แล้ว +12

    Hey y'all, if you liked this video I have made a follow-up, which you can find here: th-cam.com/video/C1KpQc9cWmM/w-d-xo.html
    This video focuses on AI for Pokemon Showdown, the competitive online Pokemon platform. I also answer several frequently asked questions about this video, and announce a possible future project! If you enjoyed this video you should definitely check it out!

  • @el_1776
    @el_1776 4 ปีที่แล้ว +35

    Next video: AI critiques Pokémon artwork from the early 2000s

  • @mikerenfro4608
    @mikerenfro4608 4 ปีที่แล้ว +53

    What would your Pokemon team look like if AI chose it.

    • @PaulExists
      @PaulExists 3 ปีที่แล้ว +4

      Six magikarps

  • @henriquealves3086
    @henriquealves3086 3 ปีที่แล้ว +107

    Now teach A.I to play pokemon competitive (pokemon showdown)

    • @King_Nex
      @King_Nex 3 ปีที่แล้ว +6

      I think there's actually a rule against that in Showdown.

    • @ilovecairns5181
      @ilovecairns5181 3 ปีที่แล้ว

      pog

    • @nicholaswoel-nogueira4074
      @nicholaswoel-nogueira4074 3 ปีที่แล้ว +2

      @Rotom Channel bro u don't know anything about competitive pokemon

    • @nicholaswoel-nogueira4074
      @nicholaswoel-nogueira4074 3 ปีที่แล้ว +2

      @Rotom Channel I'm not salty I just don't know what format you would do that in unless ur talking about VGC maybe but I don't even think that

    • @nicholaswoel-nogueira4074
      @nicholaswoel-nogueira4074 3 ปีที่แล้ว +3

      @Rotom Channel hey wanted to apologize for my comment. Before they banned zacian yeah just spamming behemoth blade worked in ubers mb. While like maybe click other coverage moves too but yeah

  • @harshjalan4777
    @harshjalan4777 4 ปีที่แล้ว +44

    Being a long time Pokemon fan and a fairly recent AI engineer! I find this extremely awesome!!! Would love to collaborate to make the AI better!

    • @WanDeLay4
      @WanDeLay4 3 ปีที่แล้ว +5

      Yeah do it!

    • @josholin31
      @josholin31 10 หลายเดือนก่อน

      Been a while since I got into using TAS software. But now that I know more about how reverse engineering files and looking into memory. I've been thinking about randomly generating the input directions for 24+ hrs. Running the directions at super fast speeds. Doing that a 10's of times.
      Whichever gets the furthest, is the basis for the next generation and a slight mutation rate between the new sets of directions.
      More or less, genetic machine learning. But since I want it to come up with its own strategies. So I think I want to only want to track gym badges. This will take an absurd batch size or direction length since it will be going in circles. But I have a feeling there are better glitchless strategies in speedruns. And I think this might find them. (Since TAS gets rid of RNG, I bet it won't withdraw the portion from the PC in 1st Gen. But maybe it'll find other things.)

  • @Tyronethegod3
    @Tyronethegod3 3 ปีที่แล้ว +20

    I was kinda hoping it was just gonna be a computer plowing through Pokemon Emerald, bumping into walls and catching like 3 of the same Pokemon but beating other trainers....that would've been funny

  • @alexisdipoalo9443
    @alexisdipoalo9443 3 ปีที่แล้ว +12

    a little disappointed you didn't have the AI beat the whole game would love to see how that ended / was even possible ( i'd do it if i even knew how to write such a scipte )

  • @archivelibrarian6818
    @archivelibrarian6818 3 ปีที่แล้ว +14

    this is gonna blow up. calling it right now

    • @RemptonGames
      @RemptonGames  3 ปีที่แล้ว +2

      Thanks, I’m glad you liked it! To me 4,000 views already feels like it has blown up haha. I’ve got a related project on the way in a few weeks as well!

    • @archivelibrarian6818
      @archivelibrarian6818 3 ปีที่แล้ว +1

      @@RemptonGames thats so awesome to hear man! keep up the hard work. this is very good content. i look forward to your new project! :)

  • @SuperMarioLiam10
    @SuperMarioLiam10 4 ปีที่แล้ว +15

    Love your content! You deserve wayy more views

  • @pndacat1
    @pndacat1 4 ปีที่แล้ว +7

    The work that went into this was crazy!

    • @TKuja1
      @TKuja1 3 ปีที่แล้ว

      Check out codebullet

  • @OnEiNsAnEmOtHeRfUcKa
    @OnEiNsAnEmOtHeRfUcKa 3 ปีที่แล้ว +2

    Here before this channel blows up!
    Amazing quality stuff. :)

  • @Yellow_Balloon125
    @Yellow_Balloon125 4 ปีที่แล้ว +8

    I wish you had more subscribers. These videos are so professional!

  • @patrickdeck9178
    @patrickdeck9178 3 ปีที่แล้ว +2

    this was very insightful, please more on machine learning/reinforcement learning, this deserves way more views!

  • @robertchristian7020
    @robertchristian7020 3 ปีที่แล้ว +1

    i cant get enough of these programing videos crazy! good stuff

  • @wasserhahn94
    @wasserhahn94 3 ปีที่แล้ว +1

    Thank you gods of the TH-cam algorithm for leading me here!
    Really nice and informative video! I liked your calm way of explaining things and as a fellow data scientist/machine learning person I'm intrigued to try and do something similar :)
    Keep up the good work, looking forward to future content!

  • @Jawack
    @Jawack 3 ปีที่แล้ว +1

    Just had this recommended. Was surprised when you said "small channel", legit thought this a big pokemon channel I haven't heard of.

  • @andrewv.9142
    @andrewv.9142 3 ปีที่แล้ว +4

    this is so interesting, I would watch an hours long video about this!

  • @mittypkm
    @mittypkm 4 ปีที่แล้ว +20

    Holy crap. Watching the AI play the game live on Twitch would be super cool. Love the work that went into it.
    I'd love to see a follow-up video about it and maybe see the AI battle system implemented, as well as overworld puzzles and gimmicks. I'm sure it'd be a big task to program all that and it would take a long time, so take your time if you do decide to continue the project.
    This makes me wonder... would the AI go out of its way to catch Pokemon they deemed useful?

    • @RemptonGames
      @RemptonGames  4 ปีที่แล้ว +7

      Based on the response I’ll probably do some follow-up videos, but they will take some time and I have some other stuff in the works. As for catching, I think the easiest way would be to basically follow Nuzlocke rules (catch first thing in a new area) or some other simple rule

  • @shadowseeker97
    @shadowseeker97 3 ปีที่แล้ว +3

    the youtube algorithm gods has led me here. . Well edited, good audio and informative without being overwhelming. Have a like and subscribe sir.

  • @xSugknight
    @xSugknight 3 ปีที่แล้ว +1

    Nice video - im happy that i found your channel while still below 1k subs - cause this will change really quick!

  • @tapewormrage
    @tapewormrage 3 ปีที่แล้ว +1

    Criminally underrated video. Excellent work.

  • @SuperDavedm
    @SuperDavedm 3 ปีที่แล้ว

    I'd really like to see a part 2 to this, continue the project! I'd like to see a reinforcement learning technique applied to pokemon, although I don't know how feasible it would be given the action space.

  • @Joreon
    @Joreon 3 ปีที่แล้ว +2

    With this quality of content I was shocked seeing your subcount lol

  • @hiroshiendo6331
    @hiroshiendo6331 3 ปีที่แล้ว +1

    Really good video, congratulations!

  • @kaylads
    @kaylads 3 ปีที่แล้ว +1

    great video! and super fun topic!

  • @truestbluu
    @truestbluu 3 ปีที่แล้ว +1

    Underrated TH-camr!

  • @thezemag
    @thezemag 4 ปีที่แล้ว +3

    Coding + Pokemon?
    Loving this channel!

  • @towerofhellonerun2042
    @towerofhellonerun2042 2 ปีที่แล้ว

    This is my first vid and already like it keep uploading pls

  • @pyroskullfist
    @pyroskullfist 3 ปีที่แล้ว

    One idea I thought of is what if an AI go against a stronger AI as the pokemmo AI. That would be almost like AI wars.

  • @johnthroneberry7212
    @johnthroneberry7212 3 ปีที่แล้ว +2

    I have just recently circled back around to Pokémon. As a data scientist, I would want to find a way for the AI to learn from a play through and apply it to a subsequent play through or even another ROM. The cool thing would be to implement this learning in a manner that would be visible during gameplay

  • @albertocalabrese2958
    @albertocalabrese2958 3 ปีที่แล้ว +1

    I see Eragon in the background, I leave a like!

  • @WanDeLay4
    @WanDeLay4 3 ปีที่แล้ว +1

    This is sick, man. You should be proud, man.

  • @MangaDungeon
    @MangaDungeon 3 ปีที่แล้ว

    Wow this is really cool.
    I wonder how deep this rabbit hole can go., like learning and forgetting moves, or planning move synergy or game meta that a person is more likely to click with
    like for example, how it would calculate an instance of rain and thunder, vs 2 instances of like shockwave or prioritizing certain types or the risk factor of catching certain pokemon or rather not catching them if the AI cares about money

  • @domperaino
    @domperaino 3 ปีที่แล้ว +1

    Genuinely good channel.

  • @mcbiatiger8804
    @mcbiatiger8804 3 ปีที่แล้ว +1

    Nice work!

  • @richardosborn159
    @richardosborn159 3 ปีที่แล้ว

    This is such a cool project, and I have so many questions! How far the AI get into the game? Could it beat the puzzles? Could it think about its team and optimize? What starter pokemon did it pick? How did it navigate menus and choices! This is so cool!

  • @peterfeliciano7797
    @peterfeliciano7797 3 ปีที่แล้ว +1

    now i wanna see it complete the game

  • @nashawesome2840
    @nashawesome2840 3 ปีที่แล้ว

    Please for the love of god have a tournament of the best ai teams.

  • @laurarenfro5744
    @laurarenfro5744 4 ปีที่แล้ว

    A few questions. Is there any way to tell that AI racked up the score? I am interested in more videos like this. How do you think this might translate to more complicated games?

  • @kacywatson6314
    @kacywatson6314 3 ปีที่แล้ว

    Will be very interesting to have a complete set of Pokémon games that were completed by an AI. You can do one game for each generation. And you can challenge yourself to design the AI to have the game completed in the fastest time possible. Like some kind of weird but interesting to watch AI speed run.

  • @joshuacampbell17
    @joshuacampbell17 3 ปีที่แล้ว

    Eragon on the bookshelf 👀

  • @logansmith2703
    @logansmith2703 3 ปีที่แล้ว

    What about moves like Leer that lowers the stats of your opponents? Would it consider those effects or would it exclusively use attacking moves.

  • @Alex-sc6yy
    @Alex-sc6yy 3 ปีที่แล้ว +5

    Can't you look up GameShark codes to deduce which memory addresses represent which game attributes?

    • @RemptonGames
      @RemptonGames  3 ปีที่แล้ว +4

      Interesting suggestion, I’ll have to look into it!

  • @Reidemptionv1
    @Reidemptionv1 9 หลายเดือนก่อน

    Now I’m wanting to make an AI for Pokémon!

  • @GermanAnimeStudioZZ
    @GermanAnimeStudioZZ 3 ปีที่แล้ว

    Have you tried using advanced map(Pokémon romhacking tool) for some of the data you lack (ex: map data)?

  • @LanK111er
    @LanK111er 2 ปีที่แล้ว

    Hey, I'm trying to complete a similar goal and I've run into a speed bump installing the retro gym integration ui. It doesn't seem to exist anymore? Any idea where it went? I've hit a brick wall

  • @anan371
    @anan371 4 ปีที่แล้ว +10

    Do Ai tutorials , not many good channels out there

  • @BrayBray-jl8xi
    @BrayBray-jl8xi 3 ปีที่แล้ว

    Can you do like a stream maybe of how long it takes your Ai to beat emerald?

  • @pavfeira
    @pavfeira 3 ปีที่แล้ว

    In addition to the pathfinding limitations you mentioned like solving block puzzles, I would imagine that the basics of RPG questing wouldn't fit cleanly into A* search. I'm fuzzy on my Gen3 so if you'll excuse the Gen2 example, Mr. Pokemon. You grab your starter, venture past the first town, and find Mr Pokemon in a house in the middle of a route. So far so good, A* should eventually get you here. But then after getting the Mystery Egg, you're supposed to take that back to Prof Elm.
    There's likely some flag in memory once you trigger a plot-essential conversation like this, though it'd be difficult to datamine this flag using the techniques you showed, and regardless, that flag wouldn't help you know where the next flag is located. Furthermore, the next step is to return to an area/NPC that A* already interacted with, because now the gamestate has been updated and this NPC does something he didn't previously do (accept the egg from you). I suppose a solution here would be that if A* exhausted all currently-accessible areas, then restart a fresh A* under the assumption that you must've triggered some event or obtained some key item, and that backtracking to old areas is warranted now? This feels pretty unoptimal, like you'd end up re-combing the entire world map every time the game requires backtracking, but I'm not sure how else you could make this smarter without hardcoding some quest knowledge into the AI (such as "if you have a Mystery Egg, give it to NPC #2 on map #0").

  • @TB-dv8bx
    @TB-dv8bx 4 ปีที่แล้ว +2

    Came here from Reddit.
    This is so goodd!

  • @scarlett285
    @scarlett285 3 ปีที่แล้ว

    Based on the way you constructed the pathfinding system for the AI I'm left wondering how it will manage in situations where the game forces you to back track to areas you already visited such as Norman's gym.

    • @obnoxiousthegod
      @obnoxiousthegod ปีที่แล้ว

      so many more problems like the puzzles lol, this would only work with it also spamming A on everything and walk through walls enabled

  • @user-ek3xz8je2y
    @user-ek3xz8je2y หลายเดือนก่อน

    So cool!

  • @cosmicsvids
    @cosmicsvids ปีที่แล้ว

    I would just be easier to preprogram where it walks then having it do this and paring that with a damage calcautor to pick the best move.

  • @thecursedumbreon6755
    @thecursedumbreon6755 ปีที่แล้ว

    don't know if you did this but can you post this so someone can ran it a lot more times to see what happens, I kinda want to see what happens if its ran for months

  • @Dahxelb
    @Dahxelb 3 ปีที่แล้ว

    Now, what we need is: AI Plays Pokémon VS Twitch Play Pokémon, and see who beats the game first

  • @khairulmikhaelilman8895
    @khairulmikhaelilman8895 3 ปีที่แล้ว +2

    This is Very interesting

  • @dabesrobert5638
    @dabesrobert5638 2 ปีที่แล้ว

    So is it like the oldschool gamesharks?

  • @gojirasan1976
    @gojirasan1976 3 ปีที่แล้ว +1

    How did you integrate Emerald rom with GYM Retro? I'm having the worst time. I keep getting "No romfiles found for game" errors. I went through their integration guide, retro.readthedocs.io/en/latest/integration.html#game-integration, where im stuck at is the Using a Custom Integration from Python
    section. I'm not entirely sure how to run that script listed. When I try I get , "name '__filename__' is not defined. Anything would help. Thanks!

    • @wildgortex
      @wildgortex 3 ปีที่แล้ว

      what i did was manually add the 3 json files and rom.sha along with the rom and savestate (this needs to be zipped in gzip format) into a folder called PokemonEmeraldVersion-GbAdvance. For my windows installation using python 3.8.x this folder needs to be placed into C:\Users\{user}\AppData\Local\Programs\Python\Python38\Lib\site-packages
      etro\data\stable you then need to either change the code to match your savestate name or rename your savestate to state5 for the ai to run on your machine. For me there integrated UI program did not work when trying to download it. I did find another download here: pythonrepo.com/repo/openai-retro-python-reinforcement-learning scroll down to the bottom of the page and you can find the different releases. however the release i tried to download would not play my copy of emerald. hope this helps in some way.

  • @MegaMachiOnline
    @MegaMachiOnline 3 ปีที่แล้ว

    I wonder what would happen if you took an ai from pokemon reborn and dropped it into pokemon bw2

  • @laurarenfro5744
    @laurarenfro5744 4 ปีที่แล้ว +2

    Love!

  • @keldeo05
    @keldeo05 3 ปีที่แล้ว

    But how does the ai deals with Hms?

  • @Luma-ht6sg
    @Luma-ht6sg 3 ปีที่แล้ว

    I would love to see an ai play the whole game

  • @yourcj5734
    @yourcj5734 7 หลายเดือนก่อน

    Was this AI able to beat the game and does it play gen 1 and 2?

  • @leetspeak4240
    @leetspeak4240 3 ปีที่แล้ว

    Super interesting and very informative, let me know if your still interested in this project.

  • @SuperOttsel
    @SuperOttsel 3 ปีที่แล้ว

    If you like this video I really recommend a video by pimanrules where he makes a ranking of the ai trainers in generation 1 by making them fight against each other it's really one of the best TH-cam videos I've seen

  • @PawzyPuppy
    @PawzyPuppy 3 ปีที่แล้ว +1

    Finally someone other than me who says PoKEYmon

  • @srhodes2013
    @srhodes2013 3 ปีที่แล้ว

    The only real question is what Pokémon the AI used the master ball on.

  • @HomnixHD
    @HomnixHD 2 ปีที่แล้ว +1

    You should keep improving on the ai and let the ai run a 24hour livestream and when it beats the game it starts a newgame

  • @Peibool
    @Peibool 11 หลายเดือนก่อน

    Hello, what great content, could I somehow get in touch with you to be able to do this for myself, I would like to remunerate you

  • @1snivy10
    @1snivy10 4 ปีที่แล้ว +2

    Where can we watch the AI play Emerald?

    • @RemptonGames
      @RemptonGames  4 ปีที่แล้ว +1

      I haven’t put anything up of it just playing, but maybe I will if enough people are interested in seeing it. I need to do some more work on it first though

    • @brentrobinson3026
      @brentrobinson3026 3 ปีที่แล้ว +1

      Rempton Games YESSS I’m wondering how the AI picks Pokemon for its team

  • @conned2rpi
    @conned2rpi 3 ปีที่แล้ว

    Can't seem to download the OpenAI Integration UI :(

    • @wildgortex
      @wildgortex 3 ปีที่แล้ว

      pythonrepo.com/repo/openai-retro-python-reinforcement-learning scroll down to the bottom and find the latest release. for me the program will run but i cant get any roms to run...

  • @daredeviledoa
    @daredeviledoa 2 ปีที่แล้ว +1

    can i download this and run this myself?

    • @RemptonGames
      @RemptonGames  2 ปีที่แล้ว

      I have a link to the GitHub repo in the description, and you’ll need a ROM and Open AI Gym Retro

    • @daredeviledoa
      @daredeviledoa 2 ปีที่แล้ว

      @@RemptonGames I'm going to see if I can get it to work with pokemmo

  • @Jam77229
    @Jam77229 3 ปีที่แล้ว +1

    Wow less than 1000 subs! I'll click!

  • @ScottWinterringer
    @ScottWinterringer 9 หลายเดือนก่อน

    I see your virtual enviroment. however to build my own it does not want to build the wheels.

  • @watto7291
    @watto7291 11 หลายเดือนก่อน

    I wish I this clever

  • @RebornAudio
    @RebornAudio 3 ปีที่แล้ว +3

    This is amazing - but please stop saying poke-EE-mon 😂❤️

  • @antoniovalenzuela647
    @antoniovalenzuela647 2 ปีที่แล้ว +1

    You watch RWBY? You should also watch Camp Camp

  • @busterdafydd3096
    @busterdafydd3096 2 ปีที่แล้ว

    Well done coding this.... But my no means did you do any training. You made it discover (explore and remember) the map. Training would be to allow it to do hundreds of battles over and over until it learnt.
    Last note, cool program to use memory addresses but humans never used memory addresses so computers shouldn't need it either. In old games like this everything is made of "tiles" which you could of employed a segment network to cache all tiles and meaning depending on Context

  • @Willem654
    @Willem654 3 ปีที่แล้ว

    Was there any logic by it choosing the female trainer?
    How far can the AI play the game so far, did it beat Steven?

  • @starrycollections3023
    @starrycollections3023 3 ปีที่แล้ว

    now teach it to do a randomizer nuzlocke.

  • @firenutter1798
    @firenutter1798 3 ปีที่แล้ว

    it seems so next to imposssible to have a AI do 90% of the work rasing and hunting for the pokemon so then u can get rare shiny competive redy pokemon that of wich u can trade w/ to start a pokemon journy on ur own

  • @lazy_figetspinner_from2228
    @lazy_figetspinner_from2228 3 ปีที่แล้ว

    7:12 reminds me of cheat engine

  • @DM-qm5sc
    @DM-qm5sc 2 ปีที่แล้ว

    This code is borrowed, not impressed.

  • @CARROTMOLD
    @CARROTMOLD 2 ปีที่แล้ว +1

    Soooo........ when does it actually play? You know, like, teach moves, cut down trees... and BATTLE POKEMON? Is it gonna catch one? You know you can't beat the game by just applying a pathfinding algorithm, right? There is nothing intelligent about this at all.