// general bot AI cvars
set bot_ai_thinkinterval 0.05
set bot_ai_strategyinterval 5 "How often a new objective is chosen"
-set bot_ai_enemydetectioninterval 3 "How often bots pick a new target"
+set bot_ai_enemydetectioninterval 2 "How often bots pick a new target"
set bot_ai_enemydetectionradius 10000 "How far bots can see enemies"
set bot_ai_dodgeupdateinterval 0.2 "How often scan for items to dodge. Currently not in use."
set bot_ai_chooseweaponinterval 0.5 "How often the best weapon according to the situation will be chosen"
set g_campaign_forceteam 0 "Forces the player to a given team in campaign mode, 1 = red, 2 = blue, 3 = yellow, 4 = pink"
seta g_campaign_name "xonoticbeta"
set g_campaign_skill 0
-set g_campaignxonotic20_index 0
-set g_campaignxonotic25_index 1
alias singleplayer_start "g_campaign_index 0; set scmenu_campaign_goto 0"
alias singleplayer_continue "set scmenu_campaign_goto -1"
if(autocvar_g_midair)
return;
- // Don't jump when using some weapons
- /*
+ // Don't jump when attacking
if(self.aistatus & AI_STATUS_ATTACKING)
- if(self.weapon == WEP_RIFLE)
return;
if(self.goalcurrent.classname == "player")
return;
- */
maxspeed = autocvar_sv_maxspeed;
// (only when the bot is on the ground or jumping intentionally)
self.aistatus &~= AI_STATUS_DANGER_AHEAD;
- if(trace_fraction == 1 && self.jumppadcount == 0)
+ if(trace_fraction == 1 && self.jumppadcount == 0 && !self.goalcurrent.wphardwired )
if(self.flags & FL_ONGROUND || self.aistatus & AI_STATUS_RUNNING || self.BUTTON_JUMP == TRUE)
{
// Look downwards
if(tracebox_hits_trigger_hurt(dst_ahead, self.mins, self.maxs, trace_endpos))
{
// Remove dangerous dynamic goals from stack
- if (self.goalcurrent.classname == "player" || self.goalcurrent.classname == "droppedweapon")
- {
- navigation_poproute();
- if(self.goalcurrent)
- gco = (self.goalcurrent.absmin + self.goalcurrent.absmax) * 0.5;
- }
- // try to stop
- flatdir = '0 0 0';
- evadeobstacle = normalize(self.velocity) * -1;
+ dprint("bot ", self.netname, " avoided the goal ", self.goalcurrent.classname, " ", etos(self.goalcurrent), " because it led to a dangerous path; goal stack cleared\n");
+ navigation_clearroute();
+ return;
}
}
}
if (self.health > 30)
{
// remain tracking him for a shot while (case he went after a small corner or pilar
- self.havocbot_chooseenemy_finished = time + autocvar_bot_ai_enemydetectioninterval;
+ self.havocbot_chooseenemy_finished = time + 0.5;
return;
}
// enemy isn't visible, or is far away, or we're injured severely
continue;
}
+ // TODO: rate waypoints near the targetted player at that moment, instead of the player itself
+ // adding a player as a goal seems to be quite dangerous, especially on space maps
+ // remove hack in navigation_poptouchedgoals() after performing this change
+
t = (self.health + self.armorvalue ) / (head.health + head.armorvalue );
navigation_routerating(head, t * ratingscale, 2000);
}
if(checkpvs(self.origin + self.view_ofs, self.goalstack01))
if(tracewalk(self, self.origin, self.mins, self.maxs, (self.goalstack01.absmin + self.goalstack01.absmax) * 0.5, bot_navigation_movemode))
{
- /// dprint("path optimized, removed a goal from the queue\n");
+ /// dprint("path optimized for ", self.netname, ", removed a goal from the queue\n");
navigation_poproute();
// TODO this may also be a nice idea to do "early" (e.g. by
// manipulating the vlen() comparisons) to shorten paths in
// personality property
}
+ // HACK: remove players/bots as goals, they can lead a bot to unexpected places (cliffs, lava, etc)
+ // TODO: rate waypoints near the targetted player at that moment, instead of the player itself
+ if(self.goalcurrent.classname=="player")
+ navigation_poproute();
+
+ // aid for detecting jump pads better (distance based check fails sometimes)
+ if(self.goalcurrent.wpflags & WAYPOINTFLAG_TELEPORT && self.jumppadcount > 0 )
+ navigation_poproute();
// Loose goal touching check when running
if(self.aistatus & AI_STATUS_RUNNING)
+ if(self.speed >= autocvar_sv_maxspeed) // if -really- running
if(self.goalcurrent.classname=="waypoint")
{
if(vlen(self.origin - self.goalcurrent.origin)<150)
++c;
waypoint_addlink(wp_from, wp_to);
+ wp_from.wphardwired = TRUE;
+ wp_to.wphardwired = TRUE;
}
fclose(file);
.float wp16mincost, wp17mincost, wp18mincost, wp19mincost, wp20mincost, wp21mincost, wp22mincost, wp23mincost;
.float wp24mincost, wp25mincost, wp26mincost, wp27mincost, wp28mincost, wp29mincost, wp30mincost, wp31mincost;
-.float wpfire, wpcost, wpconsidered, wpisbox, wpflags, wplinked;
+.float wpfire, wpcost, wpconsidered, wpisbox, wpflags, wplinked, wphardwired;
.vector wpnearestpoint;