Enemy comunication

Started by
9 comments, last by G-Dot 4 years, 6 months ago

Hello everyone! Recently I was doing behavior trees for enemies in my game and I've stuck with one issue. One enemy type of enemies is called Shooters (working name). So they've got a simple behaviour: pick a point near player, go to it and perform some attacks. The issue is what then they are picking point to move it happens that often they took almost equal points and I often see heaps of them in one single place. I want them to spread across arena evenly, but don't know how to do this. I think that it can be done with more advanced work with blackboards and communications. 

Advertisement
3 hours ago, G-Dot said:

Hello everyone! Recently I was doing behavior trees for enemies in my game and I've stuck with one issue. One enemy type of enemies is called Shooters (working name). So they've got a simple behaviour: pick a point near player, go to it and perform some attacks. The issue is what then they are picking point to move it happens that often they took almost equal points and I often see heaps of them in one single place. I want them to spread across arena evenly, but don't know how to do this. I think that it can be done with more advanced work with blackboards and communications. 

Create a combat manager / attacker manager that is associated with you player.  It would create a list of distinct valid spots for your enemies to move to.  When an enemy decides to attack it would first request a free space from manager object and register itself as the occupant of that spot.  This way all your enemies can easily have co-ordinated attacking positions without needed to talk to each other.

[EDIT: On second though, my "alternative" below is very similar to what Dave Roberts proposed.]

An alternative is to have a container of all the positions already assigned. When a shooter is picking a position to attack the player, give a penalty for picking a position too close to one already in the container. This can be made into a hard constraint, and that way you can limit the number of shooters attacking the player at a given time. If you do this cleverly, they will spread out to attack the player, perhaps even using pathfinding to a different door from which to flank the player, and when a shooter dies another one will take its place. These things could make their behavior more engaging, for very little effort on your part.

Many years ago I saw a description of the AI in some game that closely matched what I just described (probably in Game Developer Magazine), but I can't remember the name of the game. Anyone?

 

Influence maps to enforce spacing between agents is helpful.

http://www.gameaipro.com/GameAIPro2/GameAIPro2_Chapter30_Modular_Tactical_Influence_Maps.pdf

My AI Summit lecture from 2018 will be free next spring but is behind the paywall right now. Here are some of the example videos of what can be done, however.

 

Dave Mark - President and Lead Designer of Intrinsic Algorithm LLC
Professional consultant on game AI, mathematical modeling, simulation modeling
Co-founder and 10 year advisor of the GDC AI Summit
Author of the book, Behavioral Mathematics for Game AI
Blogs I write:
IA News - What's happening at IA | IA on AI - AI news and notes | Post-Play'em - Observations on AI of games I play

"Reducing the world to mathematical equations!"

17 hours ago, Dave Roberts said:

Create a combat manager / attacker manager that is associated with you player.  It would create a list of distinct valid spots for your enemies to move to.  When an enemy decides to attack it would first request a free space from manager object and register itself as the occupant of that spot.  This way all your enemies can easily have co-ordinated attacking positions without needed to talk to each other.

To tell the truth, I've already got an enemy manager class. I was influenced by DOOM's AI presentation with their ticket system, where enemies before attack ask for ticket (or tickets) and, after receiving  it they do the attack. I've got the same logic, but enemies never ask this manager for their placement, because how it can generate a spot for enemy to move? Only with manually located target actors, I think. But the problem is that I've already have this kind of thing implemented in another enemy. So he moves to the point, guards it and then change point. He doesn't talk to a manager class, but choose free points by himself, and after choosing point he makes it not free. I think if too many types of enemies will have this kind of behaviour then game can become more predictable and a bit stepish.

12 hours ago, alvaro said:

An alternative is to have a container of all the positions already assigned. When a shooter is picking a position to attack the player, give a penalty for picking a position too close to one already in the container. This can be made into a hard constraint, and that way you can limit the number of shooters attacking the player at a given time. If you do this cleverly, they will spread out to attack the player, perhaps even using pathfinding to a different door from which to flank the player, and when a shooter dies another one will take its place. These things could make their behavior more engaging, for very little effort on your part.

So as I mentioned earlier in answer to @Dave Roberts post it can make game a bit stepish. And my game I'm trying to make it super fast and so I've never planned any types of cover or strategy from player. Just skills, a little aim and speed. So making an AI that can flank player is great, but player never stands on one place for more then 2-3 seconds. The thing I want to get is that enemies are evenly spread across arena, so wherever player run he always meet some bad guys.

53 minutes ago, IADaveMark said:

Influence maps to enforce spacing between agents is helpful.

http://www.gameaipro.com/GameAIPro2/GameAIPro2_Chapter30_Modular_Tactical_Influence_Maps.pdf

My AI Summit lecture from 2018 will be free next spring but is behind the paywall right now. Here are some of the example videos of what can be done, however.

 

It's really great and interesting solution, but I think it's a little bit other the top. Firstly I don't think that this kind of behaviour will work for me because in the game enemies should react and act really fast and precisely. There is no time for them to calculate values and change their plans. Secondly I think it will be not an easy task for a single me. The system needs to be done, debugged, fixed and controlled. Also it needs to tested and adjusted for each type of enemy (right now there are 10 of them).

12 hours ago, alvaro said:

Many years ago I saw a description of the AI in some game that closely matched what I just described (probably in Game Developer Magazine), but I can't remember the name of the game. Anyone?

Maybe Uncharted? I heard, that they have pretty intelligent enemies, especially in the last game, but I've never played any games from that series.

Depending on your specific game and situation you can go (or may need to go) more complicated.  In order of simplicity:

1. create a hard coded list of vectors that are offsets from the players current postion, Use ticket system to pick any unused one and have the enemy go there to attack - -  assumes no terrain or obsticles

2. generate this list in realtime using checks into your world for valid locations -- or just use the preset list and check if a location is not inside a rock or whatever

3. bucket your world into grids or columns and count enemies in your column / grid - blend attack movement vector between less populate one to either side and where you want to go

4. Influence maps  (I've never used this exact solution, but have done "field-based" spacing solutions) - more complicated, but also can be much more adaptable

ymmv

21 hours ago, Dave Roberts said:

Depending on your specific game and situation you can go (or may need to go) more complicated.  In order of simplicity:

1. create a hard coded list of vectors that are offsets from the players current postion, Use ticket system to pick any unused one and have the enemy go there to attack - -  assumes no terrain or obsticles

2. generate this list in realtime using checks into your world for valid locations -- or just use the preset list and check if a location is not inside a rock or whatever

3. bucket your world into grids or columns and count enemies in your column / grid - blend attack movement vector between less populate one to either side and where you want to go

4. Influence maps  (I've never used this exact solution, but have done "field-based" spacing solutions) - more complicated, but also can be much more adaptable

ymmv

I've decided to go with the first one and find it quite a nice solution. Although enemies are look a little bit stupid running from one point to another, without any coordination in their actions. Not the best solution, but it suit all my needs: it's simple, very fast to set up and it works. I get the result that I want: enemies are more spread out on arena. I think that I should continue working on it and add this system to all types of long-ranged enemies, changing density of points and time, enemies stand on point.

This topic is closed to new replies.

Advertisement