Simple Methods for Achieving "Fun" Interactive Enemy Behavior

I’m starting a new thread for AI just because there is a difference in views between some of us. Out of respect for the others it makes sense to create two threads. The other thread is focused on conceptual principles, understanding machine learning, it’s latest implementations and research and so forth. Hmm… I just noticed the other thread is locked. So I guess this is all we have.

This thread is focused on actionable solutions we can all use to make better “smarter” enemies and perhaps even better game managers. Basically we’ll break down the problems to understand them and prepared with that information we will be able to design a solution for the problem. We may then revise the solution (remember this is all design level just using sentences to illustrate the “how to”) to make it simpler.

While I am not against people posting about machine learning I would prefer it be in a game specific context. Not talking about some academic research but rather focusing on how it was or can be applied to games to solve a specific issue.

I don’t have time right now but will post later tonight or tomorrow.

But please contribute if you wish.

I think a great place to start would be to discuss the AI issues we have all seen in games. Give specific examples of the undesired behavior. And we will try to figure out the solutions together.

It’s possible such a discussion may not belong here since designing the solution will center around implementation. Personally I see it as directly related to game development because smarter opponents are certainly a key element of game design. But in the interest of not wanting to be a hypocrite if a mod feels this doesn’t belong here feel free to cast if out to Gossip or wherever. :wink:

1 Like

To start things off here are some examples of bad AI documented on YouTube.

Psychic Soldiers
Enemies who can automatically determine your exact “hidden” location far away within a second of sniping one of their comrades:

I Just Wanna Run
Enemies who know where you are but choose to take the longest path to reach you… when in fact they never needed to reach you (assuming they have guns):

Actually this one is just plain wrong on many levels. Notice the moment the player moves into the other room the enemy somehow magically knows the player has moved even though he is down the hall looking the opposite way. Another Psychic Soldier!

Your Kung Fu Is Stronger Than Mine
Enemies who cannot recognize simple spamming patterns:

This makes me kinda want to yell at the video JUMP GIRL JUMP AND ATTACK!

We’ll give this problem identification phase a bit of time for people to post their own examples of “bad AI”. Say until tomorrow night (~ 24 hours from now). Then we can get to work dissecting exactly what went wrong, when and where.

After we have ripped them down we can then get to work designing solutions.

Sound good? Hello… is anyone out there? :wink:

So… please feel free to post your own examples of “bad AI”. Can be something very simple or something that looks like it would be pretty difficult to fix.

1 Like

One thing that frustrates me is when I see a.i. that completely cheats, but it’s trying to be passed off as just being really intelligent or really well designed.

Take Starcraft 2 for example, the VS mode artificial intelligence is not actually any smarter than the very hard level artificial intelligence. It just gets more resources by default, and this isn’t explained clearly I actually found it out online when I was googling why cant i beat the insane computer.

In fighting games, it always pissed me off how they managed to block every single attack. Of course later on I figured out that they actually have access to the hardware level input device, so they literally know when your about to punch before any visual telegraphing even can occur. Contrast this with the human player who is human who takes several hundred milliseconds to respond.

Both of these are examples of inadequate artificial intelligence that is covered up with game breaking, unfair advantages that are never actually revealed to the player. Instead it’s just called harder artificial intelligence or a harder difficulty setting.

3 Likes

Excellent stuff! We can already see a pattern that makes for poor AI: CHEATING.

In the first video Psychic Soldiers, the enemies instantly knew exactly where the player was located. In the second video I Just Wanna Run, the enemy instantly knew when the player had crossed the low barrier separating the rooms even though he was down the hall with his back facing the player. This means 80% of our bad AI examples so far employ cheating to give them advantages dealing with the player. I don’t mean just a little cheating here and there. I think a bit is understandable at times but we are talking about cases where clearly the primary strategy is based on cheating.

1 Like

And there are AI’s that are overpowered and omniscient, and AI’s that are dumb as rocks. In either case, no effort is made to simulate the correct behavior a person would take. I wouldn’t doubt these AI’s all use complex pathfinding algorithms, logic trees, etc. But nobody sat back at any point and said. “What is the desired end result? What is this supposed to be like when it’s done?”

1 Like

I agree and have thought the same thing. In my own projects there are times I have taken a break of a couple weeks then went back and play tested before resuming work and noticed something I missed. I have got into a habit of where I now approach it by taking on the role of each enemy. Basically writing down what is my strategy for doing my job whether it is tracking down the player, guarding a treasure, being a “citizen” of an area (meaning I don’t care about the player and have nothing I am doing but hanging around living but if the player enters my turf I am gonna get him). That helps a lot for me anyway.

The first step in achieving anything has to be determining what the desired end result is. In this case, what are the enemy behaviors we want to achieve? You have to be able to define these things before you can focus on a solution.

Cheating AIs can be seen in various games, but it’s definitely in 3D semi-stealth games that it shows the most.

There are many examples of cheating AIs, or at least AIs that rely on some informations that should in theory not be available to them (making them act even weirder sometimes).

The Elder scrolls games are somewhat famous for their AI that can chase you down and pinpoint your location, in a manner where you can never hide unless you kill the pursuers or completely exit the zone. A bit less present in the last one, but you can still notice it if you know where to look (the enemies seem to instantly notice where the attack came from, and gradually forget about it over a few seconds).

Various 2D combat games read the inputs, to somewhat counter your moves, making counters much more valuable than any aggressive ways, kind of defeating the purpose of having a lot of moves, combos or powers, when you only really hit with fast attacks during the enemy attack animation/recovery.

