Тёмный

How We Trained a Genetic Algorithm to Fly in Paper Mario: TTYD 

Malleo
Подписаться 41 тыс.
Просмотров 63 тыс.
50% 1

This video discusses how we reverse-engineered the flight physics to run frame-by-frame simulations, as well as how we made use of a genetic algorithm to achieve optimal plane flight input sequences.
View the code used for this project here: github.com/malleoz/ttydPlaneSim
Jdaster's TTYD Utils repository: github.com/jdaster64/ttyd-utils
TwoMinutePaper's video: • OpenAI Plays Hide and ...
The Open AI Paper: openai.com/blog/emergent-tool...
Special Thanks to:
mmtrebuchet - Discord: mmtrebuchet 7937
Monado - / monado_ and / monado
Sjorec - / sjorecsrl and / sjorec
Sway - / sway_nc and / swaync
Muz - / muzyoshi and / muzyoshi
Interested in TTYD speedrunning? Join the community Discord here: discordapp.com/invite/YB23azC
_____________________________
Twitter: / tasmalleo
Twitch: / tasmalleo
Join my Discord! / discord
Intro/Outro by TheSneakySpy: / thesneakyspy and / thesneakyspy
Check out Mario Kart Wii TASes: mkwtas.com

Игры

Опубликовано:

 

