]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Added cvar bot_debug_goalstack to visualize the path that each bot is trying to follow
authormand1nga <mand1nga@xonotic.org>
Tue, 19 Apr 2011 01:16:51 +0000 (22:16 -0300)
committermand1nga <mand1nga@xonotic.org>
Tue, 19 Apr 2011 01:16:51 +0000 (22:16 -0300)
defaultXonotic.cfg
qcsrc/server/autocvars.qh
qcsrc/server/bot/havocbot/havocbot.qc
qcsrc/server/bot/navigation.qc
qcsrc/server/bot/navigation.qh

index ec96c6ff039dc2a2c4f117f9f80e4953bd320943..e4e43babedd96a478cbd97c8b09276378bd63492 100644 (file)
@@ -417,6 +417,7 @@ seta bot_prefix [BOT]       "Prefix in front of the bot names"
 seta bot_suffix ""     "Suffix behind the bot names"
 seta skill_auto 0      "when 1, \"skill\" gets adjusted to match the best player on the map"
 set bot_debug_tracewalk 0 "Enable visual indicators for short-term navigation. Green: Goal Reached / Yellow: Obstacle found / Red: Unsolvable obstacle found"
+set bot_debug_goalstack 0 "Visualize the current path that each bot is following. Use with as few bots as possible."
 // general bot AI cvars
 set bot_ai_thinkinterval 0.05
 set bot_ai_strategyinterval 5 "How often a new objective is chosen"
index 54167d076de7acb0c684bb868182c1b7d640d155..b7e053403f19f6ce4d1d226a42a08e8056f58a5a 100644 (file)
@@ -55,6 +55,7 @@ float autocvar_bot_sound_monopoly;
 float autocvar_bot_usemodelnames;
 float autocvar_bot_vs_human;
 float autocvar_bot_debug_tracewalk;
+float autocvar_bot_debug_goalstack;
 float autocvar_captureleadlimit_override;
 #define autocvar_capturelimit_override cvar("capturelimit_override")
 float autocvar_deathmatch_force_teamplay;
index e67bc214e6edefe7aa36f1b4163bdd33d11b01d0..708ae9452e82ce1ceb40ec28643dc8c1f8556619 100644 (file)
@@ -416,10 +416,11 @@ void havocbot_movetogoal()
        if(self.goalcurrent==self.navigation_jetpack_goal)
        if(self.ammo_fuel)
        {
-               #ifdef DEBUG_BOT_GOALSTACK
+               if(autocvar_bot_debug_goalstack)
+               {
                        debuggoalstack();
                        te_wizspike(self.navigation_jetpack_point);
-               #endif
+               }
 
                // Take off
                if not(self.aistatus & AI_STATUS_JETPACK_FLYING)
@@ -653,9 +654,8 @@ void havocbot_movetogoal()
                return;
        }
 
-#ifdef DEBUG_BOT_GOALSTACK
-       debuggoalstack();
-#endif
+       if(autocvar_bot_debug_goalstack)
+               debuggoalstack();
 
        m1 = self.goalcurrent.origin + self.goalcurrent.mins;
        m2 = self.goalcurrent.origin + self.goalcurrent.maxs;
@@ -1139,9 +1139,8 @@ float havocbot_moveto(vector pos)
                        }
                }
 
-               #ifdef DEBUG_BOT_GOALSTACK
+               if(autocvar_bot_debug_goalstack)
                        debuggoalstack();
-               #endif
 
                // Heading
                local vector dir = self.goalcurrent.origin - (self.origin + self.view_ofs);
index 1f9d3897214f89bdb6e224477c739acb228e5d3d..95f5d5f0070be99471c02af1cdf4eb7d9de6bff1 100644 (file)
@@ -966,6 +966,8 @@ void botframe_updatedangerousobjects(float maxupdate)
        }
 };
 
+// Support for debugging tracewalk visually
+
 void debugresetnodes()
 {
        debuglastnode = '0 0 0';
@@ -1008,7 +1010,7 @@ void debugnodestatus(vector position, float status)
        te_customflash(position, 40,  2, c);
 }
 
-#ifdef DEBUG_BOT_GOALSTACK
+// Support for debugging the goal stack visually
 
 .float goalcounter;
 .vector lastposition;
