Making bots aim perfectly

Developer discussion of experimental fixes, changes, and improvements.

Moderators: Nexuiz Moderators, Moderators

Postby DeVsh » Fri Jan 04, 2008 6:51 pm

oh btw i would like to make support for JoySticks(aim support) if i could have a little go at it...
don't know what kind of code it is or what do i use to edit it but i have seen the code for rocket launcher radius when you increase it a bit it will be better than hagar (comparing to hagar it sucks) simple code may be opened in notepad
I only made isotromic games, websites an unfinishe flash game!
http://www.devushwebs.cba.pl/
DeVsh
Alien
 
Posts: 121
Joined: Fri Jun 08, 2007 7:39 pm

Postby DeVsh » Fri Jan 04, 2008 7:55 pm

hehe hacked rather opened in ZIP and edited default.cfg haha

set bot_number 0 // number of bots in server
seta bot_usemodelnames 0 // whether bots should be named after the models
set bot_nofire 0 // makes bots not attack at all, mainly for testing in g_waypointeditor mode
seta bot_prefix [BOT]
seta bot_suffix ""
// general bot AI cvars
set bot_ai_strategyinterval 2
set bot_ai_enemydetectioninterval 0.5
set bot_ai_aimskill_blendrate 2
set bot_ai_aimskill_fixedrate 15
set bot_ai_aimskill_firetolerance_distdegrees 180
set bot_ai_aimskill_firetolerance_mindegrees 2
set bot_ai_aimskill_firetolerance_maxdegrees 45
set bot_ai_aimskill_mouse 1
set bot_ai_keyboard_distance 250
set bot_ai_keyboard_treshold 0.94
set bot_ai_aimskill_offset 1
set bot_ai_aimskill_think 1
// Better don't touch these, there are hard to tweak!
set bot_ai_aimskill_order_mix_1st 0.01
set bot_ai_aimskill_order_mix_2nd 0.1
set bot_ai_aimskill_order_mix_3th 0.01
set bot_ai_aimskill_order_mix_4th 0.05
set bot_ai_aimskill_order_mix_5th 0.01
set bot_ai_aimskill_order_filter_1st 0.2
set bot_ai_aimskill_order_filter_2nd 0.2
set bot_ai_aimskill_order_filter_3th 0.05
set bot_ai_aimskill_order_filter_4th 0.25
set bot_ai_aimskill_order_filter_5th 0.3

haha the only problem is you mite don't know what they stand for if youre a newbie...

but i think bots woulld do better at ctf if you set those higher

set bot_ai_strategyinterval 2
set bot_ai_aimskill_think 1

or maybe enemy detection interval
I only made isotromic games, websites an unfinishe flash game!
http://www.devushwebs.cba.pl/
DeVsh
Alien
 
Posts: 121
Joined: Fri Jun 08, 2007 7:39 pm

Postby narvik86 » Fri Jan 04, 2008 9:31 pm

You shouldn't write post under post. What you edited is not source code, *.cfg stands for configuration file. If you think, that the problem is only to set higher values in this file you're wrong. Don't you think it would be too easy? :) Now, good luck with joystick support!
narvik86
Member
 
Posts: 41
Joined: Mon May 01, 2006 5:02 pm
Location: Poland

Postby DeVsh » Sat Jan 05, 2008 11:12 am

hehe i know they only configure the variables in the source code, so if there is no aiming support in the source code you can't make it higher for joystucks(if it doesn't exist) all i was saying that he didn't hack nex he only set aiming skill higher so you get better practise while playing with them!!!

Thats what i did set gravity to 80 and jump velocity to 3000 hehe try playing bluesky arena with those settings
I only made isotromic games, websites an unfinishe flash game!
http://www.devushwebs.cba.pl/
DeVsh
Alien
 
Posts: 121
Joined: Fri Jun 08, 2007 7:39 pm

Postby Qantourisc » Sat Jan 05, 2008 10:02 pm

DeVsh wrote:oh btw i would like to make support for JoySticks(aim support) if i could have a little go at it...
don't know what kind of code it is or what do i use to edit it but i have seen the code for rocket launcher radius when you increase it a bit it will be better than hagar (comparing to hagar it sucks) simple code may be opened in notepad

You need to obtain the nexuiz qc code.
There are files in the folder qcsrc/server/
one of them is bots.qc, there are also others ....
Have fun messing ? Ow and you need a QC compiler.
Qantourisc
Alien
 
Posts: 130
Joined: Fri Jun 16, 2006 5:44 am

Postby Qantourisc » Sat Jan 05, 2008 10:46 pm

DeVsh wrote:*

