Jump to content
  • Advertisement
Sign in to follow this  
gamechampionx

Turn-Based AI Question

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

If you intended to correct an error in the post then please contact us.

Recommended Posts

I've been developing a text-rpg for some time now, and I've decided to re-do its AI. I've never done anything with AI prior to this project, so I've just been using my own simple algorithms. In this text game, you and your enemy take turns, starting with you. I've come up with a system where the game weighs how good an enemy action is. For example, if A is weighed at 1 and B is weighed at 2 (all relative), B will have twice the likeleyhood of being chosen as the action than A. I've gotten this to work, but my methods for determining the numbers are not very good. In the game, special abilities are customizable, so I can't just hard-code anything. I have to come up with formulas that evaluate the different possible properties of the ability and rank how good they currently are based on each player's health, weapon... My current setup uses relative arbitrary points which are not balanced really. I was thinking of re-writing the AI using a system like the follwing: Each possible action is evaluated in each of the possible categories. In each category, it is weighed in percent, 100 being representative of the ideal outcome of the special ability. Then, the categories are combined by taking their average, giving the score for the particular action. For example: Let player A have choices of action b and c. b is ranked at 100% efficiency in effect 1 of the list of 2 possible effects of an action, and 50% in category 2. c is rankend at 80%, 0% respectively. Then, a weighted average of effeciencies is take (say 50/50 to make it simple), so b is given a score of 75% and c has 40%. Then, the chance of b is 75 / (75 + 40) and c is 40 / (75 + 40). I'm wondering if this is a good way to go about controlling an enemy's turn. It will hopefully prevent them from doing pointless things, which was a problem with my old AI. Is this a common technique for performing such a task?

Share this post


Link to post
Share on other sites
Advertisement
WEll, I would say you have to consider a few factors. What is the enemy's role in the combat? What actions does it have available? If the enemies role is to destroy the player as fast as possible, then the best action will be highest damage rate every time. THe problem is, if you figure out the highest damage or "Best" attack every time, players may end up unable to defeat your enemies. Which is why alot of games just randomize most attacks such as final fantasy. They have a few actions that will take presidence over the randomize ones, like if an enemy gets low health it might heal itself. You get the idea though. I'd probably just use some sort of top down AI approach for simplicity.

Share this post


Link to post
Share on other sites
As GodBeastX said, you should probably make the enemies have some goals also - if it is low on health, it will weight special abilities that heal much higher than normal. In other words, just make the weighting for each category dynamic depending on the situation and the AI will appear much more intelligent.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!