Making bots aim perfectly

Developer discussion of experimental fixes, changes, and improvements.

Moderators: Nexuiz Moderators, Moderators

Tue Oct 30, 2007 4:58 am

  • Just for my own amusement I hacked the bot aiming code to see what it would be like to play bots that had perfect aim and reflexes (that is, beyond skill level 10, which still emulates some lag and inaccuracy in the aiming).

    Applying the patch only changes Nexuiz when the skill level is set to 100. With it bots are extremely good when armed with a Nex. It's fun to try it with a mode that bots do badly at, such as CTF, to see if perfect aim sufficiently compensates for their lack of understanding.

    You can get my patch here:
    http://home.austin.rr.com/selliott4/nexuiz/nexuiz-skill-100.diff
    xoltra
    Member
     
    Posts: 19
    Joined: Sat Jul 15, 2006 11:03 pm
    Location: Austin TX USA

Tue Oct 30, 2007 5:14 am

  • For those who don't want to apply a patch to get the effect, just play with Hafner, ai, tZork, t0_drunken_master, and CUISINER. :)
    Xeno
    peregrinus originis incognitae
     
    Posts: 396
    Joined: Wed Nov 15, 2006 10:42 pm

Tue Oct 30, 2007 1:06 pm

Tue Oct 30, 2007 3:40 pm

  • morfar wrote:
    Xeno The Blind wrote:Hafner, ai, tZork, t0_drunken_master, and CUISINER. :)

    :(


    Sorry morfar, I just haven't played with you enough, so I don't have any memories of going "HTF can he keep hitting me like that?".
    Xeno
    peregrinus originis incognitae
     
    Posts: 396
    Joined: Wed Nov 15, 2006 10:42 pm

Tue Oct 30, 2007 5:31 pm

Wed Oct 31, 2007 4:49 am

  • I've update the patch so that it now upstates the bot's enemy origin every bot thinking timeslice. I've also resized that g_shootfromeye helps. With those changes the bot is practically 100% accurate with a Nex (the only misses seem to be when it occasionally fires a shot after the human is dead, or before the human is fully spawned). See the comments in the patch for details:
    http://home.austin.rr.com/selliott4/nexuiz/nexuiz-skill-100.diff
    xoltra
    Member
     
    Posts: 19
    Joined: Sat Jul 15, 2006 11:03 pm
    Location: Austin TX USA

Wed Oct 31, 2007 6:55 am

  • Amazing shots ai!

    Do you use an FOV zoom? I didn't see any zoom in the demo. If you don't mind me asking, what FOV and sensitivity do you use for normal and zoom settings?
    User avatar
    AceOfThumbs
    Alien
     
    Posts: 158
    Joined: Tue Sep 04, 2007 11:12 pm

Wed Oct 31, 2007 7:23 am

  • AceOfThumbs wrote:Amazing shots ai!

    Do you use an FOV zoom? I didn't see any zoom in the demo. If you don't mind me asking, what FOV and sensitivity do you use for normal and zoom settings?

    Yup I use fov zooming from time to time, I like it better than Nex's zoom (even when tweaked it). For normal settings I use fov 110 and sens 6 (different values differ on the mouse settings. I basically use any value that gives me about 30-34 cm for a whole circle when draging the mouse).
    When zooming it's 40 with sense 1.2, it's about the same as the '5' value with the Nex secondary.

    And to Xoltra: For those who do not know what a .diff file is. Could you explain a little what to do with it and how to use it? :)
    User avatar
    ai
    Forum addon
     
    Posts: 2131
    Joined: Sun Mar 05, 2006 3:54 pm
    Location: Behind you

Thu Nov 01, 2007 5:11 am

  • ai,
    I had fun watching your demo. That's quite a huge map.

    As to what to do with the patch:

    The patch contains the differences between Nexuiz 2.3 and my change. You can apply it to the source code with the following steps. Note: These steps are for Linux. Hopefully Windows users can translate these steps for their OS.

    1) Get fteqcc in order to compile Quake C code from
    http://sourceforge.net/project/showfiles.php?group_id=116842
    2) Unzip the gamesource20070531.zip Quake C code:
    unzip gamesource20070531.zip
    3) Apply the patch using Larry Wall's patch program
    patch -p0 < nexuiz-skill-100.diff
    4) Build the server:
    cd qcsrc/server
    fteqcc
    5) Copy the resulting progs.dat file to your data directory:
    cp progs.dat ~/.nexuiz/data
    6) Run Nexuiz with variables set that allows the bots to show off their aim:
    g_minstagib 1
    g_shootfromeye 1
    skill 100

    If someone runs this patch on a minstagib server let us know people's reactions, but don't run it to long - that would be mean :twisted:
    xoltra
    Member
     
    Posts: 19
    Joined: Sat Jul 15, 2006 11:03 pm
    Location: Austin TX USA

