Artificial Intelligence Destroyed Me At 'Smash Bros.'

Security
I cover crime, privacy and security in digital and physical forms.

SmashBot, an AI Smash Bros. player, can only play as Fox. But it's close to unbeatable, and is only going to get better.

Modern gaming is tough. More sophisticated artificial intelligence has transformed the galumphing, clumsy enemies of yore into evil cyborgs who can predict your next move better than a best friend.

One hacker, though, has brought that level of intelligence to an old game. Security professional by day and hardcore gamer during off-hours, Dan Petro has spent an inordinate amount of time over the last year creating an unbeatable player for the GameCube's Smash Bros. Melee that uses AI to dominate matches. Its name? SmashBot.

An amateur Smash Bros. fighter myself (that's being too kind, a hopeless n00b would be more accurate), I decided to take the AI on. Unsurprisingly, I was destroyed every single time. After about 50 fights, I've given up. The machines have won, at least at this Nintendo classic... and chess... and Go... and Jeopardy. Just expect them to win at every activity where the brain is the primary muscle required to achieve the set goal.

The SmashBot AI

How did SmashBot get so good? Petro's AI isn't traditional, in the sense it doesn't use neural networks nor does it train itself. Think of it more like Ava in the film Ex Machina. Rather than learning as it moves about its contained environment, SmashBot has a four-tier hierarchy of goals, with its ultimate hardcoded aim being to destroy the other player. That's not dissimilar (spoiler alert!) to the way in which Ava has one very specific goal hardwired into her "brain" in the movie. SmashBot won't ever develop aspirations to anything else (perish the thought!).

As Petro puts it, "At the very highest level it wants to know: what is the highest level thing I’m trying to accomplish? Usually that’s something like, let’s kill our opponent, but it’s not always that. In some cases, it’s a menu system, where the goal is to select a character. So then it goes down and down in terms of, how are we going to accomplish that, until the very bottom level, which is what buttons are we actually going to press.

"That maximises extensibility because if we want to change out the lowest level of how the programming works, that’s very simple. If we want to add a new move the SmashBot can do, that’s very simple, you just add a new chain at the very bottom and add that in... Let’s say you want to change how SmashBot fundamentally plays the game, that’s really simple, you swap out the high level strategy with a different one you made with maybe a hundred lines of code or so and that’s it."

It's taken Petro, who spends his working days at Bishop Fox hacking companies to show them where their weaknesses lie, almost a year to get SmashBot to its seemingly indomitable level. It all started as a challenge, when a friend doubted Petro could create a program that was a competent Smash Bros. player. For months, he applied his reverse engineering skills honed during years of ripping apart malware, and some machine learning knowledge acquired during his college days, to tear the game down so he could build a bot from the scraps.

But all the game hacking tools he'd previously encountered were of no use. Petro wasn't just ripping apart a game running on a normal console; he was creating a player that would work with the Dolphin GameCube emulator. That meant he had to look inside the game memory of the emulator, not just the emulator or game memory.

He therefore had to create his own version of Dolphin that would spit out memory dumps. Thankfully, the internal memory of the GameCube is only 24MB, meaning he didn't have to riffle through too much data. "I could spit out entire contents of its memory at any particular place and then just use manual inspection to find the bits I care about. For instance, if I wanted to know where is my damage stored, I’d put my damage to a known value, say 47, take a snapshot and put it up to 98 and take another snapshot. I can then see what changed from 47 to 98."

He repeated that process over Saturday morning breakfasts and private late night hackathons until he had a SmashBot that was insanely fast and almost impossible to beat. He'll be presenting SmashBot at the DEF CON hacker conference in early August.

As Petro told FORBES, SmashBot will see when its opponent is in the process of launching an attack, determining they will be vulnerable for, say, the next 27 frames. It’ll decide to either move in and get an attack off in that infinitesimal amount of time, or will back off, moving left and right in a seemingly-frenetic confusion (though it's anything but). "It looks like it does this ridiculous nonsense that should never work but it knows exactly when it’ll work right with very precise timing every single time," Petro said.

Beating the unbeatable?

Despite knowing all this and recognizing I have a very bad temperament when it comes to games (controllers destroyed at Fifa losses, blood pressure at aneurism-inducing levels at Bloodborne bosses), I decided to take on SmashBot. The Dolphin emulator and Github files were downloaded. After some code updates by Petro to ensure the Apple Mac version worked, SmashBot was created and run on my PC, GameCube controller at the ready. Smash Bros. Melee was fired up. Soothing pictures - kitten in a barrel, otter in a bib - were ready in open tabs.

As expected, it was defeat, after defeat, after defeat. Typically, SmashBot (who only plays as Fox) will just start shooting straightaway, knowing this is a good opening gambit, a quick way to get some hits in. Walk up to SmashBot, though, and it'll grab you and smash you face first to the ground as soon as you're near. It'll proceed to do that until either you're sent flying into the ether or go off the edge. It's unremitting brutality. Even when it looks like SmashBot itself has been duped into falling off the edge into oblivion, it finds a way on to the ledge before resuming the pain train. There's only one outcome.

But rather than anger, I largely felt content playing SmashBot. Knowing the AI was supposedly unbeatable made landing a hit a genuine achievement. In half of the fights against pro or highly-accomplished Smash Bros. players, the program has avoided being hit at all, according to Petro, who has taken it around tournaments in the U.S. With less than a week of practice, I was causing some damage every time, fist pumping on each landed sword thrust. In one fight, so befuddled was Fox at my prancing around, he had a minor meltdown going into permanent block mode. One powered-up swing and I'd taken my first life from SmashBot. Total elation in the belief I could one day win a battle against Petro's little monster. Video proof is below.

Pro players have had similar experiences, said Petro. "They try to play it as if they’re playing a regular person. What invariable happens is they get destroyed. Then they realise they’re not playing a human and they’re never going to win that fight.

"They try to find a bug in the system, some scenario it’s not accounting for, some thing that is not accounted for that’s possible in the game. Maybe you jump at exactly this angle it’ll run at you and go off the edge. That kind of thing can happen, fixing those bugs has been an interactive process.

"Most people get a kick out of it because they’re not used to losing that badly."

I also found some comfort in the knowledge SmashBot was not perfect. It could only play as one character (Fox) and is only really effective against Marth and on one stage, Final Destination. And SmashBot couldn't retreat into a game of Ocarina of Time when things got stressful. Then again, it doesn't experience stress...

SmashBot's sister

SmashBot is far from the finished article, though. Petro will continue to develop its abilities, ensuring it can fight any character, anywhere, any time.

More intriguing, however, is another version of SmashBot that is in its embryonic stages. That model will train itself. As it is, SmashBot's sister has no knowledge of how to play the game at all. It just uses machine learning to try. Petro, who plans to contribute to that project, says it will likely play itself and "accidentally" learn to carry out certain moves. "That way you’ll have it learn completely on its own how to play the game."

It hasn't learned much to date, however. "So far, that project hasn’t been successful in getting Smashbot to do more than just move around a little bit," Petro added. At least there's some more succour from the spectre of global AI domination.