@@ -1016,43 +1018,43 @@ void debugnodestatus(vector position, float status)
 // Debug the goal stack visually
 void debuggoalstack()
 {
-       local entity target;
+       local entity goal;
        local vector org;
 
-       if(self.goalcounter==0)target=self.goalcurrent;
-       else if(self.goalcounter==1)target=self.goalstack01;
-       else if(self.goalcounter==2)target=self.goalstack02;
-       else if(self.goalcounter==3)target=self.goalstack03;
-       else if(self.goalcounter==4)target=self.goalstack04;
-       else if(self.goalcounter==5)target=self.goalstack05;
-       else if(self.goalcounter==6)target=self.goalstack06;
-       else if(self.goalcounter==7)target=self.goalstack07;
-       else if(self.goalcounter==8)target=self.goalstack08;
-       else if(self.goalcounter==9)target=self.goalstack09;
-       else if(self.goalcounter==10)target=self.goalstack10;
-       else if(self.goalcounter==11)target=self.goalstack11;
-       else if(self.goalcounter==12)target=self.goalstack12;
-       else if(self.goalcounter==13)target=self.goalstack13;
-       else if(self.goalcounter==14)target=self.goalstack14;
-       else if(self.goalcounter==15)target=self.goalstack15;
-       else if(self.goalcounter==16)target=self.goalstack16;
-       else if(self.goalcounter==17)target=self.goalstack17;
-       else if(self.goalcounter==18)target=self.goalstack18;
-       else if(self.goalcounter==19)target=self.goalstack19;
-       else if(self.goalcounter==20)target=self.goalstack20;
-       else if(self.goalcounter==21)target=self.goalstack21;
-       else if(self.goalcounter==22)target=self.goalstack22;
-       else if(self.goalcounter==23)target=self.goalstack23;
-       else if(self.goalcounter==24)target=self.goalstack24;
-       else if(self.goalcounter==25)target=self.goalstack25;
-       else if(self.goalcounter==26)target=self.goalstack26;
-       else if(self.goalcounter==27)target=self.goalstack27;
-       else if(self.goalcounter==28)target=self.goalstack28;
-       else if(self.goalcounter==29)target=self.goalstack29;
-       else if(self.goalcounter==30)target=self.goalstack30;
-       else if(self.goalcounter==31)target=self.goalstack31;
-
-       if(target==world)
+       if(self.goalcounter==0)goal=self.goalcurrent;
+       else if(self.goalcounter==1)goal=self.goalstack01;
+       else if(self.goalcounter==2)goal=self.goalstack02;
+       else if(self.goalcounter==3)goal=self.goalstack03;
+       else if(self.goalcounter==4)goal=self.goalstack04;
+       else if(self.goalcounter==5)goal=self.goalstack05;
+       else if(self.goalcounter==6)goal=self.goalstack06;
+       else if(self.goalcounter==7)goal=self.goalstack07;
+       else if(self.goalcounter==8)goal=self.goalstack08;
+       else if(self.goalcounter==9)goal=self.goalstack09;
+       else if(self.goalcounter==10)goal=self.goalstack10;
+       else if(self.goalcounter==11)goal=self.goalstack11;
+       else if(self.goalcounter==12)goal=self.goalstack12;
+       else if(self.goalcounter==13)goal=self.goalstack13;
+       else if(self.goalcounter==14)goal=self.goalstack14;
+       else if(self.goalcounter==15)goal=self.goalstack15;
+       else if(self.goalcounter==16)goal=self.goalstack16;
+       else if(self.goalcounter==17)goal=self.goalstack17;
+       else if(self.goalcounter==18)goal=self.goalstack18;
+       else if(self.goalcounter==19)goal=self.goalstack19;
+       else if(self.goalcounter==20)goal=self.goalstack20;
+       else if(self.goalcounter==21)goal=self.goalstack21;
+       else if(self.goalcounter==22)goal=self.goalstack22;
+       else if(self.goalcounter==23)goal=self.goalstack23;
+       else if(self.goalcounter==24)goal=self.goalstack24;
+       else if(self.goalcounter==25)goal=self.goalstack25;
+       else if(self.goalcounter==26)goal=self.goalstack26;
+       else if(self.goalcounter==27)goal=self.goalstack27;
+       else if(self.goalcounter==28)goal=self.goalstack28;
+       else if(self.goalcounter==29)goal=self.goalstack29;
+       else if(self.goalcounter==30)goal=self.goalstack30;
+       else if(self.goalcounter==31)goal=self.goalstack31;
+
+       if(goal==world)
        {
                self.goalcounter = 0;
                self.lastposition='0 0 0';
@@ -1065,10 +1067,8 @@ void debuggoalstack()
                org = self.lastposition;
 
 
-       te_lightning2(world, org, target.origin);
-       self.lastposition = target.origin;
+       te_lightning2(world, org, goal.origin);
+       self.lastposition = goal.origin;
 
        self.goalcounter++;
 }
-
-#endif
index 2f41210c17142491c5f98c9045312a234c018b27..06bbb85c310101f51b4cf2f799691e9a9fae9837 100644 (file)
@@ -43,9 +43,7 @@ void debugresetnodes();
 void debugnode(vector node);
 void debugnodestatus(vector position, float status);
 
-#ifdef DEBUG_BOT_GOALSTACK
 void debuggoalstack();
-#endif
 
 float tracewalk(entity e, vector start, vector m1, vector m2, vector end, float movemode);