Friday, January 15, 2016

DIY Kill-Bot: A.I. Plays Dark Souls PVP

Description: A screenshot of a giant headless rock creature (golem) kicking an
armored knight square in the butt. Heehee, butt.
The Dark Souls series is known for its punishing difficulty in single player mode (and making it even worse for pirates who accessed it early) and its cut-throat competition in player versus player strategies. One user on gitHub going by the handleMetal Crow decides to combine his love of programming, his passion for playing Dark Souls PVP and desire to have an AI do his bidding into making his own bot that can play Dark Souls PVP and shared it with the world.

What's really interesting to me, coming at it from a non-technical viewpoint, is how much of this project was complicated by the fact that for all the strategy talk surrounding Dark Souls, the system is a closed system, making it sort of akin to trying to peer into a sealed black box. As he explains, he had to pretty much reverse-engineer the game:
In order to have the AI do anything, i needed to be able to feed it data about the game state. The simplest and most direct way of doing this is would be to have it watch various variables in the game code, such as the enemy's x and y location, and then use that with the AI logic. However, since the game's code isn't open source, i needed to reverse engineer anything i wanted to use.
Ok, so maybe that doesn't sound that surprising, right? Just point a program at a game, observe it crunch some numbers, and you're done? As it turns out, writing a bot to play against a human is really tricky-- and not just because us humans can be highly illogical. Nope, Metal Crow had to teach the bot to avoid backstab damage, and he had to create a sort of neural network to do it. He explains:
{In PVP]...the primary combat isn't standard attacks, but the backstab metagame. This is a beautifully complex mechanic, which allows players to instantly damage another player if they manage to get behind them and close to their back. Unlike standard attacks, an AI cant dodge this very simply, because it is executed instantaneous, there's no windup the AI can see and roll away from. The backstab metagame with humans revolves around identifying if a person is about to go for a backstab, then dodging it or countering it ahead of time. Unfortunately, even though I can easily identify backstab attempts when I play, I cannot for the life of me translate it into discrete logic. Its just something I know from experience, I cant really explain it. However, it is vital the AI be able to detect and dodge backstabs, so I needed to figure out a way to teach it.
So how well does it work? You can watch a teaser video of it in action below:


No comments:

Share This Post