I wrote a lot of these fancy things... so here is what they do:
set bot_ai_strategyinterval 2 // How often a new objective is executed, capture flag, get health, shoot someone ...
set bot_ai_enemydetectioninterval 0.5 // How often bots pick a new target
set bot_ai_aimskill_blendrate 2 // How much correction is made to aim at the target
set bot_ai_aimskill_fixedrate 15 //What is the mim blend rate ?
set bot_ai_aimskill_firetolerance_distdegrees 180 // The influance of distance on going from mindegree to maxdegreee.
set bot_ai_aimskill_firetolerance_mindegrees 2 // The minimum used tolerance. Used onlarge distances.
set bot_ai_aimskill_firetolerance_maxdegrees 45 // THe max error to fire (so he is allowed to aim of 45 degree at close range)
set bot_ai_aimskill_mouse 1 // Howmuch of the "mouse / order filters" is used to aim. 0 would mean the desired fireing angle is set at once, without him aiming.
set bot_ai_keyboard_distance 250 // Bots must reach there waypoints verry sharply. Or else they won't count as "reached my goal" therefor we disable the keyboard interface for the bots when they get close.
set bot_ai_keyboard_treshold 0.94 // The treshold for selecting a direction on the keyboard.
set bot_ai_aimskill_offset 1 // Bots aim wrong by design, an error is included. This deteremns the size of the error.
set bot_ai_aimskill_think 1 // Do we use the perfect desired angle or the 'human aiming' angle (the one that is beeing fet trough the filters, so it aims like a human)
// Better don't touch these, there are hard to tweak!
set bot_ai_aimskill_order_mix_1st 0.01
set bot_ai_aimskill_order_mix_2nd 0.1
set bot_ai_aimskill_order_mix_3th 0.01
set bot_ai_aimskill_order_mix_4th 0.05
set bot_ai_aimskill_order_mix_5th 0.01
set bot_ai_aimskill_order_filter_1st 0.2
set bot_ai_aimskill_order_filter_2nd 0.2
set bot_ai_aimskill_order_filter_3th 0.05
set bot_ai_aimskill_order_filter_4th 0.25
set bot_ai_aimskill_order_filter_5th 0.3
// Ok to understand these you first need to know what N_th order filters are:
OK this is the output of the first order filter:
Image
the filter Says how fast it will climb. The mix says how much of this will be added to the final aim angle. So what it does it takes the difference of WHAT SHOULD BE and WHAT IS NOW and takes a % of that and correct WHAT IS NOW towards WHAT SHOULD BE.
Ok that was all the old code did, by using a very smooth blendrate (the cvar).
Ok Now the fun part starts:
On the output of the first filter, we apply that same filter on that again, creating a second degree filter. And on and on and on to the 5th filter.
Ok now what do the filters do in HUMAN language :)
So what does each filter do ? (If you are familiar with integration of acceleration to speed to position this will be natural, if not ... don't worry)
The first: tracks your POSITION
The second: tracks your MOVEMENT
Third: tracks your ACCELERATION
Fouth: PREDICTS level one: tracks your change in acceleration (so moving left/right/left/right will nolonger upset the bot, but note: this is a FORTH filter,so this takes a while to kick in)
Fifth: PREDICTS level two: predicts your next-next-movmement.
(From the third filter, things get slowly, and effects are miniam (see the MIX))
The actual correction SHOULD be in the desired angle... NOT in the mouse smoothing code.
The order filter SHOULD simulate the human movement of the mouse and other factors.
I tried matching the filter to the behaviour of a real person.
Hmmm thinking of it, when setting the bot on high level .... the bot might get more stupid :)
Tip: To tune, these you need to observer real players, and see what aim errors they make. (You must record it.) Then play it in slowmo (about 0.1 would do, or even lower in some case). Then go to the bots, keep slowmo 0.1 and try to match the bot behaviour.
Another way to tweak them is making the bots aim perfect with these filters, with there crosshair perfectly on the deisred target the entire time.

I Hope this is clear and helped a bit (wow my biggest post EVER) :)
Qantourisc
Alien
 
Posts: 130
Joined: Fri Jun 16, 2006 5:44 am

Postby DeVsh » Sun Jan 06, 2008 12:01 pm

and where the f**k is
qcsrc/server/
i have 2.2.3 if im wright

btw guys i see your patches go equal with WoW you have 2.3 and they have 2.3
I only made isotromic games, websites an unfinishe flash game!
http://www.devushwebs.cba.pl/
DeVsh
Alien
 
Posts: 121
Joined: Fri Jun 08, 2007 7:39 pm

Postby KadaverJack » Sun Jan 06, 2008 1:41 pm

DeVsh wrote:and where the f**k is
qcsrc/server/

In the obvious place: Nexuiz/sources/gamesource20070531.zip
KadaverJack
Site admin and forum addon
 
Posts: 1102
Joined: Tue Feb 28, 2006 9:42 pm

Postby Urbanshenkie » Tue Jan 08, 2008 8:25 am

lol , I love when those bots duck , when you laser them haha they react so fast
would be so sad if you cant hit them at all
Urbanshenkie
Alien
 
Posts: 145
Joined: Tue Dec 04, 2007 11:15 am

Postby Qantourisc » Tue Jan 08, 2008 2:07 pm

Urbanshenkie wrote:lol , I love when those bots duck , when you laser them haha they react so fast
would be so sad if you cant hit them at all
The bots can duck ! ? Never knew that .... Since when ? :) Did i trigger this behavior ??? (Me ask div0)
Qantourisc
Alien
 
Posts: 130
Joined: Fri Jun 16, 2006 5:44 am

PreviousNext

Return to Nexuiz - Development

Who is online

Users browsing this forum: No registered users and 1 guest

cron