A few RTS games also have the opportunity to give the AI various bonuses over you, for making things harder, some of which are down to cheating (revealing the map, among others). An AI is usually much more capable than an average player to utilise such informations, because it can keep track of everything and still keep up with all the productions and timings, nearly as well as a very good (pro?) player could.

In most cases, when it’s forced onto you, those cheating AIs tend to make things much more gamey, and less realistic, often making the game less fun to play as a result.

In itself, cheating AI is not bad, it’s just a way to give your AI all the informations it needs to perform what it is supposed to do.
It is also a very cheap way of doing so, resource wise, because it means all the information is stored in a central place, where every entity can access it, meaning that way less checks need to be done for each entity.

What really matters is “how” you make each entity use such information, and maybe how you couple it with basic information it still gathers about the world around itself.

Having access to everything doesn’t mean using it, per say, meaning that even if your AI has the specific location of the player, it doesn’t need to act like it is aware of it.

2 Likes

That reminds me, SC2 Insane computer also can detect if you build near its base ramp or either of its fast expand locations, in spite of being concealed by fog of war.

Omniscience actually seems less intelligent, now that I think about it. An enemy in a stealth game that I sneak behind who never notices me, that feels more intelligent.

1 Like

What about replicating expert play? In simulations, we often use subject matter experts (SME) to model what expert-play looks like. Then, we simulate how they do it via code instead of building an all-knowing, super-crazy-intelligent-AI. It might not even make that many adjustments based on the player’s actions. It’s just one of 2, 5, 10 different AI’s that you’ve coded up, and then you throw in a few random variables for difficulty and replayability, such that players have to work at it to truly grok it. I suppose you could further advance this by genetically evolving it, as players interact with it. Not necessarily easy and yet, probably more than adequate for most games.

Gigi

3 Likes

It also depends on a lot of other points, like your time and budget, or the minimum specs you want, for titles that are not just for a hobby.

At the end of the day, when you make a game for a hobby, it’s alright to go all out in whatever way you want, because it’s your own free time, and it’s not worse than playing other games, if you like it.
But when you are out to at least pay back what the game costs (usually, you want at least a bit of profits), you have limits on a lot of things, and a very complex AI might take a lot away from making the rest of the game, or up the costs significantly.

I tend to often forget about this aspect when I write, because it has never been my situation when it comes to games, but it’s something we have to keep in mind too.

I hadn’t considered giving them ai different “personalities” based on real people’s play styles. That’s a whole new avenue.

1 Like

Here are a few more examples of bad A.I. documented on YouTube…

Nobody Could Have Seen That Tiny Hole In The Ground!
Enemies who are just plain dumb. As in unaware of obvious hazards in their immediate environment.

Are They Critters Or Are They Spikes and Leaves?

This one kind of pains me to cover because these retro games are some of my favorites.
And this game is very well made overall as far as levels and core play mechanics are concerned.
However, it succeeds despite having some of the lamest enemies ever.
When you watch the video pay attention to the enemies. The game play would be the same whether the player was facing this specific enemy, practically any other enemy in the game, or even if attacking a spiked block or leaf fluttering in the wind.
In fact, the enemies remind me of most of the new games I see coming out on Mobile. They seem to have no idea the player is even near them. No desire to attack. No desire to escape. Basically, they are just rolling along day dreaming until they are killed.

1 Like

Or they behaved like most NES enemies. Most of the them in shovel knight are handled more like level props than complicated entities.

1 Like

I always liked enemies when they just go back and forth… One of the most challenging enemies is one that just won’t stop moving real fast back and forth.

And jumping randomly. And throwing hammers constantly.

3 Likes

I was thinking about that while watching the video. Reflecting on NES and Genesis games I played. It’s strange the enemies were almost always very simple. Moving forward off screen. Moving left and right in a certain area. Moving in a wave pattern across the screen. In fact, it seems like most of the enemies just moved in patterns with no reaction to the player at all. Yet they were often some of the most challenging enemies due to positioning and timing. Certainly they were usually fun to deal with. Shovel Knight looks like a lot of fun to me. It looks like an actual game.

What makes them so hard is that they don’t react to you. So you must react to them. This puts you in a constant “aah!”… “oh crap!” Kind of state of mind. I played asteroids on an original machine on saturday and it’s amazing how much perfectly predictable physics can present a formidable challenge.

3 Likes

Kind of all goes back to we should be focusing on fun not on simulating reality. Which means actually we shouldn’t focus on AI as a means to make things more realistic in most games.

In fact, looking at the 2nd video of the enemy soldier who is running around from corridor to corridor I would say the video author is having more fun from being able to make the enemy run like that then he would get from the enemy running down the corridor, jumping over the small barrier while shooting the entire time. He is clearly involved in play. Finally, at the end when he reacts to the enemy as just an enemy he fires a few rounds and now is in a barren area.

Of course, there needs to be enough challenge so the game is not boring. But just maybe AI in games should be focused on finding ways for the player to play.

2 Likes

Yep. And the worst AI you can make is what I would call the “Perfect Killer”. This is AI that heads straight for the player, attacking constantly without pausing, or getting distracted or anything. It’s the most realistic and yet game ruining. The AI is supposed to play into the player’s fantasy, dropping like flies if they’re Master Chef or giving you a heart attack if it’s Amnesia. That’s why it’s there. Sometimes that means it has the sentience of a fruit fly. And that’s great.

2 Likes

^ Such win! Very Design.
Gigi

The Onion: Guard In Video Game Under Strict Orders To Repeatedly Pace Same Stretch Of Hallway

This has been said before, but an AI doesn’t need to be smart. It simply needs to never appear dumb. (For example, letting you rob the shop because you’ve put a bucket on its head.) But not appearing dumb is the hard part, eh?

2 Likes