[nexuiz-commits] r6159 - trunk/data/qcsrc/server

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Sat Mar 14 17:53:42 EDT 2009


Author: mand1nga
Date: 2009-03-14 17:53:42 -0400 (Sat, 14 Mar 2009)
New Revision: 6159

Modified:
   trunk/data/qcsrc/server/bots.qc
   trunk/data/qcsrc/server/havocbot.qc
Log:
Search for nearest waypoints more progressively. This reduces greatly the server load on some maps (mentalspace, reservoir)

Modified: trunk/data/qcsrc/server/bots.qc
===================================================================
--- trunk/data/qcsrc/server/bots.qc	2009-03-14 21:53:36 UTC (rev 6158)
+++ trunk/data/qcsrc/server/bots.qc	2009-03-14 21:53:42 UTC (rev 6159)
@@ -1183,6 +1183,7 @@
 	local entity w, wp, waylist;
 	local float searching, cost, cost2;
 	local vector p;
+	local float i, increment;
 	w = waylist = findchain(classname, "waypoint");
 	while (w)
 	{
@@ -1193,11 +1194,10 @@
 		w.enemy = world;
 		w = w.chain;
 	}
-	// try a short range search for the nearest waypoints, and expand the
-	// search repeatedly if none are found
-	if (!navigation_markroutes_nearestwaypoints(waylist, 500))
-		if (!navigation_markroutes_nearestwaypoints(waylist, 1000))
-			navigation_markroutes_nearestwaypoints(waylist, 1000000);
+	// try a short range search for the nearest waypoints, and expand thesearch repeatedly if none are found
+	increment = 500;
+	for(i=increment;navigation_markroutes_nearestwaypoints(waylist, i)&&i<50000;i+=increment);
+
 	searching = TRUE;
 	while (searching)
 	{

Modified: trunk/data/qcsrc/server/havocbot.qc
===================================================================
--- trunk/data/qcsrc/server/havocbot.qc	2009-03-14 21:53:36 UTC (rev 6158)
+++ trunk/data/qcsrc/server/havocbot.qc	2009-03-14 21:53:42 UTC (rev 6159)
@@ -905,7 +905,6 @@
 		if(self.goalcurrent==world)
 		if(self.waterlevel==2 || self.aistatus & AI_STATUS_OUT_WATER)
 		{
-			// TODO: Make the bots detect and handle ladders and/or platforms
 			// Look for the closest waypoint out of water
 			local entity newgoal, head;
 			local float bestdistance, distance;



More information about the nexuiz-commits mailing list