Dev Blog: Making a More Human Bot

Riot·4/12/2014, 2:09:34 AM·2 votes·41,608 views

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

719 Comments

Wildings4/15/2014, 7:33:10 PM340 votes

Challenger Bots God help us.

LawlerRx4/15/2014, 7:48:03 PM135 votes

Are they going to harass one another then intentionally feed or afk? I think that'd be the most realistic

A Question Mark4/15/2014, 8:29:34 PM101 votes

Can we just be able to play intermediate bots in custom games XD

ColonelDongPunch4/15/2014, 8:19:08 PM85 votes

Hello, riot and other inhabitants of the thread. First time poster. Quick idea about bot evasion and their ability (Or rather, lack there of) to jump walls. Instead of focusing on making the bots be able to determine what walls they can hop using an ability or flash, why not designate a group of 'emergency coordinates' where the walls are thin enough to flash around the map. Right now, it appears that in 'emergency ' situations (situations where the bots take a large ammound of damage in a short amount of time) they seem to just blindly run back towards their base. Instead, I suggest they run to these 'emergency coordinstes' and use their flash or abilities to jump the wall. In this way, they don't actually need to recognize the existence of the wall, just the point that represents a way to escape if they use flash or a similar ability.

Honestly, this seems like a very simple solution that if implemented would emulate human behavior much better.

DrugsWomenMoney4/15/2014, 7:38:49 PM85 votes

WTF!! WHERE’D MY HP GO?! NIDALEE OP, RITO PLS! LOMO hahha

Easy Game Bro4/15/2014, 7:40:09 PM75 votes

They should make it where if one bot has more than 5 deaths the other bots should say "omg, report this bot for feeding" that would make the bots more "human"

4TeLaZRXVR4/15/2014, 7:46:23 PM60 votes

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

Catbüg4/15/2014, 7:35:03 PM55 votes

Damn now even the bots can dodge skillshots... I need to step up my game...

ADC IN 2020 LMAO4/15/2014, 7:56:20 PM52 votes

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

Strommsawyer4/15/2014, 9:02:38 PM37 votes

They should do a bot experiment. 5 separate bots, disguised as real players, in ranked. Run them 24/7 for like a week, and see where they end up in solo que ranked.

fergy4054/15/2014, 8:21:08 PM34 votes

Maybe now shen bot won't rush brutalizer.

leeflang4/15/2014, 9:49:32 PM34 votes

being that this is about bots and all, i have a question and request.

one day, while playing a bot game, i had a simple question/idea about bots that popped into my brain, when i play bots, my team is always on the "blue" side, however, when playing PVP i sometimes will be placed on the "purple" side which sometimes throws me off a little, and so, i was wondering if it's too much to do a randomize system in bots like it is in PVP, which puts the bots on blue every once in a while, and the actual players on purple.

SlayerAus4/15/2014, 8:36:57 PM32 votes

Soo..... Bots can dodge skillshots..... Bots are now better than all of bronze V

Prouster4/15/2014, 7:38:13 PM29 votes

"WTF!! WHERE’D MY HP GO?! NIDALEE OP, RITO PLS! (Run away)"... I know that feeling poor little bot champ; I know that feeling...

UnknownMartian4/15/2014, 7:51:39 PM28 votes

You should disguise yourself as bots in random games. Do something crazy and interesting. Get a full rito group and play as the bots and at the end offer the newbies some help and award some if you see them being super cool dudes.

Noobly1014/15/2014, 8:00:55 PM28 votes

Congratulations, bots! You have successfully been promoted from Cardboard V to Bronze V. Yeah. Yeah....

Curse of Royal4/15/2014, 7:50:34 PM24 votes

Great idea updating the bots riot! Have you considered putting in a feature that would make them respond to pings?Cassiopeia

WuPwns4/15/2014, 7:39:33 PM22 votes

" BREAK OUT THE BREAD AND CHEESE CUZ I’M GOING HAM!" I once said that and got a very offensive response from a teammate saying only trolls say that.. that makes two of us! Riot gg

Aizera4/15/2014, 11:30:39 PM17 votes

Deer Rito,

