]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Merge branch 'master' into mand1nga/bot-fixes-II
authormand1nga <mand1nga@xonotic.org>
Sun, 28 Aug 2011 18:27:36 +0000 (15:27 -0300)
committermand1nga <mand1nga@xonotic.org>
Sun, 28 Aug 2011 18:27:36 +0000 (15:27 -0300)
defaultXonotic.cfg
qcsrc/server/bot/havocbot/havocbot.qc
qcsrc/server/bot/havocbot/roles.qc
qcsrc/server/bot/navigation.qc
qcsrc/server/bot/waypoints.qc
qcsrc/server/bot/waypoints.qh

index 62c6709e21cef7a1f5b88f29b67644d96d02e7d4..e9d5b285bd05c74d083b9128b7d7b04d95d844e1 100644 (file)
@@ -432,7 +432,7 @@ set bot_wander_enable 1 "Have bots wander around if they are unable to reach any
 // general bot AI cvars
 set bot_ai_thinkinterval 0.05
 set bot_ai_strategyinterval 5 "How often a new objective is chosen"
-set bot_ai_enemydetectioninterval 3 "How often bots pick a new target"
+set bot_ai_enemydetectioninterval 2 "How often bots pick a new target"
 set bot_ai_enemydetectionradius 10000 "How far bots can see enemies"
 set bot_ai_dodgeupdateinterval 0.2 "How often scan for items to dodge. Currently not in use."
 set bot_ai_chooseweaponinterval 0.5 "How often the best weapon according to the situation will be chosen"
@@ -1186,8 +1186,6 @@ set g_campaign 0
 set g_campaign_forceteam 0 "Forces the player to a given team in campaign mode, 1 = red, 2 = blue, 3 = yellow, 4 = pink"
 seta g_campaign_name "xonoticbeta"
 set g_campaign_skill 0
-set g_campaignxonotic20_index 0
-set g_campaignxonotic25_index 1
 
 alias singleplayer_start "g_campaign_index 0; set scmenu_campaign_goto 0"
 alias singleplayer_continue "set scmenu_campaign_goto -1"
index 113d318506b456d478aa3b7ab62701ba0347cb05..bbdb16cd2b71b89fcc607d10c95a791b222e32d9 100644 (file)
@@ -260,15 +260,12 @@ void havocbot_bunnyhop(vector dir)
        if(autocvar_g_midair)
                return;
 
-       // Don't jump when using some weapons
-       /*
+       // Don't jump when attacking
        if(self.aistatus & AI_STATUS_ATTACKING)
-       if(self.weapon == WEP_RIFLE)
                return;
 
        if(self.goalcurrent.classname == "player")
                return;
-       */
 
        maxspeed = autocvar_sv_maxspeed;
 
@@ -766,7 +763,7 @@ void havocbot_movetogoal()
                        // (only when the bot is on the ground or jumping intentionally)
                        self.aistatus &~= AI_STATUS_DANGER_AHEAD;
 
-                       if(trace_fraction == 1 && self.jumppadcount == 0)
+                       if(trace_fraction == 1 && self.jumppadcount == 0 && !self.goalcurrent.wphardwired )
                        if(self.flags & FL_ONGROUND || self.aistatus & AI_STATUS_RUNNING || self.BUTTON_JUMP == TRUE)
                        {
                                // Look downwards
@@ -789,15 +786,9 @@ void havocbot_movetogoal()
                                                if(tracebox_hits_trigger_hurt(dst_ahead, self.mins, self.maxs, trace_endpos))
                                                {
                                                        // Remove dangerous dynamic goals from stack
-                                                       if (self.goalcurrent.classname == "player" || self.goalcurrent.classname == "droppedweapon")
-                                                       {
-                                                               navigation_poproute();
-                                                               if(self.goalcurrent)
-                                                                       gco = (self.goalcurrent.absmin + self.goalcurrent.absmax) * 0.5;
-                                                       }
-                                                       // try to stop
-                                                       flatdir = '0 0 0';
-                                                       evadeobstacle = normalize(self.velocity) * -1;
+                                                       dprint("bot ", self.netname, " avoided the goal ", self.goalcurrent.classname, " ", etos(self.goalcurrent), " because it led to a dangerous path; goal stack cleared\n");
+                                                       navigation_clearroute();
+                                                       return;
                                                }
                                        }
                                }
