#### Archived

This topic is now archived and is closed to further replies.

# AI (turn based game)

This topic is 5378 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hi. I need some advice to build the AI into my game. It is a turn based game like Final Fantasy. There are spells like: fire, water, light...and protective spells like: protection against fire, water, all magic, physical attack...Some spells with special effects like: poison, decrease mana for X turns, increase X life for X turns, .... How can I implement this kind ok AI. Any suggestions, links, articles or peace of code would be great. Thanks.... oww..sorry about the poor english... i''m from Brazil.. ^^

##### Share on other sites
The simplest way is to choose an action randomly. You just need to assign probabilities to each possible action.

##### Share on other sites
There are many ways you could implement such a system. For an example, check out AI Game Programming Wisdom, in which a Fuzzy Logic example is provided. You might alternatively consider a Bayesian Network model, a simple, scripted Finite State Machine, a Decision Tree, or some other method you come up with after rejecting these.

Good luck,

Timkin

##### Share on other sites
Take a look at this thread for some interseting suggestions.

##### Share on other sites
quote:
Original post by Timkin
You might alternatively consider a Bayesian Network model, a simple, scripted Finite State Machine, a Decision Tree, or ...

...a neural network?

hee hee,
Predictor
http://will.dwinnell.com

##### Share on other sites
Hello.

I have decided to implement the AI for the game like, using a rule based system. Something like Christian Cats and Dogs wandering and fighting found in Game Programming Wisdom. So, i think that i could have a set of rules to each action possible in the game and keep this set of rules in a list or vector associated with the action. Like:

action: use healing;
rules: mana > mana_cost; health <= X; its not possible to kill the enemy and win the round; you dont have the "rebirth" ability...etc etc.

action: use fireball;
rules: mana > mana_cost; enemy dont have fire protection; etc etc.

Is this a good aproach to use??

if yes:
I need some advices, and some kind of trick to decide when to use healing and fireball when all the rules are true. Do i have to make some kind of tree of priority?

The hero classes in my game are like: monster(great vitality, poor magic) and mage(porr vitality and great magic). (i have other classes but i will not specify here). How can i implement fixes strategies that the computer could use to win using this kind of rule based system?

if no:
sugestions.....

thanks...

????

##### Share on other sites
Err... isn''t that a decision tree?

I don''t think that''s the best approach. IMHO, I like the brute force method of evaluating every action, then applying weights, then choosing the action with the highest score.

ex:

Fighting a fire monster:
Normal attack: 10 damage * 1 = 10
Water attack: 20 damage * 1 = 20
Heal myself: +15HP * 0 = 0
> use water attack...

Fighting fire monster while critically wounded:
Water attack: 20 damage * 1 = 20
Heal myself: +15HP * 5 = 75
> heal myself.

I think it''s easier than a decision tree, but that''s just me.

Yes... VB6 is here to steal your minds. Very slowly.

##### Share on other sites
My idea is like yours, but just structured in classes. I´m worried about the huge amount of mathematical expressions to evaluate the score for each move.

##### Share on other sites
If it is a turn-based game, the calculations shouldn''t be that bad unless you have either 1000 enemies onfield, or each enemy with 1000 different methods of attack.

Yes... VB6 is here to steal your minds. Very slowly.

1. 1
2. 2
Rutin
16
3. 3
4. 4
5. 5

• 26
• 11
• 9
• 9
• 11
• ### Forum Statistics

• Total Topics
633704
• Total Posts
3013457
×