r6034 - in branches/nexuiz-2.0: . data/qcsrc/server
DONOTREPLY at icculus.org
DONOTREPLY at icculus.org
Mon Mar 2 04:45:01 EST 2009
Author: div0
Date: 2009-03-02 04:44:39 -0500 (Mon, 02 Mar 2009)
New Revision: 6034
Modified:
branches/nexuiz-2.0/.patchsets
branches/nexuiz-2.0/data/qcsrc/server/bots.qc
branches/nexuiz-2.0/data/qcsrc/server/havocbot.qc
branches/nexuiz-2.0/data/qcsrc/server/havocbot_roles.qc
Log:
r6032 | div0 | 2009-03-01 20:08:18 +0100 (Sun, 01 Mar 2009) | 2 lines
fix bot weapon priority lists of full length
r6033 | mand1nga | 2009-03-01 22:09:50 +0100 (Sun, 01 Mar 2009) | 5 lines
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: branches/nexuiz-2.0/.patchsets
===================================================================
--- branches/nexuiz-2.0/.patchsets 2009-03-01 21:09:50 UTC (rev 6033)
+++ branches/nexuiz-2.0/.patchsets 2009-03-02 09:44:39 UTC (rev 6034)
@@ -1,2 +1,2 @@
master = svn://svn.icculus.org/nexuiz/trunk
-revisions_applied = 1-6026
+revisions_applied = 1-6033
Modified: branches/nexuiz-2.0/data/qcsrc/server/bots.qc
===================================================================
--- branches/nexuiz-2.0/data/qcsrc/server/bots.qc 2009-03-01 21:09:50 UTC (rev 6033)
+++ branches/nexuiz-2.0/data/qcsrc/server/bots.qc 2009-03-02 09:44:39 UTC (rev 6034)
@@ -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
@@ -1568,40 +1568,43 @@
tokens = tokenizebyseparator(cvar_string("bot_ai_custom_weapon_priority_far")," ");
c = 0;
- for(i=0; i < tokens && i < WEP_LAST; ++i){
+ for(i=0; i < tokens && c < WEP_COUNT; ++i){
w = stof(argv(i));
if ( w >= WEP_FIRST && w <= WEP_LAST) {
bot_weapons_far[c] = w;
++c;
}
}
- bot_weapons_far[c] = -1;
+ if(c < WEP_COUNT)
+ bot_weapons_far[c] = -1;
// Parse mid distance weapon priorities
tokens = tokenizebyseparator(cvar_string("bot_ai_custom_weapon_priority_mid")," ");
c = 0;
- for(i=0; i < tokens && i < WEP_LAST; ++i){
+ for(i=0; i < tokens && c < WEP_COUNT; ++i){
w = stof(argv(i));
if ( w >= WEP_FIRST && w <= WEP_LAST) {
bot_weapons_mid[c] = w;
++c;
}
}
- bot_weapons_mid[c] = -1;
+ if(c < WEP_COUNT)
+ bot_weapons_mid[c] = -1;
// Parse close distance weapon priorities
tokens = tokenizebyseparator(cvar_string("bot_ai_custom_weapon_priority_close")," ");
c = 0;
- for(i=0; i < tokens && i < WEP_LAST; ++i){
+ for(i=0; i < tokens && i < WEP_COUNT; ++i){
w = stof(argv(i));
if ( w >= WEP_FIRST && w <= WEP_LAST) {
bot_weapons_close[c] = w;
++c;
}
}
- bot_weapons_close[c] = -1;
+ if(c < WEP_COUNT)
+ bot_weapons_close[c] = -1;
bot_custom_weapon = TRUE;
};
Modified: branches/nexuiz-2.0/data/qcsrc/server/havocbot.qc
===================================================================
--- branches/nexuiz-2.0/data/qcsrc/server/havocbot.qc 2009-03-01 21:09:50 UTC (rev 6033)
+++ branches/nexuiz-2.0/data/qcsrc/server/havocbot.qc 2009-03-02 09:44:39 UTC (rev 6034)
@@ -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)
{
@@ -587,7 +643,7 @@
// Choose weapons for far distance
if ( distance > bot_distance_far ) {
- for(i=0; i < WEP_LAST && bot_weapons_far[i] != -1 ; ++i){
+ for(i=0; i < WEP_COUNT && bot_weapons_far[i] != -1 ; ++i){
w = bot_weapons_far[i];
if ( client_hasweapon(self, w, TRUE, FALSE) ){
if ( self.weapon == w){
@@ -603,7 +659,7 @@
// Choose weapons for mid distance
if ( distance > bot_distance_close ) {
- for(i=0; i < WEP_LAST && bot_weapons_mid[i] != -1 ; ++i){
+ for(i= 0; i < WEP_COUNT && bot_weapons_mid[i] != -1 ; ++i){
w = bot_weapons_mid[i];
if ( client_hasweapon(self, w, TRUE, FALSE) ){
if ( self.weapon == w){
@@ -618,7 +674,7 @@
}
// Choose weapons for close distance
- for(i=0; i < WEP_LAST && bot_weapons_close[i] != -1 ; ++i){
+ for(i= 0; i < WEP_COUNT && bot_weapons_close[i] != -1 ; ++i){
w = bot_weapons_close[i];
if ( client_hasweapon(self, w, TRUE, FALSE) ){
if ( self.weapon == w){
@@ -907,4 +963,4 @@
self.goalcounter++;
}
-#endif
\ No newline at end of file
+#endif
Modified: branches/nexuiz-2.0/data/qcsrc/server/havocbot_roles.qc
===================================================================
--- branches/nexuiz-2.0/data/qcsrc/server/havocbot_roles.qc 2009-03-01 21:09:50 UTC (rev 6033)
+++ branches/nexuiz-2.0/data/qcsrc/server/havocbot_roles.qc 2009-03-02 09:44:39 UTC (rev 6034)
@@ -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