How to make a AI choose?

Started by
17 comments, last by vvv2 9 years, 6 months ago

Alright so AI is basically logic. Unless you have some syntax or impanation problem you need to set priorities and think about how you want the AI to think.

Here is something I would try.

First I would read the health of the player to see what is best suited for killing them.If the player has really high health and a single big sword swing won't give the AI an advantage I would make it choose second best to save points If the player is on it's last leg about to die I would have the AI go all out to ensure the player will die If the player has a chance to be killed by a big sword swing but the AI doesn't have enough points I would make it choose the light attack to build up quickly

AI is just logic and you should think about what's the most effective way to get the result you want which mainly involve killing the player.

Advertisement

Thank's everyone for all the help.

I now have a npcs that walk around and can engage in combat, the layered approach produced a great AI with out too much of a struggle.


It is the fastest-growing AI architecture out there. Between behavior trees and utility systems, you can handle most of the AI needs out there.

I have been reading up whenever I can, it's been really interesting.

I hope to implement it into my game at some time, just need to learn more.


First I would read the health of the player to see what is best suited for killing them.If the player has really high health and a single big sword swing won't give the AI an advantage I would make it choose second best to save points If the player is on it's last leg about to die I would have the AI go all out to ensure the player will die If the player has a chance to be killed by a big sword swing but the AI doesn't have enough points I would make it choose the light attack to build up quickly

I will consider this for a hard mode.

At the moment my AI always makes the best attack choice, making it really hard to win when you accidentally selected the wrong option or when you are out numbered by even one enemy.

To solve the problem I weakened the attack of regular enemy's, it's still the same for boss battles or important battles, on easy the opponent has a one out of five chance of choosing the worst possible attack.

Game mechanics are also often more complicated

Such as : the large swords swings slower - taking more time for the complete cycle, thus it is not damage-per-swing but damage-over-time.

This also may tie into other game mechanics like having to do another action quickly and that longer swing now delays doing some other needed operation quickly.

Another might be BIG swords take 2 hands when with a small the other hand could hold a shield or second weapon.

The bigger sword may have more reach than a smaller one or it may deliver more power to a strike that isnt soaked off as much by certain kinds of armor (or be more useful to block strikes from a equivalent large sword because of its mass)

DIfferent swords often have slash moves or thrusting moves

A smaller weapon can be handier in a close fight.

Consider similarly for other weapon types available.

So the decision can be more complex and be effected by the situation (and thus the logic growing quite a bit more)

--------------------------------------------[size="1"]Ratings are Opinion, not Fact
I have made it rather obvious that I am a major fan of fuzzy logic, hehe.

The term "better" is a fuzzy term. What is better in one case, might not be better in another case. Perhaps in CQC the short sword is better, and at a longer distance, the larger sword is better.

So you have two sets. A long distance set, and a short distance set. In the set of "better at long distance", the short sword will have the mebership value of 0, and the long sword will have the membership value of 1. Any sword with a length in-between will have varying "belongingness" to the set (they will be more or less better for long distance attacks.)

Then you have the short distance set where the short sword has a membership value of 1, and the long sword has a mebership value of 0.

So any new sword will be both better and worse for any given situation, depending on the situation.

They call me the Tutorial Doctor.

I have made it rather obvious that I am a major fan of fuzzy logic, hehe.

"Utility" == "fuzzy"

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

"Utility" > "fuzzy"

;)

"Utility" > "fuzzy"

;)

I approve of this.

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

Just try them all :)

In complex games with many arbitrary factors, using a MCTS (Google it) search can be very effective.

You don't personally have to have any idea what strategy is best, and you won't have to rejigger

your whole strategy every time something changes in the game.

---visit my game site http://www.boardspace.net - free online strategy games

Just try them all smile.png

In complex games with many arbitrary factors...

Hi,

I usually use a different goal functions and different goal value for different situations and different strategies. This function is usually selected from a possible goal value in the knowledge base table.

Thanks.

(c) 2000 by "vvv2".

This topic is closed to new replies.

Advertisement