[nexuiz-commits] r6415 - in trunk/data: . qcsrc/server

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Thu Apr 2 18:43:12 EDT 2009


Author: mand1nga
Date: 2009-04-02 18:43:11 -0400 (Thu, 02 Apr 2009)
New Revision: 6415

Modified:
   trunk/data/defaultNexuiz.cfg
   trunk/data/qcsrc/server/havocbot.qc
Log:
Make the bunny hopping algorithm a little more robust
Changed bot_ai_strategyinterval from 2 to 3


Modified: trunk/data/defaultNexuiz.cfg
===================================================================
--- trunk/data/defaultNexuiz.cfg	2009-04-02 18:51:01 UTC (rev 6414)
+++ trunk/data/defaultNexuiz.cfg	2009-04-02 22:43:11 UTC (rev 6415)
@@ -339,7 +339,7 @@
 seta skill_auto 0	"when 1, \"skill\" gets adjusted to match the best player on the map"
 // general bot AI cvars
 set bot_ai_thinkinterval 0.05
-set bot_ai_strategyinterval 2 "How often a new objective is chosen"
+set bot_ai_strategyinterval 3 "How often a new objective is chosen"
 set bot_ai_enemydetectioninterval 0.5 "How often bots pick a new target"
 set bot_ai_dodgeupdateinterval 0.1 "How often scan for items to dodge. Currently not in use."
 set bot_ai_chooseweaponinterval 0.3 "How often the best weapon according to the situation will be chosen"
@@ -1427,7 +1427,7 @@
 set g_jetpack_acceleration_up 600 "acceleration of the jetpack in z direction (note: you have to factor in gravity here, if antigravity is not 1)"
 set g_jetpack_maxspeed_side 1500 "max speed of the jetpack in xy direction"
 set g_jetpack_maxspeed_up 600 "max speed of the jetpack in z direction"
-set g_jetpack_fuel 8 "fuel per second for jetpack" 
+set g_jetpack_fuel 8 "fuel per second for jetpack"
 
 set g_balance_fuel_regen 0.1 "fuel regeneration (only applies if the player owns IT_FUEL_REGEN)"
 set g_balance_fuel_rot 0.05

Modified: trunk/data/qcsrc/server/havocbot.qc
===================================================================
--- trunk/data/qcsrc/server/havocbot.qc	2009-04-02 18:51:01 UTC (rev 6414)
+++ trunk/data/qcsrc/server/havocbot.qc	2009-04-02 22:43:11 UTC (rev 6415)
@@ -142,10 +142,13 @@
 {
 	local float bunnyhopdistance;
 	local vector deviation;
+	local float maxspeed;
 
 	if(self.goalcurrent.classname == "player")
 		return;
 
+	maxspeed = cvar("sv_maxspeed");
+
 	if(self.aistatus & AI_STATUS_DANGER_AHEAD)
 	{
 		self.aistatus &~= AI_STATUS_RUNNING;
@@ -168,9 +171,9 @@
 	bunnyhopdistance = vlen(self.origin - self.goalcurrent.origin);
 
 	// Run only to visible goals
-	traceline(self.origin + self.view_ofs , self.goalcurrent.origin, TRUE, world);
 	if(self.flags & FL_ONGROUND)
-	if(trace_fraction == 1)
+	if(self.speed==maxspeed)
+	if(checkpvs(self.origin + self.view_ofs, self.goalcurrent))
 	{
 			self.bot_lastseengoal = self.goalcurrent;
 
@@ -200,17 +203,16 @@
 					if(fabs(self.goalcurrent.origin_z - self.origin_z) < self.maxs_z - self.mins_z)
 					if(self.goalstack01!=world)
 					{
-						deviation = self.goalstack01.origin - (self.origin + self.view_ofs);
-						deviation = vectoangles(deviation) - self.v_angle;
+						deviation = vectoangles(self.goalstack01.origin - self.origin) - vectoangles(self.goalcurrent.origin - self.origin);
 						while (deviation_y < -180) deviation_y = deviation_y + 360;
 						while (deviation_y > 180) deviation_y = deviation_y - 360;
 
-						if(fabs(deviation_y) < 15)
+						if(fabs(deviation_y) < 20)
 						if(bunnyhopdistance < vlen(self.origin - self.goalstack01.origin))
 						if(fabs(self.goalstack01.origin_z - self.goalcurrent.origin_z) < self.maxs_z - self.mins_z)
 						{
-							traceline(self.origin + self.view_ofs , self.goalstack01.origin, TRUE, world);
-							if(trace_fraction==1)
+							if(vlen(self.goalcurrent.origin - self.goalstack01.origin) > cvar("bot_ai_bunnyhop_startdistance"))
+							if(checkpvs(self.origin + self.view_ofs, self.goalstack01))
 							{
 								checkdistance = FALSE;
 							}
@@ -243,24 +245,19 @@
 	// Release jump button
 	if(self.flags & FL_ONGROUND == 0)
 	{
-		if(self.velocity_z < 0)
+		if(self.velocity_z < 0 || vlen(self.velocity)<maxspeed)
 			self.BUTTON_JUMP = FALSE;
 
 		// Strafe
-		local float maxspeed;
-		maxspeed = cvar("sv_maxspeed");
-
 		if(self.aistatus & AI_STATUS_RUNNING)
 		if(vlen(self.velocity)>maxspeed)
 		{
-			deviation = vectoangles(dir) - self.v_angle;
+			deviation = vectoangles(dir) - vectoangles(self.velocity);
 			while (deviation_y < -180) deviation_y = deviation_y + 360;
 			while (deviation_y > 180) deviation_y = deviation_y - 360;
 
-			if ( deviation_y > 2 )
-				self.movement_y = maxspeed;
-			if ( deviation_y < -2 )
-				self.movement_y = maxspeed * -1;
+			if(fabs(deviation_y)>5)
+				self.movement_x = 0;
 		}
 	}
 };



More information about the nexuiz-commits mailing list