I just tested the new co-op playing as Lux and bring out some initial feedback. Even though bots are still imperfect, I think it is a very good improvement compared to the old AI. :) Here are some things that I noticed about skillshot dodging:

The sidestepping is actually very, very impressive. When I was under level 20 I cannot even sidestep like that -_- and I sometimes still get pwned even now. So I think that was a really awesome change.

Here's a thing though. In your particular code you mentioned: "is the target facing my way, yes, then dodge like a ninja"--- so I went into the game, and I find that bots are easily kited, since they do not bother to dodge my Q when I'm running the hell away and my champion is not facing them.

And some other things, there is umm skillshot baiting. If bots just recently dodged a skillshot, they cannot sidestep a second skillshot. I'm sure you guys are on it ;3

Bots also do not register lux ultimate as a skillshot ... yet o_o

Also maybe there are some small bugs. Garen bot ran across my tower while I'm kiting him. >_> Just a minor thing though.

Anyways, for a closing letter, thanks so much for making this change, and I really hope the feedback helps since I'm very excited about the improvements you guys are making. :3

Thanks! Kai <3

----x---- Deer rito peeps,

I know I should have posted it earlier but I forgot, but thanks so much for making the new support items (especially the new FQC), and nerfing all the champs that used to facepwn me xD

And for nerfing Leona & Lulu! ILY<3

Sincerely, A Diehard Nami Fan [also,for creating this champion.]

Akrasias4/15/2014, 8:34:38 PM15 votes

Can you fix omniscient Karthus bot?

FORESKlN JANNA4/15/2014, 8:26:29 PM15 votes

Will be ever be able to play intermediate bots in custom games?

TacticalEevee4/15/2014, 7:46:21 PM15 votes

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

Sooo many lolz

nathanxyz4/15/2014, 9:51:06 PM13 votes

Could you possibly also make their autopathing include more bushes? It's odd to see a bot just casually strolling toward you, rather than skulking up through the shadows like a human should

Entity Zero4/15/2014, 7:44:07 PM13 votes

I feel like jungling is possible, its just too much work. Id start the script by checking if Red buff or Blue buff is the optimal start from that champ, and have them go to each camp based off of if the camp is shown to be alive on the minimap or not. If they go to a camp thats been counter jungled, then they take a step back in the script and check which camp is next. As for ganking, they can determine if an enemy in lane is pushed past a mid point or not and take a few other factors in like their location in relation to the enemy and if its a good idea to go gank based off that information.

kTGg8TYecZ4/15/2014, 9:43:00 PM13 votes

Played a bot match a while ago and noticed the bots came to lane before minions spawned. I was like "what? never seen that before!"

This explains it.

Raymuundoo4/15/2014, 8:24:18 PM12 votes

Annie summoner 4 Stun tibbers....... f**k bots are gonna start having a lot more fun

WontBeBanned4/15/2014, 9:49:38 PM12 votes

Velkoz I have studied, analyzed and rearranged the the lettering so that all i saw was " Burn Teemo burn." and i only have this to say: Thank You Riot.

viperden4/15/2014, 11:47:37 PM12 votes

No more beginner bots nor intermediate bots. It's only Diamond bots or Challenger Bots.

CamiIIe Bot4/15/2014, 7:35:14 PM11 votes

Can't wait to get beat by bots :D

Physics The Wolf4/15/2014, 9:04:57 PM9 votes

Oh no.... summoner 4 Annie summoner 4 Annie summoner 4 Annie summoner 4 Annie summoner 4 Annie summoner 4 Annie

Sighfull4/15/2014, 7:58:27 PM9 votes

Seeing Ryze dodge Jinx's Zap just puts a smile one my face...Amazing update riot :D

Ryot God4/17/2014, 4:25:11 PM8 votes

Someone else in the comments had a really good idea. In Co-op vs AI the humans always play blue side. A lot of people new to PVP have trouble playing purple side, because of a lack of practice. I think the human team on Co-op vs AI should be assigned to purple side for half the games to better represent actual gameplay.

Jiejl4/15/2014, 9:01:02 PM4 votes

Please don't let people that are a low level and are new to the game play intermediate bots. I have lost because of scrubs like them.