Jump to content

  • Log In with Google      Sign In   
  • Create Account

Interested in a FREE copy of HTML5 game maker Construct 2?

We'll be giving away three Personal Edition licences in next Tuesday's GDNet Direct email newsletter!

Sign up from the right-hand sidebar on our homepage and read Tuesday's newsletter for details!


We're also offering banner ads on our site from just $5! 1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


Adding some variation to AI


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
8 replies to this topic

#1 BlackBrain   Members   -  Reputation: 340

Like
0Likes
Like

Posted 27 July 2014 - 03:58 AM

Hello .

 

I have designed a simple AI for or NPCs in game. Our game is a FPS .

Enemies in our game which are NPCs act all the same in the game. I mean they follow the same algorithm . And When they are spawned simultaneously they all shoot togheter. Reload toghether and so on ...

 

How can I add some variation to this with an easy trick ?

 

Thanks in Advance 



Sponsor:

#2 jefferytitan   Crossbones+   -  Reputation: 2220

Like
3Likes
Like

Posted 27 July 2014 - 04:34 AM

I'm surprised that they would act that similarly, for the simple reason that each one would have a separate location, which spins off to all sorts of differences. For example pathfinding, sensory differences, etc. Check the simultaneous behaviour isn't a bug, e.g. sharing common variables.

 

That said, pick a few configurable attributes such as aggressiveness, caution, weapon preferences, sensory sensitivity, etc. Assign (manually or randomly) each agent's attributes somewhere in that range. I don't think any one attribute would need a huge range to get interesting differences.

 

In practice I would say that it's not a problem because most games rarely have large simultaneous spawns. There may be multiple spawn locations, fixed patrol routes, etc set by the designer.



#3 BlackBrain   Members   -  Reputation: 340

Like
0Likes
Like

Posted 27 July 2014 - 06:01 AM

 Thanks for your answer. It's not a problem in my opinion but the designer thinks this is so stupid . He just expects a BattleFiled AI from me . Maybe I can change their animation speed and also have a higher system that enemies pickup different available actions from them. 



#4 jefferytitan   Crossbones+   -  Reputation: 2220

Like
2Likes
Like

Posted 27 July 2014 - 05:12 PM

Perhaps also the world's simplest squad AI. For example there may be a set of combat actions available, such as "shoot", "flank", "charge at", etc. As each AI chooses a combat action it could lower a global (or squad) priority for performing that action.

 

The initial priorities may be 100 shoot, 80 charge and 50 flank. So the first NPC chooses to shoot. Shoot gets halved to 50. Second NPC chooses charge, which is now the highest priority. Charge gets halved to 40. Third NPC has an equal choice between shoot and flank, you could resolve that whichever way you want to.

 

Edit: Edited to remove percentages. They didn't add up to 100, so not really meaningful as percentages. ;)


Edited by jefferytitan, 27 July 2014 - 05:14 PM.


#5 Lithander   Members   -  Reputation: 245

Like
3Likes
Like

Posted 27 July 2014 - 05:18 PM

Have you thought about using random numbers for delays between actions or making the choice of which action to perform next?



#6 IADaveMark   Moderators   -  Reputation: 2509

Like
2Likes
Like

Posted 27 July 2014 - 11:57 PM

The simplest answer is what Lithander mentioned. By including random delays, you accelerate the chaos theory that Jeffery is getting at (that little difference will eventually expand into bigger ones). The other thing to do is weighted randoms where, after scoring actions or doing whatever it is you do to select, you pick from the top N actions either completely at random or by weighting them according to their score.


Dave Mark - President and Lead Designer of Intrinsic Algorithm LLC

Professional consultant on game AI, mathematical modeling, simulation modeling
Co-advisor of the GDC AI Summit
Co-founder of the AI Game Programmers Guild
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!"

#7 LorenzoGatti   Crossbones+   -  Reputation: 2734

Like
2Likes
Like

Posted 28 July 2014 - 01:21 AM

What behavioural similarities are considered bad isn't completely clear.

 

Shooting simultaneously is a consequence of starting synchronized and being able to shoot at any time. Random delays break up the synchronization, but you can experiment with obstacles, concealment and lack of targets to make every unit shoot only when it can hit: when the enemy walks into the line of fire (and simultaneous fire makes sense), when they turn a corner (one at a time), when they randomly decide to pop out of their cover (according to the stochastic criteria suggested in previous posts), etc.

 

Generally "doing the same thing", on the other hand, should be addressed with multiple-unit coordination. For example, an infantry platoon or the like could, among many other things that can be modeled and executed in relatively simple ways, split into two halves that cover each other's advance or spread into a very long line to minimize the effect of enemy grenades: you would have two clearly different groups even if the constituting soldiers simply walk and shoot like any other soldier.


Produci, consuma, crepa

#8 Álvaro   Crossbones+   -  Reputation: 13645

Like
4Likes
Like

Posted 28 July 2014 - 03:08 PM

There is a cheap trick that would solve the problem of all your synchronized enemies and would make them seem much smarter too: Limit how many agents can perform a particular task at a given time (usually to one). For instance, one agent might decide to shoot at the player while running, without taking cover. The other agents might want to do the same, but the slot is now taken, so perhaps they will run for cover instead, and provide suppressive fire once they get there. If you also keep slots for taking cover at particular spots, they will take cover in different spots. Since only one agent can run and shoot at the player at a given time, it will look as if the others are providing suppressive fire to protect the running agent, even though there is actually no coordinated plan. You can enhance the effect by playing clips at the appropriate times (e.g., "Cover me!").

This idea is not my own, but something I read years ago. Unfortunately, I don't remember where I read it.

Edited by Álvaro, 28 July 2014 - 03:09 PM.


#9 Ashaman73   Crossbones+   -  Reputation: 7793

Like
2Likes
Like

Posted 29 July 2014 - 11:40 PM

An other way is to mark locations. Eg I mark objects which are used by NPC for a given time. Other NPCs will avoid them until they are freed again.

 

This could be expanded to heatmaps, where eg. used cover will produce a new heat-point, which dimished over time. NPCs will then try to utilize cool regions. This way you automatically can profit from some emergent behavior (eg many NPCs will start to flank the player, just by avoiding heat in choke points)






Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS