Перейти к содержимому

AI Plays Metal Slug

FluffyQuack

0:00 / 0:00

AI Plays Metal Slug

535 просмотров · 3 нед. назад
FluffyQuack
32,4 тыс. подписчиков
535 просмотров · 3 нед. назад
If you want a variant of the video with commentary, that's available here:    • AI Plays Metal Slug - With Commentary   This video shows a full playthrough of Metal Slug (Neo Geo CD version) by Claude Opus 5.5. It's played in the MAME emulator (0.273). This was not a real-time playthrough. The AI would periodically pause the game and take a screenshot and read various values in memory to figure out what to do next. Whenever it reached a full game over (never shown in this video) it would re-do the attempt with the same input but re-try the part where it died. It would repeat this process until it finally beat the game. The final, complete set of input is what this video is recorded from. Why was this done? I'm in the process of writing a reimplementation of the game and these playtests were done for two reasons: you can't fully determine what's code and what's data in a Neo Geo ROM without running the game with a debugger to see the addresses where it runs code. So you need very exhaustive tests to trigger all kinds of rare events. The second reason is to verify the reimplementation is completely faithful: tests were repeated in MAME and in my reimplementation to ensure the input lead to the exact same outcomes. The method changed three times as the project grew: 1. Missions 1 to 3: hand-planned, with probes. The AI wrote inputs a short stretch at a time, then ran "probes": short MAME runs, about six at once, that read the game's memory (lives, positions, enemy hit points, the level's progress counter) and took screenshots. The AI looked at what happened, changed the plan and tried again. Where the way on wasn't obvious, it drew the level's collision map from a memory dump to find the route up. 2. End of mission 3 to mission 5: an evolutionary search. A candidate route is one move every 20 frames (a direction, maybe a jump, maybe a grenade) with the gun firing constantly. Each candidate is scored on how far it got, what it killed, the damage it took, whether it kept its Metal Slug and whether it survived. The best candidates are mutated and combined over many generations. The search ran in stages of about 800 frames: once a stage was solved, its start was fixed and the next stage was searched. This version of MAME crashes when loading a Neo Geo CD save state, so every candidate had to boot the console from scratch and play up to the point being searched. One try took minutes, and mission 5 took about ten hours. 3. Mission 6: the search moved into the recreation itself. By then the Python translation of the game was accurate enough to stand in for the emulator. It can start a try from a snapshot and play it in about a second, around 30 tries in 7 seconds instead of 6 to 9 tries in 7 minutes. The mission 6 route was searched in 65 stages that chained themselves together automatically, and MAME then played the whole route once to confirm it: all 27,130 logic frames matched. This works because those inputs are timed by the game's own "logic frames" instead of video frames. Metal Slug updates its game logic every second video frame, slows down further when the screen gets busy, and reads the controller once per logic frame. The recreation never slows down, but a route timed to the logic clock still means the same game to both. Misc game videos playlist:    • Short, silly and fancy game showcases   Like my videos, mods, modding tools, and whatnot? Consider supporting me on Patreon!   / fluffyquack   Twitter account where I post links to my videos:   / fluffyquack   Public discord server where I babble and post links to videos and streams:   / discord   Website: https://www.fluffyquack.com