This week we are going to take the opportunity to show you the dirty secrets behind some of the mob’s favorite enemies. We are going to make a little trip inside the minds of the Hosioi, the Shield Bearers and Phobos to tell you about a couple of little twitches we have used to improve their behavior.

It is much easier to make an AI with perfect accuracy than make it have a realistic chance to miss.  This is why I hate when robots and androids in movies miss their shots as if they were space cadets. Specially when shooting laser weapons, they don’t even have to compensate for wind speed, direction and things like that! Who makes these purposely faulty robots!? Do they do this to give the humans a fighting chance in case they rebel? Okey, that could be a good argument, because they end up revolting against living beings a lot… But I digress. The point is that is easier, more even so in the case of a simulation where you control all the environmental factors too.

A Hosioi hitting people with his fireball attacks

A lean, mean, fireballing machine

Back to Okhlos. Do you remember the Hosioi? Apollo’s acolytes that shoot fireballs? Well, the Hosioi’s first prototype had perfect accuracy, because they were put together very hastily. The code simply said, the target is at that point, shoot to that point. And since the fireballs were pretty fast there was little chance to avoid them. Our next step then was to make the Hosioi fallible. To do achieve this we did two things: first we added a little randomness to the shots. Not much, but just a chance that when the Hosioi shoots the fireball it comes a bit skew. The second thing we did was making the Hosioi track its target’s position with a little delay. This way the Hosioi will have less chances to hit a moving target but will be more accurate against still targets. And so, with two little changes Apollo’s acolytes went from relentless machines that never miss a shot to being fallible creatures just like you and me, having to aim their shots and sometimes experiencing the bitter feeling of wasting a perfectly good fireball.

A Hosioi missing a shot

Too fast for you, Mr. Hosioi!

 

Something quite similar happened with the Shield Bearers. You remember them, don’t you? From Sparta, big shields, not bears? Well, they don’t shoot anything (they trust their nasty shield bash to punish people) so the attack wasn’t the problem here. The problem here was their movement. Shield Bearers hide behind their towering shields, making the only way to beat them to attack them from their backs, and if they see the enemies are moving to flank them they will turn and face their shields towards them. So if they can follow the enemies’ movements accurately and respond immediately to them,  it becomes nearly impossible to hit them.

ShieldBearer

Yeah, you remember him!

We knew this from the start, so the Shield Bearers are one of the few characters in the game that have a “turning” animation. Everything happens so fast in the game, people are running from here to there all the time, that simply flipping or switching sprites is all that is needed most of the times, but in this case we wanted the Shield Bearer to take some time to turn around, hence the animation. But it wasn’t enough. It takes time to maneuver the mob so the few moments the animation gave you were not enough. This is when we turned to one of the tricks we had learned with the Hosioi, tracking the enemies position with a little delay. This way you may get enough to get them before they face you again, and the idea of these giants hiding behind their massive shields being a little slow makes perfect sense too.

 

The Shield Bearer making his signature turning move

Shield me up, Scotty!

 

Last comes the story of Phobos. Not long ago we decided that Phobos would move around by leaping from place to place, kind of in a hulk-esque way. He is a big guy, bulky and mean, so it is pretty cool to see him land next to you and take a swing with his mighty axe. But, as you may have guessed, not everything was perfect at first. Deciding where to jump was the issue here. The easiest thing to do was just get the mob’s position, either the center of the mob or the leader’s position, and jump there. But that didn’t feel good so we had to resort to some of our old tricks.

 

Look at him go!

White gods can’t jump

 

In this case we used randomness again. Adding some randomness to the jumping target position meant that sometimes Phobos would end up just ahead of the mob, seemingly anticipating the mob’s movements, or a little behind them, giving them a chance to escape or head back and engage. The result was something much more interesting than having him always jump into the middle of the mob and attack everyone there.

 

Is there are morale to this story? Of course there is, thousands of hours of watching pre-Seinfeld sitcoms taught me there is always a morale at the end. It may be that little changes can make a big difference. Or it can be that one of the keys to making an AI more real is to make it fallible. Or that random numbers are awesome. But there is definitely a morale in there somewhere.

  • http://mo Kaothik

    NICE!