Advertisement

CTF

Started by December 17, 2005 02:29 PM
5 comments, last by Razorguts 18 years, 11 months ago
I'm trying to program aa AI for a ctf game. This is the first big AI project and I wasn't sure exactly were to start. So far I thought of a simple strategy that doesn't look to hard to implement. Basicly I want to divide all of the units into groups of 3. Each one of those groups will be in anyone on 3 main positions: Defence - attack the unit closest to the flag Patrol - go around the middle of the board, attack an enemy group if there are enough groups that can come and help you so that you will have more units than the group of enemy units. Attack - when the enemy is weak enough for an attak to be successfull that attack the enemy and try to take it's flag. The groups will always go to the place were they are most needed. For example, if there are already 3 groups gurding the flag and the time isn't right to attack then patrol. I have a few main problems: 1) Implementation - how can I write this kind of strategy in nice and flexable code? 2) How can I make the AI attack in interesting ways instead of just storming the player by the shortest paths possible? 3) Is there anyway to make this strategy better without making it much harder? 4) Are there better and/or more effective strategies for these kinds of things? I'd be happy to get any input,advice,answers - or any feedback! Thanks alot!!
"We've all heard that a million monkeys banging on a million typewriters will eventually reproduce the entire works of Shakespeare. Now, thanks to the internet, we know this is not true." -- Professor Robert Silensky
Quote: Original post by daniel_i_l
I'm trying to program aa AI for a ctf game. This is the first big AI project and I wasn't sure exactly were to start. So far I thought of a simple strategy that doesn't look to hard to implement. Basicly I want to divide all of the units into groups of 3. Each one of those groups will be in anyone on 3 main positions:

Defence - attack the unit closest to the flag
Patrol - go around the middle of the board, attack an enemy group if there are enough groups that can come and help you so that you will have more units than the group of enemy units.
Attack - when the enemy is weak enough for an attak to be successfull that attack the enemy and try to take it's flag.

The groups will always go to the place were they are most needed. For example, if there are already 3 groups gurding the flag and the time isn't right to attack then patrol.

I have a few main problems:
1) Implementation - how can I write this kind of strategy in nice and flexable code?
2) How can I make the AI attack in interesting ways instead of just storming the player by the shortest paths possible?
3) Is there anyway to make this strategy better without making it much harder?
4) Are there better and/or more effective strategies for these kinds of things?

I'd be happy to get any input,advice,answers - or any feedback!
Thanks alot!!


1) Probably looking at a finite state machine implementation, since there are fixed states
2) Swarming may be your best option
3 and 4) Well, I was working on something similar before where the strategies qere quantified and basically I was going to use a GA to optimize the parameters. So, after a few matches with itself, better strategies (parameter assignments) will appear.
Advertisement
Thanks.
Could you explain what swarming is?
Does anyone else have any other sudgestions?
"We've all heard that a million monkeys banging on a million typewriters will eventually reproduce the entire works of Shakespeare. Now, thanks to the internet, we know this is not true." -- Professor Robert Silensky
Swarming is when various individual units follow a directional trend.

You can find papers on it by searching for "Swarm Algorithm" on google.
_______________________"You're using a screwdriver to nail some glue to a ming vase. " -ToohrVyk
Assuming you have some kind of node system in place to allow the ai to move around the world, why not let the ai learn from the nodes the player moves near. Everytime the player has the flag and approaches a node, increment its player near with flag variable, decrement the other nodes variables. When the flag gets take, make the random path to pick weighted by these probabilities. You might want to add some variables for things like time since flag was taken for player to arrive to help coordinate when the ai should get there.
See:
- The Quake III Arena Bot, Jan Paul van Waveren, Masters Thesis, Delft University of Technology, June 2001, http://www.kbs.twi.tudelft.nl/docs/MSc/2001/Waveren_Jean-Paul_van/thesis.pdf, pages 81-86
- Unreal's bot AI for CTF, as documented at http://wiki.beyondunreal.com/wiki/CTFSquadAI

William

Advertisement
I utilized a Markov Chain when analyzing the CTF game style seen in Unreal Tournament (this was for a Master's level paper on the subject). It is seemingly identical to your approach (categorizing player positions, assigning location roles, etc.) Being that player roles can be defined in various "states", you assemble probability matrices, then proceed with Markovian computation under the rule that future states (player roles) can be determined from past/present states. It ultimately worked out very well...

I'm working on an article-friendly version, to be submitted to gamedev for consideration. In the meantime, if you're interested, PM me.

Thanks for reading.
AB HarrisEngineer, RG Studios

This topic is closed to new replies.

Advertisement