Advertisement

AI Character Decision

Started by August 26, 2013 08:20 PM
3 comments, last by Navezof 11 years, 2 months ago

I'm getting started with Game AI, especially Character AI.

1. Lets say I have bunches of enemies attacking the player, how they should take a decision to hide or attack or move somewhere else, etc...?

2. When they hide, how they should determine the places they will hide while making sure that the player can't see or fire on them directly?

There is a technique called 'influence maps' where you projects where the enemies are and where you and friendlies are to try to figure out what to do in a situation. Getting more of your guys to fire at your targets and not have them fire at you (try to outnumber them etc) or retreat from them or find a path where you can avoid them enemy etc... Locations of power ups to move towards (ofeten combinations of all of these as in a fluid situation felexibility is often more useful than optimal actions.

More detailed fire-fight analysis mapping of this type can use arcs of fire and blocking terrain to be very specific about where you can have cover and /or shooting at a particular target. More complex calculations can be planning future moves where Sequences of possible movements and potential reachable locations for the enemies are investigated to try to give you the best future actions to carry out.

Depending on how your game mechanics work (simpler grid cell based games, vs full 3D ex- (where a unit might scootch/lean to the side a ittle quickly and trake a shot and then return to the cover)

Another technique called 'planners' help you organize an analysis of a situation, explore options and prioritize actions (possibly with several goals in mind simultaneously(

--------------------------------------------[size="1"]Ratings are Opinion, not Fact
Advertisement

I worry that if he is "getting started in game AI", that jumping to planners isn't a good idea.

That said, to the OP... let me pose my typical n00b question...

If YOU were playing the part of the enemy, what would YOU consider? How would YOU make the decision? That's usually a pretty good indicator of how to think through your AI.

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!"

'Planners' is just a methodology to investigate.for the OP

I found the mechanism itself to be trivial in comparison to trying to come up with a valid evaluation system (since it comes down to selecting a 'best' solution metric which has to be the result of anylizing the situation ) The other area outside the basic mechanism is deciding what and how often to reeevaluate - a balance between processing and ability of the AI to take opportunities when the situation changes.

----

--------------------------------------------[size="1"]Ratings are Opinion, not Fact

I recently worked on an AI program with the UDK, it was a simple AI but it make me wonder how to make a more inteligent and realistic AI? First of all, apart from the basic pathfinding, I'm kind of beginner when it comes to complex AI. But anyway, there is my answer to the first question of the OP.

1. Lets say I have bunches of enemies attacking the player, how they should take a decision to hide or attack or move somewhere else, etc...?

Each AI has a View and a Memory.

The View stock what the AI sees at the present moment.
The Memory can be the position of ammo seen before, or an order (go to this point, kill player, etc...)

Depending on the View (enemy is shooting), the present characteristics of the AI (low health), and the content of the Memory (medipack seen at a close position, commander asked to kill enemy) possibles action would be decided and noted.

- Fleeing = (very low health = 15pts) + (not many allies around = 5pts) = 20pts
- Continue attacking = (ordered by commander = 5pts) + (brave = 5pts) + (I hate my enemy = 5pts) = 15pts

The next action will be the one with the most points. Here, the Fleeing action will be the next action.


2. When they hide, how they should determine the places they will hide while making sure that the player can't see or fire on them directly?

Something similar could be used to answer the second question of the OP.

An Ai would have tactical possibilities and a position. For example :

We have 3 AI against one player. Their basic tactic is to surround the player. Each Ai are assigned with a position : center, left or right.
The left Ai will try to find the next cover in the zone right to the player. Same for the right side. The center won't move much. The goal og each Ai is to get closer to the player, or at least a good shooting distance.

To chose the cover, I guess we could add a variable determining how long the AI will stay under cover before moving. Or another corresponding to the distance without cover the AI is willing to go.

To resume the process, it would be someting like that :

1 - Decide global tactics
2 - Assign position
3 - For each AI, seek the closest cover available in the direction decided with their position.
4 - Repeat the 3rd step until getting at a good shooting distance.


Once again it's only a guess and not yet tested, . And has the poster above said, it's necessary to have

a balance between processing and ability of the AI

Because, AI can be very demanding for the process.


Sorry for the long post but I hope it can give some kind of hints or idea :)

This topic is closed to new replies.

Advertisement