Why bots aren't better at CTF

Developer discussion of experimental fixes, changes, and improvements.

Moderators: Nexuiz Moderators, Moderators

Why bots aren't better at CTF

Postby xoltra » Sat Nov 03, 2007 10:14 pm

Recently I was playing 1v1 CTF with a bot on a map that has waypoints at a high skill level. I looked into why the bot captured the flag less than I thought it should. I thought I'd post what I learned about bots and CTF just in case it interests anyone else.

The bot captured the enemy flag less often than I thought he should. Closer examination revealed that the bot would occasionally walk past the enemy flag with no apparent interest in it. Sometimes if the bot was sufficiently far from the enemy flag it would seem to be out of range. If the game mode is such that there are no potential goals (no "pick up items", etc.) on the map other than enemy flag the bot will sit motionless if the enemy flag is far enough away.

There are two reasons for this:
1) The bot's goals are determined by its current role. The bot's role is determined by the state of the game. Not all roles value flags.
2) There is a tradeoff between how far goals can be (in terms of the number of intervening waypoints) and still be considered by the bot and with the startup time when the level includes bots.

As to 1) the roles are things like "carrier", "defense", "interceptor", "middle" and "offense". Occasionally the role will change at random intervals. It also specifically changes as a function of what is going on with the flags.

For example, when an enemy gets the flag the bot's role changes to "interceptor". "interceptor" places a high value on the enemy flag carrier as a goal. So the bot is highly inclined to find a path via the waypoints to get to the enemy flag carrier, and hopefully kill him.

One reason why the bot sometimes seems to have no interest in the enemy flag is that it may have a role that places no value on the enemy flag ("middle", for example). I suspect one way of addressing this would be to place some minimum small value on the enemy flag in all roles. Most bots that aren't playing offensively would still remain where they are, but any bot that got lucky enough to get close enough to the enemy flag would pick it up. But I have not verified this.

Since multiple roles may apply the bot occasionally switches from one applicable role to another. Sometimes, if there are no other items on the map to get, the bot will sit motionless while its role is "middle" or "defense" and then only start moving when its role finally changes to "offense". Perhaps the role should be changed immediately if it results in a motionless bot that has no goal. I have not verified this.

As to the trade off mentioned in 2) if you search for "1050" in qcsrc/server/bots.qc you'll find a magic hard coded parameter that controls then number of waypoints that the bot is willing to look through to get its goal. I found setting this variable to "3000" was sufficient to get the bot to repeatedly go all the way from its base to the enemy base and capture the enemy flag on a moderate sized map, like Chasmv2. But it then takes almost 10 seconds to startup. Try different values. This value should probably be a variable.

Anyway, the above is something I always wanted to understand better. I hope it's interesting.
xoltra
Member
 
Posts: 19
Joined: Sat Jul 15, 2006 11:03 pm
Location: Austin TX USA

Postby [-z-] » Sat Nov 03, 2007 11:00 pm

Cool, interesting to know.
[-z-]
Site Admin and Nexuiz Ninja
 
Posts: 1794
Joined: Mon Nov 13, 2006 12:20 am
Location: Florida

Re: Why bots aren't better at CTF

Postby LordHavoc » Sat Nov 10, 2007 7:16 am

One quick note - the 1050 value is the distance between any two waypoints, the search distance through the waypoint network is unlimited.

Maps should not be made with waypoints further apart than 1024 units.

This value was chosen because of startup time only, maps can be adapted to place waypoints more often to stay under this limit, which is much better than taking longer to start up.

P.S. I wrote the bots, and 95% of the code is still mine.
LordHavoc
Site Admin
 
Posts: 191
Joined: Wed Mar 29, 2006 7:39 am
Location: western Oregon, USA

Postby divVerent » Sat Nov 10, 2007 12:27 pm

Another odd bug with them I never could find the cause of: on eggandbacon, they fail to find a route to the flag. But if I am actually HOLDING the flag and sit on the VERY SAME spot, they find me.
1. Open Notepad
2. Paste: ÿþMSMSMS
3. Save
4. Open the file in Notepad again

You can vary the number of "MS", so you can clearly see it's MS which is causing it.
divVerent
Site admin and keyboard killer
 
Posts: 3809
Joined: Thu Mar 02, 2006 4:46 pm
Location: BRLOGENSHFEGLE

Postby xoltra » Wed Nov 14, 2007 2:05 am

LordHavoc,

Thanks for explaining that. I only understood the 1050 parameter in a vague sense. I probably should not have messed with it (maps where the waypoints are too far apart should be regarded as buggy, as you point out).

I've had fun reading through reading through the code you wrote, learning about Nexuiz and writing my patch in spite of my criticism in my other posts.
xoltra
Member
 
Posts: 19
Joined: Sat Jul 15, 2006 11:03 pm
Location: Austin TX USA


Return to Nexuiz - Development

Who is online

Users browsing this forum: No registered users and 1 guest

cron