Dev Blog: Making a More Human Bot

By RoamingNumeral

Hey all!

Welcome to another League of Legends dev blog entry. This time we’re taking a step away from the Gameplay team in order to talk about bots, which believe it or not inhabit a fair chunk of game time in League of Legends. We recently deployed a series of changes focused on making them more human-like opponents, and thought you might be interested in some of the stories behind the update.

As always, your feedback would be awesome as we build a better dev blog, but in the meantime let’s find out what goes into building a better, more human, bot! Stepping up to the podium we’ve got Design Analyst RoamingNumeral, one of the brains behind our bot update efforts. Onward!

Pwyff

Why did we update bots?

Bot matches make up a decent chunk of games, even among level 30 players. That’s a lot of hours spent with our robotic friends that we thought could be more engaging.

We surveyed both Coop-vs.-AI and PvP players to find out what they thought about bots. One very clear piece of feedback was a desire for more “human” bots: ones that are less predictable and focus on the same game elements that players do, such as last hitting and nailing their combos. Surprisingly, "tougher" bots was a less frequent response by comparison. Based on this data we set our sights on more-human bots as the overarching goal for this update, especially since such changes will make harder bots more interesting down the line.

Players also said that they thought bots didn’t seem to think about strength and danger the same way most players do. As it turns out, they were right.

Improving threat evaluation

Threat evaluation is our name for the systems that bots use to determine how strong they are and how strong their enemies are. These systems underpin all of the bots’ decisions throughout the game.

Our previous systems used a method that is very common in games, especially first-person shooters. The bot looks at how much damage has recently been received and uses that to determine future threat. In an FPS, this makes a lot of sense. If a bot walks around a corner and takes a bunch of damage, it'll probably keep taking that damage if it hangs around, so it’s best to back off.

League of Legends works a bit differently. If Veigar unloads all of his spells on a bot, and the bot survives, that isn’t the time for the bot to run. That’s the time for the bot to destroy that evil little @$!#!. Veigar has almost no damage potential while all his skills are on cooldown, so why not get a few shots, or maybe a lot of shots, in while he’s vulnerable?

Our new systems try to deal with these scenarios by looking not only at health but also how many spells the bot and any nearby enemies have available. Overall, we’ve seen some clear improvements in bot threat evaluation (much to Veigar’s sadness).

That said, improved threat evaluation isn’t a magic bullet for bots. League of Legends was built to be played by humans, not bots, and that comes with some interesting problems. For example, the game doesn’t really know what a spell is going to do before it’s cast. When Morgana’s Soul Shackles is cast, a script begins to run that constantly checks if anyone has broken the leash. When the spell finishes, the script says “Hey, you! You’re stunned and take damage” to everyone who didn’t break the leash. Before Morgana ulted, the game didn’t actually know that Soul Shackles deals damage and stuns.

Now, that may all sound obvious, but only because humans are able to read tooltips and think through scenarios ahead of time. As a result, the system can afford to figure out what a spell does as it executes. However, this is a huge problem for bots because they can’t read and don’t learn from experience.

Because of this, this update has to use some pretty rough estimation for how much damage champions can do. Bots will continue to sometimes go too hard or run from a fight they could win because they couldn’t perfectly calculate the damage involved…just like players :P

Why we didn’t do jungling and wall jumping

This boils down to one simple fact: bots don’t know where walls are or even what they are (really sucks to be a bot right?).

This is essentially the same challenge as spells: League was built to be played by humans. For a human, it’s obvious why a path is all curvy - there’s a wall in the way! A bot, on the other hand, just follows the autopathing it’s given. It doesn’t know where the wall is exactly or how thick the wall is; it doesn't even know that the obstacle is a wall. It could be a pile of minions. Bots just happily go along the shortest path from point to point provided to them by the pathing system.

Wall jumping with Flash or other abilities is thus extremely difficult for a bot - without knowing how thick a wall is or how to path to a narrow spot, it’s pretty much impossible to automate. A lot of under-the-hood tinkering with our terrain systems would be required to make these behaviors possible in the (far, far) future.

