]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Bot AI: increase the amount of error induced to the bots aim with skill < 10, make...
authorterencehill <piuntn@gmail.com>
Mon, 5 Sep 2022 20:48:36 +0000 (22:48 +0200)
committerterencehill <piuntn@gmail.com>
Mon, 5 Sep 2022 20:56:57 +0000 (22:56 +0200)
qcsrc/server/bot/default/aim.qc
xonotic-server.cfg

index 96de17a747172a93202db1e09053cec518ad94df..f05097fd4b2bbc49b7b16e98cfd087522c5a03b6 100644 (file)
@@ -201,14 +201,18 @@ void bot_aimdir(entity this, vector v, float maxfiredeviation)
 
        // get the desired angles to aim at
        //dprint(" at:", vtos(v));
-       v = normalize(v);
+       //v = normalize(v);
        //te_lightning2(NULL, this.origin + this.view_ofs, this.origin + this.view_ofs + v * 200);
        if (time >= this.bot_badaimtime)
        {
-               this.bot_badaimtime = max(this.bot_badaimtime + 0.3, time);
-               this.bot_badaimoffset = randomvec() * bound(0, 5 - 0.5 * (skill+this.bot_offsetskill), 5) * autocvar_bot_ai_aimskill_offset;
+               this.bot_badaimtime = max(this.bot_badaimtime + 0.2 + 0.3 * random(), time);
+               int f = bound(0, 1 - 0.1 * (skill + this.bot_offsetskill), 1);
+               this.bot_badaimoffset = randomvec() * f * autocvar_bot_ai_aimskill_offset;
+               this.bot_badaimoffset.x *= 0.7; // smaller vertical offset
        }
-       desiredang = vectoangles(v) + this.bot_badaimoffset;
+       float enemy_factor = ((this.bot_aimtarg) ? 5 : 2);
+       // apply enemy_factor every frame so that the bigger offset is applied instantly when the bot aims to a new target
+       desiredang = vectoangles(v) + this.bot_badaimoffset * enemy_factor;
        //dprint(" desired:", vtos(desiredang));
        if (desiredang.x >= 180)
                desiredang.x = desiredang.x - 360;
index a06cd2ec5bfaeeb570e5402d55f889779574861c..f94c9ab78d618fd3a1a304a7081cb54906b84bec 100644 (file)
@@ -142,7 +142,7 @@ set bot_ai_aimskill_firetolerance 1 "enable fire tolerance"
 set bot_ai_aimskill_mouse 1 "How much of the aiming filters are applied"
 set bot_ai_keyboard_distance 250 "Keyboard emulation is disabled after this distance to the goal"
 set bot_ai_keyboard_threshold 0.57
-set bot_ai_aimskill_offset 0.3 "Amount of error induced to the bots aim"
+set bot_ai_aimskill_offset 1.8 "Amount of error induced to the bots aim"
 set bot_ai_aimskill_think 1 "Aiming velocity. Use values below 1 for slower aiming"
 set bot_ai_custom_weapon_priority_distances "300 850" "Define close and far distances in any order. Based on the distance to the enemy bots will choose different weapons"
 set bot_ai_custom_weapon_priority_far   "vaporizer oknex vortex rifle electro devastator mortar hagar hlac crylink blaster okmachinegun machinegun fireball seeker okshotgun shotgun shockwave tuba minelayer" "Desired weapons for far distances ordered by priority"