]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
bots: take the ability to jump into account when linking waypoints (EXPERIMENTAL)
authorRudolf Polzer <divverent@xonotic.org>
Sun, 14 Aug 2011 15:10:49 +0000 (17:10 +0200)
committerRudolf Polzer <divverent@xonotic.org>
Sun, 14 Aug 2011 15:10:49 +0000 (17:10 +0200)
qcsrc/server/bot/bot.qc
qcsrc/server/bot/bot.qh
qcsrc/server/bot/havocbot/havocbot.qc
qcsrc/server/bot/navigation.qc
qcsrc/server/bot/navigation.qh

index 6bcafcb99ef0135c3daf679c76b69db085730687..9972999fc40a1274bc02210a7e750347ff807833 100644 (file)
@@ -532,6 +532,9 @@ void autoskill(float factor)
 void bot_calculate_stepheightvec(void)
 {
        stepheightvec = autocvar_sv_stepheight * '0 0 1';
+       jumpstepheightvec = stepheightvec +
+               ((autocvar_sv_jumpvelocity * autocvar_sv_jumpvelocity) / (2 * autocvar_sv_gravity)) * '0 0 0.9';
+               // 0.9 factor is for safety to make the jumps always work
 }
 
 void bot_serverframe()
index 55f3250ee167294272ed9464c3d6657b23bcdda1..6823841d9bc91aa7d998369782b884d4721f2212 100644 (file)
@@ -114,3 +114,5 @@ void() havocbot_setupbot;
 float c1, c2, c3, c4;
 void CheckAllowedTeams(entity for_whom); void GetTeamCounts(entity other);
 float JoinBestTeam(entity pl, float only_return_best, float forcebestteam);
+
+void bot_calculate_stepheightvec(void);
index 377dc2ef97237b60ccdc91ff06c4414f5da03f88..1d9054952d24bbdde4d63981bc5a86689f3a44f4 100644 (file)
@@ -714,12 +714,12 @@ void havocbot_movetogoal()
                        if (trace_plane_normal_z < 0.7)
                        {
                                s = trace_fraction;
-                               tracebox(self.origin + '0 0 16', self.mins, self.maxs, self.origin + self.velocity * 0.2 + '0 0 16', FALSE, self);
+                               tracebox(self.origin + stepheightvec, self.mins, self.maxs, self.origin + self.velocity * 0.2 + stepheightvec, FALSE, self);
                                if (trace_fraction < s + 0.01)
                                if (trace_plane_normal_z < 0.7)
                                {
                                        s = trace_fraction;
-                                       tracebox(self.origin + '0 0 48', self.mins, self.maxs, self.origin + self.velocity * 0.2 + '0 0 48', FALSE, self);
+                                       tracebox(self.origin + jumpstepheightvec, self.mins, self.maxs, self.origin + self.velocity * 0.2 + jumpstepheightvec, FALSE, self);
                                        if (trace_fraction > s)
                                                self.BUTTON_JUMP = 1;
                                }
index ebaf210b3c493855e071ee409de9efdf34d7c233..749b78fed6546eb7c9460dd88a00cfa2d43b07e3 100644 (file)
@@ -133,8 +133,8 @@ float tracewalk(entity e, vector start, vector m1, vector m2, vector end, float
                        // hit something
                        if (trace_fraction < 1)
                        {
-                               // check if we can walk over this obstacle
-                               tracebox(org + stepheightvec, m1, m2, move + stepheightvec, movemode, e);
+                               // check if we can walk over this obstacle, possibly by jumpstepping
+                               tracebox(org + jumpstepheightvec, m1, m2, move + jumpstepheightvec, movemode, e);
                                if (trace_fraction < 1 || trace_startsolid)
                                {
                                        if(autocvar_bot_debug_tracewalk)
index 0a9bf14010d17176eab4a7740b9b997f2facd622..8971692de03193c546f0a33ac09eb65709038884 100644 (file)
@@ -6,6 +6,7 @@ float navigation_bestrating;
 float bot_navigation_movemode;
 float navigation_testtracewalk;
 
+vector jumpstepheightvec;
 vector stepheightvec;
 
 entity botframe_dangerwaypoint;