r5578 - trunk/data/qcsrc/server

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Fri Jan 16 15:03:06 EST 2009


Author: mand1nga
Date: 2009-01-16 15:03:05 -0500 (Fri, 16 Jan 2009)
New Revision: 5578

Modified:
   trunk/data/qcsrc/server/havocbot.qc
   trunk/data/qcsrc/server/havocbot_roles.qc
Log:
n00bots never heard about weapon combos
improved enemies rating

Modified: trunk/data/qcsrc/server/havocbot.qc
===================================================================
--- trunk/data/qcsrc/server/havocbot.qc	2009-01-16 19:59:59 UTC (rev 5577)
+++ trunk/data/qcsrc/server/havocbot.qc	2009-01-16 20:03:05 UTC (rev 5578)
@@ -351,13 +351,18 @@
 	local float spreadpenalty=10;
 	local float distancefromfloor;
 
-	local float af;
+	local float af, ct, combo_time;
 
 	traceline(self.enemy.origin,self.enemy.origin-'0 0 1000',TRUE,world);
 	distancefromfloor = self.enemy.origin_z - trace_endpos_z;
 	
 	af = ATTACK_FINISHED(self);
+	ct = cvar("bot_ai_weapon_combo_threshold");
 
+	// Bots with no skill will be 4 times more slower than "godlike" bots when doing weapon combos
+	// Ideally this 4 should be calculated as longest_weapon_refire / bot_ai_weapon_combo_threshold
+	combo_time = time + ct + (ct * ((-0.3*skill)+3));
+
 	// Custom weapon list based on distance to the enemy
 	local float i; i = 0;
 	if(bot_custom_weapon){
@@ -368,8 +373,7 @@
 				w = bot_weapons_far[i];
 				if ( client_hasweapon(self, w, TRUE, FALSE) ){
 					if ( self.weapon == w){
-						if( cvar("bot_ai_weapon_combo") && 
-							af > time + cvar("bot_ai_weapon_combo_threshold"))
+						if( cvar("bot_ai_weapon_combo") && af > combo_time)
 							continue;
 					} else {
 						self.switchweapon = w;
@@ -385,8 +389,7 @@
 				w = bot_weapons_mid[i];
 				if ( client_hasweapon(self, w, TRUE, FALSE) ){
 					if ( self.weapon == w){
-						if( cvar("bot_ai_weapon_combo") && 
-							af > time + cvar("bot_ai_weapon_combo_threshold"))
+						if( cvar("bot_ai_weapon_combo") && af > combo_time)
 							continue;
 					} else {
 						self.switchweapon = w;
@@ -401,8 +404,7 @@
 			w = bot_weapons_close[i];
 			if ( client_hasweapon(self, w, TRUE, FALSE) ){
 				if ( self.weapon == w){
-					if( cvar("bot_ai_weapon_combo") && 
-						af > time + cvar("bot_ai_weapon_combo_threshold"))
+					if( cvar("bot_ai_weapon_combo") && af > combo_time)
 						continue;
 				} else {
 					self.switchweapon = w;
@@ -425,7 +427,7 @@
 
 	if (client_hasweapon(self, WEP_ROCKET_LAUNCHER, TRUE, FALSE)  && 
 		!(	cvar("bot_ai_weapon_combo") && self.weapon == WEP_ROCKET_LAUNCHER && 
-			af > time + cvar("bot_ai_weapon_combo_threshold") 
+			af > combo_time
 		)
 	)
 		rocket = (cvar("g_balance_rocketlauncher_damage")/cvar("g_balance_rocketlauncher_refire")*0.75)
@@ -433,7 +435,7 @@
 			
 	if (client_hasweapon(self, WEP_NEX, TRUE, FALSE)  && 
 		!( 	cvar("bot_ai_weapon_combo") && self.weapon == WEP_NEX && 
-			af > time + cvar("bot_ai_weapon_combo_threshold") 
+			af > combo_time
 		)
 	)
 		nex = (cvar("g_balance_nex_damage")/cvar("g_balance_nex_refire")*1.0)
@@ -447,7 +449,7 @@
 	if (client_hasweapon(self, WEP_GRENADE_LAUNCHER, TRUE, FALSE) && 
 		!( 
 			cvar("bot_ai_weapon_combo") && self.weapon == WEP_GRENADE_LAUNCHER && 
-			af > time + cvar("bot_ai_weapon_combo_threshold") 
+			af > combo_time
 		)
 	)
 		grenade = (cvar("g_balance_grenadelauncher_primary_damage")/cvar("g_balance_grenadelauncher_primary_refire")*1.0)
@@ -455,7 +457,7 @@
 			
 	if (client_hasweapon(self, WEP_ELECTRO, TRUE, FALSE) && 
 		!( 	cvar("bot_ai_weapon_combo") && self.weapon == WEP_ELECTRO && 
-			af > time + cvar("bot_ai_weapon_combo_threshold") 
+			af > combo_time
 		)
 	)
 		electro = (cvar("g_balance_electro_primary_damage")/cvar("g_balance_electro_primary_refire")*0.75)
@@ -473,7 +475,7 @@
 			
 	if (client_hasweapon(self, WEP_SHOTGUN, TRUE, FALSE) && 
 		!(	cvar("bot_ai_weapon_combo") && self.weapon == WEP_SHOTGUN && 
-			af > time + cvar("bot_ai_weapon_combo_threshold") 
+			af > combo_time
 		)
 	)
 		shotgun = (cvar("g_balance_shotgun_primary_damage")*cvar("g_balance_shotgun_primary_bullets")/cvar("g_balance_shotgun_primary_refire")*1.0)
@@ -481,7 +483,7 @@
 			
 	if (client_hasweapon(self, WEP_LASER, FALSE, FALSE) && 
 		!(	cvar("bot_ai_weapon_combo") && self.weapon == WEP_LASER && 
-			af > time + cvar("bot_ai_weapon_combo_threshold") 
+			af > combo_time
 		)
 	)
 		laser = (cvar("g_balance_laser_primary_damage")/cvar("g_balance_laser_primary_refire")*1.0)

Modified: trunk/data/qcsrc/server/havocbot_roles.qc
===================================================================
--- trunk/data/qcsrc/server/havocbot_roles.qc	2009-01-16 19:59:59 UTC (rev 5577)
+++ trunk/data/qcsrc/server/havocbot_roles.qc	2009-01-16 20:03:05 UTC (rev 5578)
@@ -238,12 +238,9 @@
 		if ((noteam && (!bot_ignore_bots || clienttype(head) == CLIENTTYPE_REAL)) || head.team != self.team)
 		if (vlen(head.origin - org) < sradius)
 		{
-			t = 100 / (head.health + head.armorvalue);
-			if (t > 0)
-			{
-				//dprint("found: "); dprint(head.netname); dprint("\n");
-				navigation_routerating(head, t * ratingscale, 500);
-			}
+			t = (self.health + self.armorvalue ) / (head.health + head.armorvalue );
+		//	clientcommand(self, strcat("say rating ", ftos(t*ratingscale)));
+			navigation_routerating(head, t * ratingscale, 2000);
 		}
 	}
 };
@@ -679,7 +676,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, 20000);
+		havocbot_goalrating_enemyplayers(10000, self.origin, 20000);
 		//havocbot_goalrating_waypoints(1, self.origin, 1000);
 		navigation_goalrating_end();
 	}




More information about the nexuiz-commits mailing list