Improving the bots

Developer discussion of experimental fixes, changes, and improvements.

Moderators: Nexuiz Moderators, Moderators

Postby mand1nga » Sat Dec 13, 2008 1:35 pm

Yes like Morfar said this patch touches only two files, if something goes wrong you just "rm havocbot.qc bots.qc && svn up" or "svn revert havocbot.qc bots.qc". You won't have merging conflicts because these files weren't updated since a couple of months.

I think there are three things to test:

1) Custom weapon AI
Playing around with the following cvars

Code: Select all
set bot_ai_custom_weapon_priority_distances "200 700" // Define close and far distances in any order, the bots will detect middle distances automatically.
set bot_ai_custom_weapon_priority_far "9 7 13 6 4 3 2 1" // Desired weapons in any order. Up to the max ammount of weapons available in the system
set bot_ai_custom_weapon_priority_mid "14 7 6 4 3 2 1" // same as previous
set bot_ai_custom_weapon_priority_close "7 14 3 2 1" // same as previous



2) Weapon combo support

Code: Select all
set bot_ai_weapon_combo 1 // Enable weapon combos
set bot_ai_weapon_combo_threshold 0.3 // Try to make a combo N seconds after the last attack


3) Both features combined

Just playing with one bot in an open map, watching it and changing these cvars in the middle of the game should do the trick.

I hope you have some fun while testing :D

Thank you very much for your support guys. Now this is a little contagious to me, I'll try to test too other contributions during the weekend.
mand1nga
Alien trapper
 
Posts: 321
Joined: Mon May 12, 2008 12:19 am

Postby mand1nga » Mon Dec 15, 2008 8:31 pm

divVerent wrote:Actually, I looked at the patch now, and found it doesn't even do much at all. Maybe it would even be wise to use it, and manually calculate the weapon priorities for the distances based on the weapon parameters (e.g. by a script, or an excel worksheet).

That would make the bots a bit less smart, but provide an easy way to add new weapons, and also it would allow different bot "personalities" in the future (like in UT or Q3A, that is, making one bot a "rocket whore", another a "laser camper", the next one an "annoying sniper", etc.).


Sure, I've started with simple things :)

Yes this system can be a temporary replacement for the current weapon choosing ai, it can be adjusted easily to match the preferences of any good player. Also we can provide immediate support for the new weapons.
However I would like to clean and fix the current algorithm, it should be a lot wiser and adaptable to any other further weapon tweaking. I think I will need a lot of time for doing that.
I've noticed this function is not modular, in the sense of providing support for new weapons. What do yo think about moving this weapon "rating" support to weapons code ? Like any weapon can answer you with an arbitray "rating" (damage/sec) if you give them the distance to the enemy, among other info.

Now the weapon priority is server-wide, I think the only way for supporting bot "personalities" is with a new command like:

Code: Select all
bot_settings #<bot number> <parameter> <value>


then the parameters can be: distances, weapon_priority<distance>, etc, etc
furthermore we can provide more parameters, like skill, aiming speed, etc, etc :)

Thank you very much divVerent
mand1nga
Alien trapper
 
Posts: 321
Joined: Mon May 12, 2008 12:19 am

Postby divVerent » Tue Dec 16, 2008 8:18 am

Yes, it should go to weapon code.
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 mand1nga » Tue Dec 16, 2008 3:48 pm

Ok, now this is what I plan to do for the next patch:

1) Provide support for making the distance-based weapon logic bot independent, but preserving the server-wide logic. With this the bots will have different styles or personalities. I thought about a better way for doing this just with cvars, something like this

Code: Select all
set bot_ai_custom_weapon_priority_distances1 "X Y"
set bot_ai_custom_weapon_priority_far1 "A B C"
..
set bot_ai_custom_weapon_priority_distances5 "Y X"
set bot_ai_custom_weapon_priority_far5 "C B A"
..


So bots 1 and 5 will behave differently, you can set these vars for N bots and it will be detected automatically.

2) Support for executing client commands. Based on the previous item I could easily a way for the bots to execute client commands. This will make easier debugging the bots, also it can be funny (ie: virtual bunny hopping, saying random stuff, etc) :)
This should be something like:

Code: Select all
set bot_ai_execute1 "say blah"
set bot_ai_execute1 "+jump"


