r6033 - trunk/data/qcsrc/server

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Sun Mar 1 16:09:52 EST 2009


Author: mand1nga
Date: 2009-03-01 16:09:50 -0500 (Sun, 01 Mar 2009)
New Revision: 6033

Modified:
   trunk/data/qcsrc/server/bots.qc
   trunk/data/qcsrc/server/havocbot.qc
   trunk/data/qcsrc/server/havocbot_roles.qc
Log:
Bots: Escape from jump pads :D
Don't force strategy rethink while the bot is on the air unintentionally
Proper rating of enemies for dm mode
Other minor changes


Modified: trunk/data/qcsrc/server/bots.qc
===================================================================
--- trunk/data/qcsrc/server/bots.qc	2009-03-01 19:08:18 UTC (rev 6032)
+++ trunk/data/qcsrc/server/bots.qc	2009-03-01 21:09:50 UTC (rev 6033)
@@ -3,9 +3,9 @@
 float AI_STATUS_ATTACKING		= 2;	// There are enemies at sight
 float AI_STATUS_RUNNING			= 4;	// Bot is bunny hopping
 float AI_STATUS_DANGER_AHEAD	= 8;	// There is lava/slime/abism ahead
+float AI_STATUS_BAD_JUMPPAD		= 16;	// Trying to get out of a "vertical" jump pad
 
 .string netname_freeme;
-
 // rough simulation of walking from one point to another to test if a path
 // can be traveled, used by havocbot
 

Modified: trunk/data/qcsrc/server/havocbot.qc
===================================================================
--- trunk/data/qcsrc/server/havocbot.qc	2009-03-01 19:08:18 UTC (rev 6032)
+++ trunk/data/qcsrc/server/havocbot.qc	2009-03-01 21:09:50 UTC (rev 6033)
@@ -199,7 +199,7 @@
 						while (deviation_y < -180) deviation_y = deviation_y + 360;
 						while (deviation_y > 180) deviation_y = deviation_y - 360;
 
-						if(deviation_y < 20 && deviation_y > -20)
+						if(fabs(deviation_y) < 15)
 						if(distance < vlen(self.origin - self.goalstack01.origin))
 						if(fabs(self.goalstack01.origin_z - self.goalcurrent.origin_z) < self.maxs_z - self.mins_z)
 						{
@@ -285,16 +285,72 @@
 	if(self.jumppadcount)
 	{
 		if(self.flags & FL_ONGROUND)
+		{
 			self.jumppadcount = FALSE;
+			if(self.aistatus & AI_STATUS_BAD_JUMPPAD)
+				self.aistatus &~= AI_STATUS_BAD_JUMPPAD;
+		}
+
+		// If got stuck on the jump pad try to reach the farther visible item
+		if(self.aistatus & AI_STATUS_BAD_JUMPPAD)
+		{
+			if(fabs(self.velocity_z)<50)
+			{
+				local entity head, newgoal;
+				local float distance, bestdistance;
+
+				for (head = findchainfloat(bot_pickup, TRUE); head; head = head.chain)
+				{
+					if(head.classname=="worldspawn")
+						continue;
+
+					distance = vlen(head.origin - self.origin);
+					if(distance>1000)
+						continue;
+
+					traceline(self.origin + self.view_ofs , head.origin, TRUE, world);
+
+					if(trace_fraction<1)
+						continue;
+
+					if(distance>bestdistance)
+					{
+						newgoal = head;
+						bestdistance = distance;
+					}
+				}
+
+				if(newgoal)
+				{
+					self.ignoregoal = self.goalcurrent;
+					self.ignoregoaltime = time + cvar("bot_ai_ignoregoal_timeout");
+					navigation_routetogoal(newgoal);
+					self.aistatus &~= AI_STATUS_BAD_JUMPPAD;
+				}
+			}
+			else
+				return;
+		}
 		else
-			return;
+		{
+			if(self.velocity_z>0)
+			{
+				local float threshold;
+				threshold = maxspeed * 0.3;
+				if(fabs(self.velocity_x) < threshold  &&  fabs(self.velocity_y) < threshold)
+					self.aistatus |= AI_STATUS_BAD_JUMPPAD;
+				return;
+			}
+		}
 	}
 
 	if (self.goalcurrent == world)
 		return;
 
 	navigation_poptouchedgoals();
-	if (self.goalcurrent == world)
+
+	if(self.goalcurrent == world)
+	if(self.flags & FL_ONGROUND || self.aistatus & AI_STATUS_RUNNING || self.BUTTON_JUMP == TRUE)
 	{
 		if(self.alternativegoal==world)
 		{

Modified: trunk/data/qcsrc/server/havocbot_roles.qc
===================================================================
--- trunk/data/qcsrc/server/havocbot_roles.qc	2009-03-01 19:08:18 UTC (rev 6032)
+++ trunk/data/qcsrc/server/havocbot_roles.qc	2009-03-01 21:09:50 UTC (rev 6033)
@@ -104,7 +104,7 @@
 		friend_distance = 10000; enemy_distance = 10000;
 		rating = 0;
 	
-		if(!head.solid || distance > sradius || head == self.ignoregoal )
+		if(!head.solid || distance > sradius || (head == self.ignoregoal && time < self.ignoregoaltime) )
 		{
 			head = head.chain;
 			continue;		
@@ -716,7 +716,7 @@
 		self.bot_strategytime = time + cvar("bot_ai_strategyinterval");
 		navigation_goalrating_start();
 		havocbot_goalrating_items(10000, self.origin, 10000);
-		havocbot_goalrating_enemyplayers(5000, self.origin, 10000);
+		havocbot_goalrating_enemyplayers(20000, self.origin, 20000);
 		//havocbot_goalrating_waypoints(1, self.origin, 1000);
 		navigation_goalrating_end();
 	}




More information about the nexuiz-commits mailing list