Jungling is a similar story. One of the primary keys to jungling well is choosing routes that are either safe or optimal for reasons other than pure distance. Without additional changes to our pathing and terrain systems we can’t make a jungler bot that would be more than a roaming pile of 300 gold served on a silver platter.

We definitely think both wall jumping and jungling would be awesome behaviors for bots, and in the future we’d like to explore ways to make bots proficient at them. For now though we chose to focus on other behaviors that would help make bots more broadly capable when combating players.

Dodging skill shots

One of the most noticeable differences between players and our previous bots was how they reacted to incoming skill shots. Players will try to dodge skill shots in most situations, but bots would often take incoming skill shots to the face without even flinching. Since this is a fairly non-human behavior, we really wanted to teach bots how to dodge. However, we ran into a pretty significant challenge (bet you can guess!) - just like terrain, bots can’t “see” skill shots.

This is what Nidalee’s Javelin Toss used to look like to Annie Bot:

Annie Bot Online…

Scanning…

Target: Nidalee

My HP: High

Target Q Available: Yes

Action: Farm to my mechanical heart’s content

-------------------

Scanning…

Target: Nidalee

My HP: High

Target Q Available: NO

Action: Farm some more

-------------------

Scanning…

Target: Nidalee

My HP: LOW

Target HP: High

Target Q Available: NO

Action: WTF!! WHERE’D MY HP GO?! NIDALEE OP, RITO PLS! (Run away)

Luckily for Annie Bot, Riot Case came up with a way to use information already available to bots to help them attempt to dodge skill shots. By keeping track of which way their opponents are facing as well as what skills have recently gone on cooldown, bots can now try to dodge skill shots in some cases.

This is what Javelin Toss looks like to Annie Bot after the update:

Annie Bot Online…

Scanning…

Target: Nidalee

My HP: High

Target Q Available: Yes

Action: Farm

-------------------

Scanning…

Target: Nidalee

My HP: High

Target Q Available: NO

[SPELL USAGE DETECTED]

Is Spell Skillshot: YES

Is Target Facing Me: YES

Action: DODGE LIKE A NINJA

-------------------

Scanning…

Target: Nidalee

My HP: High

Target Q Available: NO

Action: BREAK OUT THE BREAD AND CHEESE CUZ I’M GOING HAM! (Attack)

With this change, bots can now try to dodge skill shots…but it’s certainly not perfect. For instance, Anivia’s Flash Frost doesn’t go on cooldown until it travels full distance or is re-activated, so bots don’t know it’s been cast. Ahri’s Orb of Deception returns, so bots may dodge the orb on the way out but not on the way back. There are other abilities this system can’t quite handle yet, but dodging some skill shots is definitely better than dodging none!

Updating bot combos and builds

Aside from the trickier cases above, there was plenty we could do to humanize bots just by putting in some serious time - in particular, updating spell combos and item builds. Our quality assurance guy, Riot Afic, helped out immensely here with his Diamond-level knowledge, and the updated bots now use much more contemporary combos and build more sensible items.

On a related note, Annie Bot will now Flash-stun-Tibbers. Wear the appropriate undergarments.

More human bots

Unsurprisingly, bots that are trying to track many more variables are quite a bit more computationally intense. Our team’s engineers, RiotAaronMike and RiotWooTang, did a great job optimizing our code so we could ship this update without affecting server load.

A good opportunity for making bots both more efficient and more human-like was to contextually slow down how often they scan the environment and react. Beginner bots now scan at roughly one third the frequency they used to, while Intermediate bots scan anywhere from 50% to 100% as often depending on how threatened they are. None of these settings are what we would call “slow”, but they aren’t quite as fast as they used to be, which helps take a bit of the edge off those unrealistic super-human reactions.

These changes, and a plethora of additional under the-hood changes, have created what we feel are more human-like bots. They’re certainly not Diamond-level (probably not even Silver) - but for now that’s not what we were trying to do. Our next steps are to look for ways to build on the new bots and better tailor a Co-op vs. AI experience for players’ first few games. Look for more information on this next project soon!

RoamingNumeral


4 months ago

Tagged with: 
Dev Blog