8 ноя 2021

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 290   
@AverageTreyVG
@AverageTreyVG 2 года назад
My condolences to all the parents giving birth to failed paper airplane flight patterns in ttyd
@yelir64
@yelir64 2 года назад
✈😔😥
@charlesmcanany6806
@charlesmcanany6806 2 года назад
Fortunately, all the parents die too, so they don't have to mourn for very long. =P
@zoomoozooboo
@zoomoozooboo 2 года назад
malleo pod when
@LadySkywalkerW
@LadySkywalkerW 2 года назад
My mom must feel them
@Bageltin
@Bageltin 2 года назад
OH THE HUMANITY
@MegaStunfiskandHat
@MegaStunfiskandHat 2 года назад
This feels like it could be someone's thesis for a CS degree
@TheShadowFlareGaming
@TheShadowFlareGaming 2 года назад
As a random throw-in who cares comment, mine was actually a report into AI within games, unfortunately I never thought to look into genetic algorithms as it didn't quite fit the purpose of my goal, that being producing a system to easily tailor AI difficulty to player skill level. Wouldn't be surprised if a decent amount of people have used genetic algorithms or even other forms of learning algorithms within games as part of their thesis. Might be conditional to being at not the best uni's like mine though. Sort of get more free reign on your reports when they don't expect anything anyway. In fact, won't deny I'd have loved to see this video back when I did mine, as the concept of using GA's or other learning algorithms to maximise efficiency within specific tasks and having multiple work with each other in a large task sounds incredibly interesting. To be honest, might have to be a personal project of mine in the future to explore battle optimisations within some other games. Generally learning algorithms aren't the best for random elements, but I'd be curious for games like Paper Mario where randomness is fairly minimised if it'd do anything differently.
@doorto6152
@doorto6152 10 месяцев назад
Could definitely be a capstone project for my data science bootcamp
@Ikaruwa
@Ikaruwa 2 года назад
This was randomly recommended to me by RU-vid, but I thought that was extra funny because I actually work at a company that's been developing a genetic algorithm that optimizes actual commercial flights to save on fuel and/or time.
@charlesmcanany6806
@charlesmcanany6806 2 года назад
That's awesome!
@chonchjohnch
@chonchjohnch 2 года назад
Do you mean pathing or flight? Because for the former it’s way more efficient to just precompute MSTs
@Ikaruwa
@Ikaruwa 2 года назад
@@chonchjohnch I mean flight plan optimization. We use a genetic algorithm to identify ways to improve the overall plan for a flight leg based on stuff like wind, convective weather, adsb traffic reports, and the modeled control surfaces of the aircraft being flown. Using that info we can identify ways to save for time, fuel, or best of both and provide those recommendations to the pilot on their electronic flight bag while they're flying. If you'd like to know more look up the NASA TASAR project, it's the basic proof of concept behind our product.
@ScatLuigi
@ScatLuigi 2 года назад
life immitates art
@bigtodd
@bigtodd 2 года назад
This is really cool. I watched someone do this with NES Mario bros and the algorithm discovered the wall jump glitch on its own. Amazing how they can find these.
@snoozbuster
@snoozbuster 2 года назад
Are you talking about the tom7 (suckerpinch) video? I don’t think that one was built with a genetic algorithm, but it did find some pretty interesting bugs nonetheless and is one of my favorite video game algorithm videos to rewatch every so often
@bigtodd
@bigtodd 2 года назад
@@snoozbuster nah it was this one by a guy named Chrispresso ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-CI3FRsSAa_U.html
@hydra4370
@hydra4370 2 года назад
@@bigtodd I thought you were gonna show Sethblings MarI/O, but I'm not sure if that figured out how to wall jump
@_ayohee
@_ayohee 2 года назад
@@hydra4370 it didn't, but it did find a frame perfect trick if I remember correctly
@johnfranklin42
@johnfranklin42 2 года назад
I just realized I’m just reading slides displayed over b roll footage, but it’s actually really effective at keeping attention.
@charlesmcanany6806
@charlesmcanany6806 2 года назад
I was thinking of using some photos to demonstrate, but I really couldn't come up with anything that would be more than extra eye-candy. So we had to go with a bulleted list. The petri dish animation actually only came up in the last days before we made the video.
@PBromide
@PBromide 2 года назад
I do appreciate that a channel on speedrunning also takes the time to explain the ideas used to achieve the results. Educational and entertaining in the best way. I'll be sure to look for further reading on genetic algorithms now. Thanks for the video!
@jaredcramsie182
@jaredcramsie182 2 года назад
Taking a look into the decompiled plane flight code, I noticed that the index9 variable in the nosediveCalc function (shown at 5:10 in the video) is actually a limit on the steepest nosedive angle. When above the panel the minimum angle is set to -22. When off the panel it asymptotically approaches -45 using the recurrence relation: index9 += 0.1*(-45 - index9). Here is the explicit form, where t is the number of frames since being above the panel: index9 = (45-22)*(1-0.1)^t -45 When t=0, 45-22-45 = -22 When t approaches infinity, (1-0.1)^t approaches zero, (45-22)*0 -45 = -45
@tryingtobeproductive
@tryingtobeproductive Год назад
I’m a comp sci student and my favorite game is paper Mario ttyd. What a great combo this video is
@spyfox260
@spyfox260 2 года назад
Came for a Paper Mario video, walked away with a full understanding of global financial markets
@romajimamulo
@romajimamulo 2 года назад
And here I thought it was solved just by using the "pull up at Last moment" technique
@charlesmcanany6806
@charlesmcanany6806 2 года назад
Interestingly, as the algorithm is working, the pull-up-at-last-moment technique is one of the very first things it figures out. Then it spends the rest of its time working on the middle of the flight.
@MrRyanroberson1
@MrRyanroberson1 2 года назад
nah, that technique is a really old one we discovered over 2000 years ago in search of the question of how to avoid producing more people, of course it wouldn't be optimal for paper airplanes.
@jongyon7192p
@jongyon7192p 2 года назад
@@MrRyanroberson1 That joke doesnt work because they said pull up, not pull out...
@hi-i-am-atan
@hi-i-am-atan 2 года назад
@@jongyon7192p i mean, i'm sure there's a species of duck out there where it applies perfectly fine
@eyitsaperson
@eyitsaperson 2 года назад
ok i pull up
@JohnP55
@JohnP55 2 года назад
This is a great video, it manages to explain something as complex as genetic algorithms in a condensed and simple fashion. Amazing work guys!
@FlameUser64
@FlameUser64 2 года назад
I'm early in the video but I noticed something about how the algorithm is flying and the explanation you gave: It aims only to touch the flight platform as soon as possible. This is _good,_ but not always the best you can do: your maximum flight speed is faster than Mario's walking speed, is it not? There are probably times where landing later is a good thing because you can use the flight to travel faster in the direction you were going to go anyway. I… haven't gotten far enough in the video to see whether this was considered or not.
@neoqwerty
@neoqwerty 2 года назад
If I remember my Mario Party TTYD stuff, max flight speed is faster than max running, but inferior to frame-perfect wiggle-walking or wiggle-running, I don't remember which it's called exactly (flicking up and down while moving left or right). It's super hard to do in RTA and only really usable up to the first Crump fight, after that diagonal paths are superior to wiggle-walking in straight left/right lines so it only really gets to shine in TAS.
@SuiteLifeofDioBrando
@SuiteLifeofDioBrando 2 года назад
Algorhthms seem to be super useful to find bugs.
@StaticYouTubeGaming
@StaticYouTubeGaming 2 года назад
I used a different optimization algorithm (AMOEBA algorithm) for my current physics research and ran into the exact same problem at 15:11 where you interpolate where the lines cross for your data points. I ended up having a different solution for my specific purpose, but it was cool to see this come up with your project as well!
@craftylord3336
@craftylord3336 2 года назад
Absolutely love videos like this. Higher end maths (with well made explanations) being used to solve portions of one of my favourite games! Thanks Malleo, mmtrbeuchet and to all others involved :D
@GMPranav
@GMPranav 2 года назад
I know you are active in twitch and not so much here, but I seriously cannot wait for the next youtube video!
@banddgames
@banddgames 2 года назад
Holy cow this video didn't feel like 20+ minutes at all; it really _flew_ by. Really clear explanations for a really entertaining idea, thanks for uploading!
@charlesmcanany6806
@charlesmcanany6806 2 года назад
Thanks for the kind words!
@EpochFlame
@EpochFlame 2 года назад
been reversing stuff for the Pikmin series using the same tool, and I’m glad to see others doing the same for other series
@CastleSR
@CastleSR 2 года назад
Never thought the plane mechanics were so high tech! Learned a lot from this
@talksickcs
@talksickcs 2 года назад
Great work as always Malleo, really looking forward to the 100% streams
@Kazooie
@Kazooie 2 года назад
Hands down the best explained gaming video series in youtube! Love this content so much. Keep it up!
@Liam-pf7ih
@Liam-pf7ih 2 года назад
21:59 Absolutely, the explanation by mmtrebuchet was so elite that I - only aware of the basic idea of GAs - now feel prepared to make them myself without any further resources. Thanks for making this video dude. :) Also decompiling ttyd is a cool thing to see, since I prefer programming games and graphics from scratch (c) its always insightful to look at how games with pretty big scale are programmed from an API design standpoint.
@charlesmcanany6806
@charlesmcanany6806 2 года назад
Thank you for the kind words! And if you want to collaborate on something using a GA, send me a note. The library we used, GAUL, is pretty easy to work with once you get the basic structure it uses.
@billsmathers7787
@billsmathers7787 2 года назад
How exactly do you know whether the flight paths you computed are optimal? Genetic algorithms and other optimization techniques have been tried for TAS optimization in SM64, and a large issue with them is that they tend to get stuck in local minima of the fitness function without a lot of engineering effort. Does the algorithm converge to the same flight path on multiple independent initializations?
@charlesmcanany6806
@charlesmcanany6806 2 года назад
It really depends on the problem, and flight optimization is one where GAs are quite well suited. Since the fitness landscape is relatively smooth with respect to controller inputs, the local minima don't seem to be too deep. The mutation & mixing operators definitely have a big part to play. Though I only glossed over it, the deletion/insertion mutation operators were a big help in longer flights. And the stretching/squooshing operator for crossover also helps the algorithm come up with children that contain good input patterns but in different arrangements. I think if you wanted to apply this to other tasks, or even tune the plane flight optimization, I think switching the controller input vector into a different basis, say, by taking a Fourier transform, would be a promising avenue.
@MrCopyrightable
@MrCopyrightable 2 года назад
That's a good point. He does attempt to state that there are too many variables to reliably calculate an "optimal" flightpath, but to me personally, that sounds like maybe his implementation for the flightpath isn't exactly 1:1 with the game. Also it wasn't really mentioned, but I'd imagine there are situations where different combination of inputs could lead to the exact same result. Which could just mean that there are multiple "correct" answers to what is the most optimal pathing. GA is a decent, quick and easy method to solve this problem reasonably... but I also know that this problem could be solved (less efficiently, and less elegantly) with straight bruteforce. Which could be a good long term solution for the actual TAS implementation.
@porglezomp7235
@porglezomp7235 2 года назад
@@MrCopyrightable With these flights being hundreds of frames long, and there being hundreds of possible inputs per frame, you can't brute force this problem. There are more possibilities than there are particles in the universe.
@kargaroc386
@kargaroc386 2 года назад
Maybe the word optimal is being used in the sense of "it's the current fastest-known way", which is pretty common in the speedrunning community.
@charlesmcanany6806
@charlesmcanany6806 2 года назад
@@MrCopyrightable @porglezomp is sadly right - the brute force approach here would have to take (number of controller positions) ^ (flight length in frames) passes, which is darn near impossible.
@BlazeNextGen
@BlazeNextGen 2 года назад
This is a very well made technical video about TTYD Airplane flights. My favorite word in this entire video is Squooshing/Squoosh
@ghostingskies
@ghostingskies 2 года назад
Fascinating stuff! Thank you for tricking me into learning about genetic algorithms :'^D I love seeing how much work goes into optimizing every part of a TAS - it makes the end result all the more impressive (and mind boggling!)
@molIymawk
@molIymawk 2 года назад
i haven't seen basically any paper mario content after distancing myself in march 2020 & glad the first thing i'm seeing in over a year is from you. super interesting topic with great commentary. thanks for makin videos man
@nestrior7733
@nestrior7733 2 года назад
I just love the speedrunning community. I have no words, only endless admiration for the dedication at display.
@casperdewith
@casperdewith 2 года назад
I loved watching this! Such a nice application for a riveting topic. I’d like to give a suggestion: the thumbail is cluttered and the title doesn’t make much clearer what it means (at least to me; I’m not familiar with this game or with your work), so I was thinking something like a screenshot of the flying zone with a few of those flight trajectories on top, and some paper airplane Marios along them (for clarity). The title could be something like ‘Using an AI to find the fastest flight path in Paper Mario’, since it is an AI as far as I can tell. This way, anyone can quickly understand what it means and what the goal is; you lower the click barrier, and more people will see the video. It’s a very accessible video for a non-Paper Mario audience, so the topic is not the problem. The video just deserves more attention, is what I want to say. Great job.
@askingfurret9532
@askingfurret9532 2 года назад
I feel compulsed to give you a standing ovation for this one, but all I can really do is subscribe and leave this comment! Fascinating and well presented. Thanks for this Malleo
@charlesmcanany6806
@charlesmcanany6806 2 года назад
Thank you for the very kind words!
@SSB_Seal
@SSB_Seal 2 года назад
Congratulations, making this video has qualified you to become a high school biology teacher! (in seriousness, good job, this was an entertaining and informative video)
@charlesmcanany6806
@charlesmcanany6806 2 года назад
Well, my career goal is to be a college biophysics professor, so your comment gives me a major warm fuzzy. Thanks for the kind words!
@curlybrace314
@curlybrace314 2 года назад
3:40 Declassified NSA tool huh? This video is going to go places...
@Scootercorn
@Scootercorn 2 года назад
Yeah, I focused in on this too.
@nemael1669
@nemael1669 2 года назад
The last comment you made, before the plane mini-game, was spot-on. Getting to know about a new tool within a familiar environment is super useful for getting to know how the tool is used and what its power/limits are, and no environment are "not good enough"
@AdultZechez
@AdultZechez 2 года назад
Looking foward to more Malleo goodness in the future.
@BicheTordue
@BicheTordue 2 года назад
i just recently discovered the tas of this game and i never expected that this game would be pushed so far
@EpicPetWars8Aqworlds
@EpicPetWars8Aqworlds 2 года назад
Cool stuff. Glad to see TTYD community still playing! I’m stoked I caught this live!
@Linkinator01
@Linkinator01 2 года назад
hopefully this video gets people more excited about optimization problems! really interesting field
@DonYagamoth
@DonYagamoth 2 года назад
This was really fascinating, thank you \o/
@P8NPrivTV
@P8NPrivTV 2 года назад
Great watch! This was really cool
@DakotaFiles
@DakotaFiles 2 года назад
fantastic explanation of GAs, loved every minute of this video
@charlesmcanany6806
@charlesmcanany6806 2 года назад
Thank you for the kind words!
@frogofdeparture
@frogofdeparture 2 года назад
Welcome to the fitnessgram paper test, the multi-stage flight optimizing test that progressively gets faster as it continues.
@CPU3pt14159
@CPU3pt14159 2 года назад
IMO using high level math to optimize speedruns of games we all love is just as noble a pursuit as using it to predict markets or whatever. If you keep making videos of amazing feats of math and engineering being used to crack TAS's then I'll keep watching them.
@WannabeMarysue
@WannabeMarysue 2 года назад
I'm glad a technical explaination doesn't have to be plane.
@HyphenatedReality
@HyphenatedReality 2 года назад
Yeah, it's really simple on paper when you lay it all out like this
@Luigifan4ever11
@Luigifan4ever11 2 года назад
Damn that Malleo! Always tricking me into learning!
@zaku28
@zaku28 2 года назад
It’s here! I was waiting for this one
@ravenID429
@ravenID429 2 года назад
I love that plane noise so much
@goizord
@goizord 2 года назад
utterly fascinating
@c9bepis939
@c9bepis939 2 года назад
awesome vid, shoutout to the Antibirth music, such a jam
@Mr_Top_Hat_Jones
@Mr_Top_Hat_Jones 2 года назад
Really miss the stream highlights… hope you start doing them again!
@cloenobody
@cloenobody 2 года назад
incredible work!
@anlev11
@anlev11 2 года назад
Great video!
@heello2u465
@heello2u465 Год назад
I thought this was going to be a video showing each generation like other videos. thank you for this though X3
@MarlowPreston
@MarlowPreston 2 года назад
4:45 And that's why you always start as far back as possible on the plane panel right? People were asking about the positioning in the stream chat, if you could get higher by starting at the tip instead for the skip, ect.
@jongyon7192p
@jongyon7192p 2 года назад
Yeah it seems like people used to think the front of the plane panel is most optimal. Reading the code, the entire plane physics seems to be different on the plane panel to prevent things like diving straight into the panel? idk why it's different, just that it is and that it's beneficial.
@LeonAlkoholik67
@LeonAlkoholik67 2 года назад
I remember getting almost glitchless world record in the paper plane minigame and I had no clue at the time what the exact conditions were with the physics, when I got out of nowhere a really good PB.
@vossafails
@vossafails 2 года назад
Can't wait for the day when the any% TAS itself completely made with a GA and just discoveres a thousand glitches
@sagacious03
@sagacious03 2 года назад
21:19 Aw, man. That really sucks. RIP, the dream. Anyway, neat analysis & explanation video! Thanks for uploading!
@opnuul
@opnuul 2 года назад
aw, yeah. i live for this shit. explain me the computer malleo YEAH!!
@baileyayyy5085
@baileyayyy5085 2 года назад
I love your videos thanks for existing
@enderger5308
@enderger5308 2 года назад
At some point, we should probably make a language below C (runnable stack-free, for instance) and higher than assembler (with more syntax to make programming easier.
@sodancookie2905
@sodancookie2905 2 года назад
POGGIES a new video let’s go!
@gloriousliar8747
@gloriousliar8747 2 года назад
Great video Malleo.
@jjsponge1202
@jjsponge1202 2 года назад
I can imagine a speedrunning school where you are one of the professors.
@bobbyblunt4208
@bobbyblunt4208 2 года назад
That 100% tas is gonna be wild I can’t wait man
@kathrayres
@kathrayres 2 года назад
Cool stuff! A few questions, as a curious person with an interest (but not expertise) in this kind of thing: 1) Was the same fitness metric used for the plane game as for the other flight path calculations? I'd be interested in the differences when optimized for score as opposed to distance, although I imagine that would be much more difficult to test. 2) Something feels semantically incomplete about rewarding a child flight path for having the *potential* to finish faster when it doesn't actually do so. In natural selection, this would actually be penalized as waste if the overshoot was large enough, and rather than being positively selected for it would decrease in number in favor of terser flight paths. 3) How many generations were used in these optimization tests, and what were their exit criteria? I can imagine that one way to settle on a "best path" as far as the GA is concerned is when the top x number of paths you seed for future simulations maintain the same frame count for a defined number of generations without increasing or decreasing.
@diribigal
@diribigal 2 года назад
For your question 2), A) there's no energy being spent here so the analogy with biology isn't perfect. B) a helpful way to think about "overshooting in the same number of frames" is simply "higher average speed" (just by an amount too small to make a difference in the number of frames it takes to reach the platform).
@charlesmcanany6806
@charlesmcanany6806 2 года назад
1. Yes, but there's a part of the fitness I glossed over - interference. If you check out the code, src/util_callbacks.c, line 71 starts the fitness function. We have a term in there for if there is a floor before the target that you need to avoid, so the plane minigame automatically optimizes for distance, since it never thinks it made it to the target platform. If we were to try to optimize for score, that would be very hard for the GA since it would create *huge* discontinuities in the fitness whenever you land on one of the score multiplying platforms, and it would almost surely get stuck in a local optimum. 2. @diribigal's response is very much on point. 3. The exit criterion was "I need to use the computer for something else now.", as much as I hate to admit it. Usually, we'd run somewhere between 20k and 100k generations. For the final TAS, we'll probably let it crunch for a while longer. While it's tempting to have an N-generations-without-improvement exit criterion, sometimes we'll go for thousands of generations before a very successful child leads to a burst of improvements over the next few generations.
@luke6784
@luke6784 2 года назад
This is a really cool application of GAs! Not sure if this was mentioned in the video and I just missed it, but I'm sure you're aware that we can't call the solution we find optimal unless we know the problem is convex (which I think another comment by Charles McAnany states it isn't). It's certainly more optimal than what we had before though, and the method discovering a new glitch is really cool.
@charlesmcanany6806
@charlesmcanany6806 2 года назад
Yes, we don't prove that we've found a global optimum. And for the long flights, this algorithm quickly beats RTA and previous TAS flights, but the improvements slow down asymptotically. I'd love to find an analytic solution, but I'm not hopeful that one exists.
@watermelon6402
@watermelon6402 2 года назад
This video is awesome.
@cheesegloriouscheese
@cheesegloriouscheese 2 года назад
Always nice to see a malleo upload, especially when it is on your birthday.
@Besh091
@Besh091 2 года назад
Happy (belated?) birthday!
@raydarable
@raydarable 2 года назад
It feels like in the future, AI's will make TAS' better than humans.
@ExxodKing
@ExxodKing 2 года назад
goshdarn good video, keep it up :)
@MrLuigiBean1
@MrLuigiBean1 2 года назад
This was so freakin cool.
@snare97
@snare97 2 года назад
so well explained
@camwoodstock
@camwoodstock 2 года назад
Is it odd I wanted to see full comparisons of the RTA/TAS/GA for all instances of flight in the game? That would be a fun part 2 to this video tbh.
@btarg1
@btarg1 2 года назад
AI generated TAS is the future of speedrunning. I can't wait to see full game runs done this way! (Especially games like sm64 - that game in particular has source code available)
@jakebop
@jakebop 2 года назад
I can’t wait for that hundo TAS my lord
@Kram1032
@Kram1032 2 года назад
In order to optimize towards human usability (less useful for a TAS but maybe more replicable by a speedrunner), you could try adding a few additional constraints, such as: - make the path robust to small amounts of input noise (simply add some random noise at evaluation time, both in the space domain, and in the time domain) - make the path as low energy as possible (roughly meaning, penalize very fast very large input changes in order to avoid super fast high precision flicking motions) Occasionally, constraints like this actually end up finding stronger solutions than without these constraints, although this example use case is probably simple enough that this ends up being not the case here. Still could be interesting to test
@TheGreenPig321
@TheGreenPig321 2 года назад
"GAs find bugs accidentally" >Guys I know how we can find DK Mountain Ultra
@Stenaven
@Stenaven 2 года назад
One day, we will have a full generic-algorithm Speedrun TAS. The year will be 20xx. Computer programs have replaced human inputs in TAS. We await our genetically superior TAS to watch. Lol.
@TheThirdPrice
@TheThirdPrice 2 года назад
The king has returned!!
@mme725
@mme725 2 года назад
This was an amazing explanation of how you guys extracted the emulatable flight logic, and then the genetic algorithm itself. Definitely added to my favorites for future review! Though I do wonder how the genetic algorithm would improve if you seeded it with one or two RTA speedrun flights one "constructed" good input sequence. By "improve" I mean if it would converge to an optimal path faster than building up from a bunch of random parents. Not that it matters in the end, but just curious about how many generations it might save.
@charlesmcanany6806
@charlesmcanany6806 2 года назад
We tried that, and it doesn't save more than a couple hundred generations on most flights. On very long flights (like the one to get to Gloomtail's room), the algorithm converges very slowly, and so seeding could be a good idea there... except that we wanted to make sure that the algorithm had a chance to try out things that no sane person (even Malleo) would do, and if we started it in a known-good configuration, there's a chance it could get stuck there and never manage to find an improvement that requires a large change. On this note, we carefully hedge that the algorithm discovered the bug to gain height over the panel "when we directed it to gain as much height as possible" - if you just run the algorithm on an easy flight without that condition, it finds that you gain speed by flying down over the platform and only rarely discovers the bug, even though it might be helpful. This is partly because the bug-triggering inputs have a lot of neutral stick position inputs, and the GA is not likely to randomly stumble upon that particular sequence unless we give it the get-as-high-as-you-can nudge.
@mme725
@mme725 2 года назад
@@charlesmcanany6806 Thanks! I had a feeling after I posted this that having a "working" seeded run would probably leave some grey area unexplored where the optimal strategy or any bugs may live. Still glad I asked, and am very thankful for your answer! Really helped sate my curiosity! :)
@mme725
@mme725 2 года назад
For the sake curiosity again, you guys ever estimate what it would take to explore the entire problem space? If there are finite frames, with finite button inputs at each frame, from a finite amount of starting positions, I wonder if there is an estimated size for just brute-forcing all possible paths. (Estimation only, I'd assume if it was doable you guys would already have explored that and found "the" optimal answer from it) There might not be an answer, but I figured after my first question that any unasked questions will remain unanswered ones :P
@charlesmcanany6806
@charlesmcanany6806 2 года назад
@@mme725 We don't have too much say in the starting position; we just take where the TAS first got to the panel. Once we're in flight, we have 147 stick positions to try on each frame, so for an N frame flight, it's 147^N. For a one-second flight, that comes out to 10^130 different combinations.
@mme725
@mme725 2 года назад
@@charlesmcanany6806 Oh wow, 147 stick positions! I severely underestimated the degrees of freedom of the stick. @_@ Well thanks for clarifying! Great stuff :D
@laser5317
@laser5317 2 года назад
goated TASer for a goated game
@QuarioQuario54321
@QuarioQuario54321 2 года назад
Malleo is a doctor!
@TS6815
@TS6815 2 года назад
THE KING RETURNS
@petrie911
@petrie911 2 года назад
All of these flights aim for the corner of the landing platform. Is it ever optimal to overshoot, reducing the distance you have to walk after transforming back?
@charlesmcanany6806
@charlesmcanany6806 2 года назад
Malleo can address the value of this better than I can, but the algorithm can definitely be adjusted to try to get closest to a loading zone or door. Might be effective!
@M4XD4B0ZZ
@M4XD4B0ZZ 2 года назад
Such a legend
@arceuskarp4542
@arceuskarp4542 2 года назад
I wasnt even shocked this could be a title for your videos.
@FappleJackity
@FappleJackity 2 года назад
tHIS WAS AMAZING
@ButWhyWasTaken
@ButWhyWasTaken 2 года назад
Is there a way to ensure a TAS is working 100% as intended or can small error go unnoticed? Ii.e. if the TAS is only a couple of inputs off that have no obvious tell, i.e. not something like missing a big jump but rather something like input being one or two frames too long with the difference in completion time only being a few milliseconds off, can you tell?
@nathanisbored
@nathanisbored 2 года назад
if a desync occurs, it will quickly snowball essentially with complete certainty. In a game as complex as TTYD variables are very sensitive to inputs, player position, and frame count. Basically if it desyncs enough to cause a difference in time, its not gonna make it to the end.
@Beeboppering
@Beeboppering Год назад
I never knew there was a flight mini game before
@codahighland
@codahighland 2 года назад
I've got a fair chunk of machine learning under my belt, so I already knew the underlying theory. But I'm left with a question: What makes a genetic algorithm the tool of choice here instead of, say, gradient descent? Is it just because the input length is unknown? Does it have something to do with the way intermediate states depend on each other? Was it easier to use for a wider variety of flights? Was it too hard to find a useful gradient? Was it just a matter of familiarity with the technique, or just easier to apply but either would have worked?
@charlesmcanany6806
@charlesmcanany6806 2 года назад
Really good questions! I don't have performance metrics of competing techniques, so it's entirely possible that a pure gradient-based approach would do better. I've long been curious about GAs, and this seemed like a fun place to use them. I was particularly interested by the crossover operation, since the flights tend to wind up having repetitive blocks of inputs. There was another comment earlier about using an RL algorithm, which would also have been a fun avenue to pursue. I actually considered adding a gradient step to the optimization, as a post-generation non-Darwinian evolution step. It'd be a bit of a chore to get a gradient-based technique to escape from local minima (and there are tons), but with an enhanced sampling algorithm (I come from simulation-land, so I'm thinking of replica-exchange Monte Carlo sampling or something) it could be quite viable.
@codahighland
@codahighland 2 года назад
As long as local minima aren't too wide, you can escape them by including a noise step in the training process, and/or by randomizing step sizes. You can combine this with a semi-Darwinian approach by evaluating multiple parameter sets in parallel and choosing some fraction of the fittest to move along in addition to some fraction of unfit candidates for the next training step. My intuition tells me that a RNN-based technique would take longer to converge than a GA-based one, but once a solution is found it would generalize to other cases more rapidly instead of having to start over for every flight point. I'm struggling to think of how RL would differ from RNN in this context. It feels like RNN would simply be the mechanism by which the RL would happen. Am I overlooking something? I suppose I can also visualize a non-recursive (maybe even non-NN) gradient descent approach. 100% agree that this would work better as a post-generation optimization step, the more I think about it; it would take FOREVER to try to optimize it from zero-knowledge, and using human inputs as a starting point definitely will have issues with local minima.
@charlesmcanany6806
@charlesmcanany6806 2 года назад
@@codahighland I haven't thought through the RL/RNN approach. I use CNNs very heavily for my research, but I'm not too strong on the theory of recurrent nets and fancy loss functions. If you want to play with the code and try adding a gradient-descent step, I'd be happy to walk you through it and give you some pointers.
@codahighland
@codahighland 2 года назад
@@charlesmcanany6806 I don't know when I'm going to have time to take a crack at it, but I'll try to keep it in mind!
@kargaroc386
@kargaroc386 2 года назад
I wonder if this accounts for the floating point rounding differences with x86 vs ppc
@charlesmcanany6806
@charlesmcanany6806 2 года назад
Malleo can answer in more detail, but it was pretty much bit-accurate. Ghidra was very careful to cast things to the right size in the generated C code.
@alpha210
@alpha210 2 года назад
Hello , I'd like to know what's the point on getting on the far left of the plane platform ( especially in the plane minigame) ty
@charlesmcanany6806
@charlesmcanany6806 2 года назад
It gives us more time to get higher above the platform when we reach the right side.
@swaghSR
@swaghSR 4 месяца назад
which version of bloody tears is that at the start it’s so good but I can’t find it anywhere
@DonYagamoth
@DonYagamoth 2 года назад
I just thought of something: Did this algorithm account for where to star the flight on the platform, whether it's faster to walk all the way to the front or start somewhere in the middle or so? Or is it always the fastest to start from the very back?
@charlesmcanany6806
@charlesmcanany6806 2 года назад
I was more on the GA side, but I believe it's faster to fly than walk in the general case. I'm curious about the landing, though. We could target our landings further along the floor, but that would mean we can't take a dip below the landing (as Monado's flight shows well at 18:30) and so we'd take a hit from that change. Ultimately, we still need to test out our options.
@XolifreX
@XolifreX 2 года назад
The code you took from the Ghidra decompiler and cleaned up to compile again, is the compiled binary output matching to the original binaries of those functions?
@charlesmcanany6806
@charlesmcanany6806 2 года назад
It gives the same results, bit-for-bit, but I don't think we ever tried re-compiling it for the Gamecube architecture. I doubt it would be the same, since we aren't using Nintendo's development toolchain.
@shatterdpixel
@shatterdpixel 2 года назад
this is really cool Speaking of optimization algorithms is there any news for recipes@home?
@romajimamulo
@romajimamulo 2 года назад
He's decided on the route now
@bobstayoffthegrass8772
@bobstayoffthegrass8772 2 года назад
All of human knowledge is contained within a TTYD TAS
@JonathanZigler
@JonathanZigler 2 года назад
You could always input best know configs first then run the algorithm.
@charlesmcanany6806
@charlesmcanany6806 2 года назад
We tried that, but the effect is to only remove the first couple generations. We went with random inputs because we didn't want to start it in a deep well that it would struggle to escape from.
@Roebey
@Roebey 2 года назад
Every time I click on a title like this I'm like "no fuckin way this makes sense" and I'm always in disbelief that by the end of it, somehow it does?
@lakitu6422
@lakitu6422 2 года назад
What is Ghidra? Can I use it on any gamecube game? It sounds like a very powerful tool that could be useful when making action replay or gecko codes.
@Malleo
@Malleo 2 года назад
Yup! Any Gamecube or Wii game. You will also need to download the language definition for the consoles' CPU variant, in order to properly reverse-engineer the assembly: github.com/aldelaro5/ghidra-gekko-broadway-lang
@lakitu6422
@lakitu6422 2 года назад
I got Ghidra working! Only problem is I don't know how to code anything that isn't a few powerpc asm codes.
@clankcrimson9413
@clankcrimson9413 2 года назад
Anyone know the cover of Bloody Tears used towards the beginning?
@Malleo
@Malleo 2 года назад
I probably should've linked this, given it seems it's hard to find. Here you go:downloads.khinsider.com/game-soundtracks/album/castlevania-best-music-collections-box-disc-17/17.09%2520Bloody%2520Tears%2520~Bloody%2520Tears~%2520%2528From%2520%25E2%2580%259CDracula%2520II-%2520Noroi%2520no%2520Fuin%25E2%2580%259D%2529.mp3
@clankcrimson9413
@clankcrimson9413 2 года назад
@@Malleo Nice! Thank you 🙏
@TheShadowofX
@TheShadowofX 2 года назад
@@Malleo Was about to ask about the missing music links in the description for this one, tanks!
@somniad
@somniad 2 года назад
How sure are you that you probably can't reach gloomtail's room? 100 units doesn't seem like a lot, and I know that fairly dramatic improvements can generally be found in AI by experimenting with different approaches - but this does seem like a method which would produce pretty good coverage of the problem space.
@christophsiebert1213
@christophsiebert1213 2 года назад
If you know where the room is and where the most height optimized GA landed in the video, then 100 units is a lot. See'ing as how the algorithm found a bug to build height, one would think, that it would continue using it to get higher or keep the greatest height. The GA did not do that. Now we have an algorithm that found a bug to increase and hold height, but when asked to optimize for height, didn't use it all the time, which leads us to believe that this bug has some sort of limited usage. Without building more height, and see'ing how the plane descends, it's fair to assume that a path to skip 100 units more height, is pretty implausible to hunt down, if not outright impossible. It would be more productive to find some sort of fly glitch or position manipulation, than trying to squeeze 2 more units out of the GA.
@somniad
@somniad 2 года назад
@@christophsiebert1213 okay, I see what you're saying - not necessarily ruled out in general, just unlikely that an AI approach is good enough.
Далее
How We Used a Credits Warp to Beat TTYD in 25 Minutes
43:03
Камень, ножницы, нейронка
00:33
Просмотров 1,1 млн
Reverse-Engineering Item Throws in Paper Mario: TTYD
23:46
I spent 100 days Mapping out Mario's ENTIRE Planet
32:50
Arbitrary Code Execution in Animal Crossing
24:22
Просмотров 288 тыс.
World Record History of Paper Mario: TTYD any%
39:10
Просмотров 763 тыс.
A.I. Learns to Drive From Scratch in Trackmania
16:51
AI Learns Insane Monopoly Strategies
11:30
Просмотров 10 млн