then the bot executes the code and clear the cvar.

3) Move the weapon rating logic to weapon code

4) Provide basic support evaluating the new weapons with the old algorithm

Please tell me if you see something wrong with this or if you consider there is more important stuff to do

Cheers
mand1nga
Alien trapper
 
Posts: 321
Joined: Mon May 12, 2008 12:19 am

Postby [-z-] » Mon Dec 22, 2008 3:41 am

Is this in SVN now? According to my failed patch, it appears to be. You need to visit IRC more often mand1nga :)
[-z-]
Site Admin and Nexuiz Ninja
 
Posts: 1794
Joined: Mon Nov 13, 2006 12:20 am
Location: Florida

Postby RoKenn » Fri Dec 26, 2008 11:11 pm

C.Brutail wrote:how'd it interract with the next version of SVn update? Could it fail?


A very easy way to avoid that is to just reverse the patch before you update.

You can accomplish this by applying the patch again with the "-R" option.
[Tue Aug 5 2008] [00:15:01] <Ronan`> RoKenn, you're an evil person :P
Image
RoKenn
Alien
 
Posts: 141
Joined: Wed Apr 25, 2007 10:25 pm

Postby mand1nga » Sat Dec 27, 2008 10:59 pm

I've just finished another set of improvements, focused only on item pickup evaluation:

Teamwork
For team game modes now the bots won't perform any evaluation on items that are needed by other team mates, but they will take it anyway if enemies are closer to it than any other friend. The same applies if no team mate is inside a given radius with center on the item, set with this cvar

Code: Select all
set bot_ai_friends_aware_pickup_radius "500"


Please have in mind that this fix is not perfect, bots still can grab items in front of you because they rely heavily on items to perform map navigation. I hope to improve this someday, now I prefer to work in more immediate stuff.

Weapon evaluation
I've moved the item evaluation code to the bot ai, instead of using the default "commodity" evaluation functions. I hope with this to make the bots a little smarter. This is what I've done so far

Weapon priority propagation
If the "custom" weapon priority is set (cvars bot_ai_custom_weapon_priority_*) the bots will try to ignore the default weapon rating set by the function register_weapon(..) @ items.qc , in order to perform a re-evaluation based on the desired weapon priority.
This means that if I set bot_ai_custom_weapon_priority_far "9 7" they will try to grab the rocket before the nex. In other words they will try to get first their "favorite" weapons.

I saw that you are using only three default ratings for weapon evaluation: 2500, 5000, 10000. This is why I've created three new constants BOT_PICKUP_RATING_[LOW|MID|HIGH] just to make the code easier to follow.

Weapons already taken
Now bots will try to grab all the weapons, no matter if they have it already, according to their skill. A "godlike" bot will try to steal all weapons.

Ammo evaluation
Now they will grab ammo only if they need it. For example if they don't have an uzi then they will ignore any nails ammo.

I hope you like it. Please help me to test it, any feedback will be welcome.

Cheers
mand1nga
Alien trapper
 
Posts: 321
Joined: Mon May 12, 2008 12:19 am

Postby [-z-] » Sun Dec 28, 2008 12:42 am

Cool man :) sounds good, I'll give it a run later and let you know.
[-z-]
Site Admin and Nexuiz Ninja
 
Posts: 1794
Joined: Mon Nov 13, 2006 12:20 am
Location: Florida

Postby divVerent » Sun Dec 28, 2008 7:30 pm

Next time, please post a working patch. This patch missed the @@ in the lines with line numbers, making it impossible to apply directly.

Apparently the pastebin you used broke the patch. Use http://paste.debian.net in the future, please.

Pastebins breaking patches seems to be a common issue now :(
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 mand1nga » Sun Dec 28, 2008 8:16 pm

aww that renders that site completely useless :?

the funny thing is that I've posted it to debian too .. but I didn't like the post expiration, that's why pastebin seemed safer to me

please next time just tell me and I'll send it to you by any other mean, I hope you don't waste too much time with this

thank you very much :D
mand1nga
Alien trapper
 
Posts: 321
Joined: Mon May 12, 2008 12:19 am

PreviousNext

Return to Nexuiz - Development

Who is online

Users browsing this forum: No registered users and 1 guest

cron