@@ -891,7 +882,7 @@ void havocbot_chooseenemy()
                        if (self.health > 30)
                        {
                                // remain tracking him for a shot while (case he went after a small corner or pilar
-                               self.havocbot_chooseenemy_finished = time + autocvar_bot_ai_enemydetectioninterval;
+                               self.havocbot_chooseenemy_finished = time + 0.5;
                                return;
                        }
                        // enemy isn't visible, or is far away, or we're injured severely
index 4cf685ddb42f970afa43a58c88206333a99fcb76..93a683a9341cba58301801faabc56598b05187f2 100644 (file)
@@ -199,6 +199,10 @@ void havocbot_goalrating_enemyplayers(float ratingscale, vector org, float sradi
                                        continue;
                        }
 
+                       // TODO: rate waypoints near the targetted player at that moment, instead of the player itself
+                       //               adding a player as a goal seems to be quite dangerous, especially on space maps
+                       //               remove hack in navigation_poptouchedgoals() after performing this change
+
                        t = (self.health + self.armorvalue ) / (head.health + head.armorvalue );
                        navigation_routerating(head, t * ratingscale, 2000);
                }
index 968e760b8b721caff6b71cd452af93dd183fe726..ed5c4b644fe05a2c48a7516c99fbff07799f638e 100644 (file)
@@ -897,7 +897,7 @@ void navigation_poptouchedgoals()
        if(checkpvs(self.origin + self.view_ofs, self.goalstack01))
        if(tracewalk(self, self.origin, self.mins, self.maxs, (self.goalstack01.absmin + self.goalstack01.absmax) * 0.5, bot_navigation_movemode))
        {
-       ///     dprint("path optimized, removed a goal from the queue\n");
+       ///     dprint("path optimized for ", self.netname, ", removed a goal from the queue\n");
                navigation_poproute();
                // TODO this may also be a nice idea to do "early" (e.g. by
                // manipulating the vlen() comparisons) to shorten paths in
@@ -907,9 +907,18 @@ void navigation_poptouchedgoals()
                // personality property
        }
 
+       // HACK: remove players/bots as goals, they can lead a bot to unexpected places (cliffs, lava, etc)
+       // TODO: rate waypoints near the targetted player at that moment, instead of the player itself
+       if(self.goalcurrent.classname=="player")
+               navigation_poproute();
+
+       // aid for detecting jump pads better (distance based check fails sometimes)
+       if(self.goalcurrent.wpflags & WAYPOINTFLAG_TELEPORT && self.jumppadcount > 0 )
+               navigation_poproute();
 
        // Loose goal touching check when running
        if(self.aistatus & AI_STATUS_RUNNING)
+       if(self.speed >= autocvar_sv_maxspeed) // if -really- running
        if(self.goalcurrent.classname=="waypoint")
        {
                if(vlen(self.origin - self.goalcurrent.origin)<150)
index 8aea49be512d0b6f7dfd42e8b5d40f73585ef73f..076e969685e2c30fde561aeaddec6eab7e090420 100644 (file)
@@ -539,6 +539,8 @@ void waypoint_load_links_hardwired()
 
                ++c;
                waypoint_addlink(wp_from, wp_to);
+               wp_from.wphardwired = TRUE;
+               wp_to.wphardwired = TRUE;
        }
 
        fclose(file);
index 9c84de84bb5132085cb8e32bf3c3e12f13f4789a..1bb800fd054ac5382b1a92491c2c6bf86ee0bc4e 100644 (file)
@@ -24,7 +24,7 @@ float botframe_cachedwaypointlinks;
 .float wp16mincost, wp17mincost, wp18mincost, wp19mincost, wp20mincost, wp21mincost, wp22mincost, wp23mincost;
 .float wp24mincost, wp25mincost, wp26mincost, wp27mincost, wp28mincost, wp29mincost, wp30mincost, wp31mincost;
 
-.float wpfire, wpcost, wpconsidered, wpisbox, wpflags, wplinked;
+.float wpfire, wpcost, wpconsidered, wpisbox, wpflags, wplinked, wphardwired;
 
 .vector wpnearestpoint;