Fri Nov 02, 2007 7:07 pm

  • I'd like to see this in 2.4 but divverent keeps rejecting everything even tzorks turrets. This ain't an opensource project, this is divverent's dictatorship. Nexuiz needs to be forked or more help gotten or div sent to cool down so he don't block the way like he is now.
    K-LorvianChant
    Banned
     
    Posts: 7
    Joined: Fri Nov 02, 2007 6:50 pm

Fri Nov 02, 2007 7:23 pm

Fri Nov 02, 2007 7:26 pm

  • K-LorvianChant wrote:I'd like to see this in 2.4 but divverent keeps rejecting everything even tzorks turrets. This ain't an opensource project, this is divverent's dictatorship. Nexuiz needs to be forked or more help gotten or div sent to cool down so he don't block the way like he is now.

    If that's your opinion, then shut up and do it.
    User avatar
    KadaverJack
    Site admin and forum addon
     
    Posts: 1102
    Joined: Tue Feb 28, 2006 9:42 pm

Fri Nov 02, 2007 7:28 pm

  • yep, I wonder why he's keeping his men's liberty server up at all.
    uncomfortable
    random
    mean
    embarrassing
    limited
    User avatar
    Urmel
    Forum addon
     
    Posts: 1744
    Joined: Fri Mar 03, 2006 10:06 am
    Location: Offline

Fri Nov 02, 2007 10:13 pm

  • K-LorvianChant wrote:I'd like to see this in 2.4 but divverent keeps rejecting everything even tzorks turrets. This ain't an opensource project, this is divverent's dictatorship. Nexuiz needs to be forked or more help gotten or div sent to cool down so he don't block the way like he is now.


    Wth? i never asked for my turrets to be supported, included or whatever. it just something i do on my spare time. if it gets included one day, cool, if not thats fine too. and how on earth can you precive nexuiz as "divverent's dictatorship" did he reject personaly implementing and doing all the work for some hairbrain idea of yours? you say nexuiz needs more work and still you flame one of the most productive members of teh dev team? plz just stop coming here, your negavivity and trolling are just anoying and counterproductive.

    Oh and yes, plz fork nexuiz and deal with the issues you see fit yourself, it would make things mutch better for the nexuiz community not having you arround bitching and trolling here.
    HOF:
    <Diablo> the nex is a "game modification"
    <Diablo> quake1 never had a weapon like that.
    <Vordreller> there was no need for anything over 4GB untill Vista came along
    <Samua>]Idea: Fix it? :D
    <Samua>Lies, that only applies to other people.
    User avatar
    tZork
    tZite Admin
     
    Posts: 1337
    Joined: Tue Feb 28, 2006 6:16 pm
    Location: Halfway to somwhere else

Sat Nov 03, 2007 9:30 pm

  • Since it's possible that making bots aim perfectly is something that only I'm obsessed with I'll make this my last post in this thread (unless people want to talk about it).

    I simplified the patch so that bot_aimdir() just points the bot straight toward the human (with motion compensation) and then exits. Also since at skill 100 the bot is much stronger with the Nex than any other weapon I made it so that if the skill level is 100 the bot always selects the Nex if he has one and has ammo for it.

    I also made it search harder for goals, but more on that in another thread.

    My patch is in the same place as before:
    http://home.austin.rr.com/selliott4/nexuiz/nexuiz-skill-100.diff
    xoltra
    Member
     
    Posts: 19
    Joined: Sat Jul 15, 2006 11:03 pm
    Location: Austin TX USA

Sat Nov 03, 2007 10:14 pm

  • I think it is a cool topic, xoltra. I have a hard enough time with the bots without perfect aim, though.

    I think it would be great if you could try to create more intelligent bots for CTF.
    User avatar
    AceOfThumbs
    Alien
     
    Posts: 158
    Joined: Tue Sep 04, 2007 11:12 pm

