Advertisement

So is this AI/effective way to implement AI?

Started by August 26, 2006 04:04 PM
1 comment, last by theycallhimSeeD 18 years, 3 months ago
I'm fairly new to programming in general, but I have some experience. So I have written a game (simple in concept, but there are many branching options) and I've recently attempted to start adding a computer player to the mix. The basic concept of the game is this. Firstly, its text based, secondly, its turn based. Each player recruits monsters to his/her team and attempts to beat the other players monsters to a pulp. Each monster gets 1 action per turn and can do a couple of different things such as use its turn to recruit a new monster, search for gold to hire a new monster, attack, etc. Theres more but I'm trying to keep this brief. So my starting theory (keeping in mind I know NOTHING and have read NOTHING about how to program AI) is that I will assign priorities to the various options on things to do. These priorities will take input from the changing conditions of the game. Just a couple of examples. The priority to recruit more members to your team would go up if you are significantly outnumbered. However, the priority to attack would go up as well if it was likely that you could kill one or more enemies as opposed to just damaging them. Obviously there would be a lot more than just that, but I think that gets my point across. I would think this method to be fairly effective because once I get it implemented and working, tweaking the AI is as easy as adjusting the priorities for the various actions. So I ask you all, ye who know about such things, is this a good way to start out? -Pleth

I'm working on a game! It's called "Spellbook Tactics". I'd love it if you checked it out, offered some feedback, etc. I am very excited about my progress thus far and confident about future progress as well!

http://infinityelephant.wordpress.com

I've got some AI experience, albeit only with zero-sum games. A zero-sum game means that, what the opponent looses, you gain. Applied to a game like chess this means: if his situation is getting better, yours is getting worse. If he wins, you loose. If he ties, you tie as well. The sum of your and your opponents situation is always zero.
A common way to approach AI for these games is to check every branch of the turn tree, to see what will result in the best situation. Culling methings like alpha-beta pruning are usefull for deepening the search.
I've found it pretty difficult to evaluate the game situation with this approach, the branch checking itself was significantly easier to implement. Determining the game situation is a lot less tangible, so that's where the most tweaking will be.

The difference with your approach is that your AI only reacts to situations, while this approach checks for which (available) action results in the best situation. I hope that helps you some. :)
Create-ivity - a game development blog Mouseover for more information.
Advertisement
Essentially what your AI is describing is like a "Greedy" algrothim. A greedy algorithm does whatever will help it the most for the current turn it is on. It does not look for what will help it be strong ten turns later. Its a good place to start but in general gredy algorithms are not the strongest against humans. My greedy player for board games like connect four or othello was very easy to beat compared to my AI player that looked ahead.

This topic is closed to new replies.

Advertisement