Advertisement

Simple AI: How to make a simple AI "dumber"?

Started by March 17, 2015 02:42 PM
4 comments, last by ferrous 9 years, 11 months ago

Hi,

I'm currently faced with a challenge that's part design and part programming.

I've built a small prototype of a top-down arcade space shooter arena:

Originally, my AI was simply too powerful.

To make it more palatable (and fun) for the players, I've introduced two new concepts:

1 - Reaction Time

I've created an artificial delay at which the AI reconsiders his decision (adjust helm, change target, etc.)

2 - Accuracy Handicap

I've created a random range of possible inaccurate results. Essentially, when I'm shooting at a specific ship, I modify its x and y coords by a random value (it's a bit more complex than this, but the basics apply)

I still feel like the AI is very hard to try and beat and I certainly don't want to make it look "dumber".

(Please disregard the fact it is currently causing friendly fire).

All in all, I've been thinking about ways to make the AI more believable and less dangerous without sacrificing how "clever" it looks.

One of the alternatives I've been considering is having them try to play the positioning game (as they are currently just jousting for maximal firepower with absolutely no regards to their own survival).

This would entail having the different ships communicate with one another a global "angle of attack" they are trying to achieve against said target, and space out evenly (maximizing the chances of one of them flanking the player). Obviously though, as the shots are fired from the front, this would inherently limit the amount of shots they can take while maneuvering into position.

Any particular advice on what to do?

You might want to expand the accuracy handicap to not only shooting, but to dodging as well. Have the incoming bullet(s) also have a slightly random position or direction vector to what it actually is. It will make it look 'dumber' possibly, but also a bit more fallible.

(Caveat with the bullets in that if they are fired in short bursts with the same position and velocity, then they should be all randomized in the same way)

Advertisement


but to dodging as well.

They don't currently dodge.

The ship doing all the dodging is the player currently.


Have the incoming bullet(s) also have a slightly random position or direction vector to what it actually is.

Yes, spread was part of my original prototype, but I'll get there afterwards. I'm not sure how much of an effect it will have on difficulty though?

Oh, my bad, for some reason I thought it was all AI ships involved =) My thought on bullet spread was for the AI's dodging, ie it wouldn't know the exact velocity and position of the bullets, basically just expanding and having more imperfect data.

Though having some inaccuracy on some weapons is valid and fine as well.

Anyway, to try to contribute some more, you may want to add a minor amount of randomness to the decisions made by the AI, to help them feel less uniform? Or assign each AI a random archetype (Aggressive, Defensive/Evasive, etc) or swap archetypes depending on damage received, etc.


amount of randomness to the decisions made by the AI, to help them feel less uniform?

The player is currently able to use powers (dash and strafes are demonstrated in the video).

With very limited effort (1-3 lines of code really) I can get the AI to use the same actions very efficiently. Having them use these powers randomly might look odd however but...


Or assign each AI a random archetype (Aggressive, Defensive/Evasive, etc) or swap archetypes depending on damage received, etc.

That's a good idea. A hot-shot fighter would probably dash a lot to close the distance on his target (the player), whereas a move evasive enemy might use strafing to dodge bullets and keep at a preferred distance. I would imagine "preferred distance" would be a key metric to track in the code and implement decision-making based off that.

Thanks!

Yeah some more basic archetypes:

Unflinching / Suicidal: Doesn't care about incoming damage, mostly tries to attack its target above all else

Sniper: Tries to stay at a distance from enemies.

Opportunistic/BackStabber: Tries to stay behind it's target.

As for random, I don't mean completely random, I mean that there are times where an AI can make a set of decisions, and to add a little fudge factor as to which decision gets made. Dodging left, or dodging right, just having it not always dodge right, sometimes it chooses left, even if it's slightly less optimal for avoidance, but would still cause a miss. Or perhaps if the AI has the choice of shooting or dodging first, sometimes it will dodge first, sometimes it will shoot first. It's mostly to breakup the AI from always robotically doing the same thing. Archetypes are probably a cleaner way to do it, at least easier to debug than fuzzy behavior =)

This topic is closed to new replies.

Advertisement