Wed Nov 07, 2007 8:13 am

  • It would be great if someone did that for the CTF logic, AceOfThumbs, but I'm not a Nexuiz developer. This patch is just something I had fun messing with. I'm not planning on investing much more time time with Nexuiz code right now. If someone else wants to mess with it check out my "Why bots aren't better at CTF" topic for my thoughts. Consider messing with the roles and goals. Coming up with some way assuring that bots never stand still, perhaps some sort of Brownian motion random walk if nothing else, would help significantly.

    I did make one last enhancement to my patch - bots both pick their enemy and decide to fire their weapon based on testing line of sight from their vantage point to a single point within their enemy's bounding box. That point may either be their enemy's origin or the center of the bounding box, which is close to the same thing.

    The problem is that if you are partially obscured, such as when you are on a platform looking down at the bot, the bot may not fire since your origin may be obscured. In such cases you can fire down at the bot with impunity.

    With my latest patch if there is not a line of sight to its enemy's origin the bot will then test line of sight to all eight corners that make up its enemy's bounding box. It will shoot at whichever corner is exposed. With the latest patch at skill 100 if the bot has a nex it will almost always shoot you before you can even see him.

    There was some talk in this thread about this patch being accepted into Nexuiz. That's fine with me, but as I mentioned I consider this patch to just be a fun hack. For a real fix ideally more work should be done to make what I did seamlessly integrated into the skill system rather than having a skill of 100 be a magic value. It seems like increasing the skill from its minimum value (currently 0) to its maximum value (currently 10) should result in gradual increases in skill.

    As to the bigger picture - this may seem like flame bait, but there are issues with the Quake C code that ideally would be cleaned up.

    There is a lot of commented out code. For example, look at all the commented out code in bots.qc. It's not a big deal, but it's something people have to sort through. It would be nice if most of it was deleted. It's all in some version control system anyway, right?

    An even bigger issue is that Quake C either has limitations that compelled the authors of some of the code in Nexuiz to do some odd things. For example, this pushes something onto a stack:

    void(entity e) navigation_pushroute =
    {
    self.goalstack31 = self.goalstack30;
    self.goalstack30 = self.goalstack29;
    self.goalstack29 = self.goalstack28;
    self.goalstack28 = self.goalstack27;
    ...
    self.goalstack02 = self.goalstack01;
    self.goalstack01 = self.goalcurrent;
    self.goalcurrent = e;
    }

    Yes, all 32 slots within the stack are hard coded. It's repeated again for the pop and again to clear all the slots. This has to do with limitations in Quake C:
    http://en.wikipedia.org/wiki/QuakeC

    So I understand that enhancing something like Quake C is hard and that everyone involved probably behaved reasonably given the constraints they had. But at the same time I just want to point out that there are these limitations and that there is a significant cost in terms of how cumbersome the code is.
    xoltra
    Member
     
    Posts: 19
    Joined: Sat Jul 15, 2006 11:03 pm
    Location: Austin TX USA

Fri Nov 23, 2007 2:44 pm

  • Bots with perfect aim are so frustrating .. I remember my time playing Q3 solo campaign last level on nightmare. Beating this bot was a coinflip (good spawns needed and hope he dont get the railgun to often). However, intelligent bots would be nice :D
    User avatar
    Bundy
    Alien
     
    Posts: 230
    Joined: Sat Jun 23, 2007 10:47 am

Wed Jan 02, 2008 2:42 pm

  • I just made the bots less perfect :)
    Bots that aim perfect are bad for your skill. They teach you tons of bad habits.
    In any case you can aim perfecty, but using a rocket launcher perfectly involves more then just aiming.
    Qantourisc
    Alien
     
    Posts: 130
    Joined: Fri Jun 16, 2006 5:44 am

Fri Jan 04, 2008 6:49 pm

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

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

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

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

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

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

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

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
    User avatar
    KadaverJack
    Site admin and forum addon
     
    Posts: 1102
    Joined: Tue Feb 28, 2006 9:42 pm

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

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

Next


Return to Nexuiz - Development




Information
  • Who is online
  • Users browsing this forum: No registered users and 1 guest