opponent bot
I had given bots some thought in the past. Basically what you're creating here is not all that easy to do. Making a decent AI is a very tough job as you have to consider many different possibilities the game might throw at your bot. It works pretty much the Lego's where you have to make the small parts and then put them together the way they fit to form a whole. Based on the parts I mentioned, you easily could break down some of the AI into the following sections:
Quote:
Navigation
The ability to navigate through the level, remember where powerups/carrots/ammo/ctf bases/etc. are, ability to take warps as shortcuts, ability to learn how to play the level based of what actions (that the bot performed in the past) were more successful over others making the bot choose the action which has a greater chance of success over the ones with lower chance, etc.
Combat
This is where it comes to defeating the enemy. It includes the ability to choose proper weapons from proper situation, prediction of what the enemy might do next, avoidance of enemy gunfire, ability to use terrain to its advantage, observe what other 1337 players do and try to learn from them, etc.
Tactic
Having enough navigation over the level and enough combat skills does not neccessarily make bot good, such bot would still be "dumb". This is where tactic skill comes in place. Some things it includes would be the ability to find the fastest way from enemy flag base to home flag base, take decisions based on the current status of the bot and/or game (health, availavle weaponry, location, game victory conditions) - should the bot go after the enemy flag, assist the ally flag carrier, go after the enemy flag carrier or defend the base, should he search & destroy the players or look for carrots when low on health, etc.
Interface
Here is how you communicate with the bot, give him orders or at least make him try to figure out what the other players are doing so that he may enter the teamwork.
|
The above sections are by no means a complete list and I'm sure you could come up with a bunch more yourself and/or finetune mine, however I'm not here to make the dirty work for you, I'm simply giving you the general idea of how I imagine a good AI should be structured.
I'll give you an example of how I imagined the tactical part of the bot. Personally I would make the bot form a list of preferred actions he can do based on the current game status. Suppose your bot plays a CTF match with 3 players on red, the bot and 2 other human players on blue. The bot currently has the flag in possesion, but is very low on health and close to home base. One of the enemy players also has your flag in possesion. So now the big question...
What to do?
Quote:
Status: You have enemy flag in possesion
Question: Is your team flag in base?
Answer: Yes Action: Score a point
Answer: No Action: Enemy has your flag => What to do?
|
Alright by this point it's clear that the bot would choose the "Enemy has your flag" part.
Quote:
Status: Enemy has your flag
Option: Take best defensive action Probability: High Reason: Teammates are present. They can go after the flag carrier.
Option: Go after enemy flag carrier Probability: Low Reason: You have flag and teammates are present, unneccessary risk.
|
So now the bot would figure that there are teammates on his side that can and will go after the enemy flag carrier. The best thing for him would be to stay home and try avoid any enemy contact. He should also try to replenish his health as seen in next status:
Quote:
Status: Low on health
Option: Replenish health Probability: Vey High Reason: You have flag and are low on health.
|
So based on the decisions taken, the bot would make a list of all actions he can undertake and choose among those with biggest importance - this means he would do actions with greater probability more frequently than those with lower probability. For example: Collecting health over collecting ammo, staying home over going after enemy flag carrier, etc. The actions can change at any moment (take it the enemy flag carrier has fallen for example) so the bot would have to keep an eye out on the status and choose the proper action accordingly.
Here's how the final list of actions would look like:
Quote:
Action: Look for health
Probability: 100%
Reason: Low on health and have flag in possesion
Action: Avoid enemy contact
Probability: 90%
Reason: Must stay alive
Action: Stay close to home base
Probability: 80%
Reason: Easier to score faster
Action: Search for ammo
Probability: 10%
Reason: Most of weapons have sufficient ammo
Action: Combat enemy players
Probability: 10%
Reason: Unneccessary risk, must stay alive
Action: Seek out and destroy the enemy flag carrier
Probability: 5%
Reason: Unneccessary risk
Action: Score a point
Probability: 0%
Reason: Impossible, enemy has flag
|
And after the enemy flag carrier fell:
Quote:
Action: Score a point
Probability: 100%
Reason: Game win condition
Action: Avoid enemy contact
Probability: 90%
Reason: Must stay alive
Action: Stay close to home base
Probability: 90%
Reason: Easier to score faster
Action: Look for health
Probability: 60%
Reason: Low on health and have flag in possesion
Action: Search for ammo
Probability: 0%
Reason: Irrelevant
Action: Combat enemy players
Probability: 0%
Reason: Unneccessary risk, must stay alive, irrelevant
Action: Seek out and destroy the enemy flag carrier
Probability: 0%
Reason: Does not exist
|
That's all I have to say for now. Please note that I have written this briefly and I'm sure you could find some parts questionable, however as I stated, making a decent AI is not an easy task. If you find yourself undertaking the task to make an AI, I strongly recommend that you first build a prototype of it on the drawing board.
~Ol
__________________
<a href="http://nmap.org/"><img border="0" alt="Nmap Security Scanner" src="http://images.insecure.org/nmap/images/prop/nmap_bnr_matrix_pfos.gif"/></a>
Last edited by Cpp; Aug 18, 2006 at 11:56 AM.
Reason: Typos fixed
|