Jump to content
  • Advertisement
Sign in to follow this  
daniel_i_l

CTF

This topic is 4534 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'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!!

Share this post


Link to post
Share on other sites
Advertisement
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!