+void bot_debug(string input)
+{
+ switch(autocvar_bot_debug)
+ {
+ case 1: dprint(input); break;
+ case 2: print(input); break;
+ }
+}
// rough simulation of walking from one point to another to test if a path
// can be traveled, used for waypoint linking and havocbot
{
vector pointa, pointb;
- // dprint("jetpack ai: evaluating path for ", e.classname,"\n");
+ bot_debug(strcat("jetpack ai: evaluating path for ", e.classname, "\n"));
// Point A
traceline(self.origin, self.origin + '0 0 65535', MOVE_NORMAL, self);
if(trace_fraction==1)
{
- // dprint("jetpack ai: can bridge these two points\n");
+ bot_debug("jetpack ai: can bridge these two points\n");
// Lower the altitude of these points as much as possible
float zdistance, xydistance, cost, t, fuel;
t = zdistance / autocvar_g_jetpack_maxspeed_up;
t += xydistance / autocvar_g_jetpack_maxspeed_side;
fuel = t * autocvar_g_jetpack_fuel * 0.8;
-
- // dprint("jetpack ai: required fuel ", ftos(fuel), " self.ammo_fuel ", ftos(self.ammo_fuel),"\n");
+
+ bot_debug(strcat("jetpack ai: required fuel ", ftos(fuel), " self.ammo_fuel ", ftos(self.ammo_fuel), "\n"));
// enough fuel ?
if(self.ammo_fuel>fuel)
if (navigation_bestrating < f)
{
- // dprint("jetpack path: added goal", e.classname, " (with rating ", ftos(f), ")\n");
+ bot_debug(strcat("jetpack path: added goal ", e.classname, " (with rating ", ftos(f), ")\n"));
navigation_bestrating = f;
navigation_bestgoal = e;
self.navigation_jetpack_goal = e;
e.nearestwaypoint = nwp;
else
{
- //dprint("FAILED to find a nearest waypoint to '", e.classname, "' #", etos(e), "\n");
+ bot_debug(strcat("FAILED to find a nearest waypoint to '", e.classname, "' #", etos(e), "\n"));
if(e.flags & FL_ITEM)
e.blacklisted = TRUE;
if(e.blacklisted)
{
- //dprint("The entity '", e.classname, "' is going to be excluded from path finding during this match\n");
+ bot_debug(strcat("The entity '", e.classname, "' is going to be excluded from path finding during this match\n"));
return;
}
}
nwp = e.nearestwaypoint;
}
- //dprint("-- checking ", e.classname, " (with cost ", ftos(nwp.wpcost), ")\n");
+ bot_debug(strcat("-- checking ", e.classname, " (with cost ", ftos(nwp.wpcost), ")\n"));
if (nwp)
if (nwp.wpcost < 10000000)
{
//te_wizspike(nwp.wpnearestpoint);
- // dprint(e.classname, " ", ftos(f), "/(1+", ftos((nwp.wpcost + vlen(e.origin - nwp.wpnearestpoint))), "/", ftos(rangebias), ") = ");
+ bot_debug(strcat(e.classname, " ", ftos(f), "/(1+", ftos((nwp.wpcost + vlen(e.origin - nwp.wpnearestpoint))), "/", ftos(rangebias), ") = "));
f = f * rangebias / (rangebias + (nwp.wpcost + vlen(o - nwp.wpnearestpoint)));
- //dprint("considering ", e.classname, " (with rating ", ftos(f), ")\n");
- //dprint(ftos(f));
+ bot_debug(strcat("considering ", e.classname, " (with rating ", ftos(f), ")\n"));
if (navigation_bestrating < f)
{
- // dprint("ground path: added goal ", e.classname, " (with rating ", ftos(f), ")\n");
+ bot_debug(strcat("ground path: added goal ", e.classname, " (with rating ", ftos(f), ")\n"));
navigation_bestrating = f;
navigation_bestgoal = e;
}
}
- //dprint("\n");
}
// adds an item to the the goal stack with the path to a given item
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 for ", self.netname, ", removed a goal from the queue\n");
+ bot_debug(strcat("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
return;
navigation_routetogoal(navigation_bestgoal, self.origin);
-// dprint("best goal ", self.goalcurrent.classname , "\n");
+ bot_debug(strcat("best goal ", self.goalcurrent.classname , "\n"));
// If the bot got stuck then try to reach the farthest waypoint
if not (self.navigation_hasgoals)
{
if not(self.aistatus & AI_STATUS_STUCK)
{
- //dprint(self.netname, " cannot walk to any goal\n");
+ bot_debug(strcat(self.netname, " cannot walk to any goal\n"));
self.aistatus |= AI_STATUS_STUCK;
}
if not(bot_waypoint_queue_owner)
{
- // dprint(self.netname, " sutck, taking over the waypoints queue\n");
+ bot_debug(strcat(self.netname, " sutck, taking over the waypoints queue\n"));
bot_waypoint_queue_owner = self;
bot_waypoint_queue_bestgoal = world;
bot_waypoint_queue_bestgoalrating = 0;
{
// evaluate the next goal on the queue
float d = vlen(self.origin - bot_waypoint_queue_goal.origin);
- // dprint(self.netname, " evaluating ", bot_waypoint_queue_goal.classname, " with distance ", ftos(d), "\n");
+ bot_debug(strcat(self.netname, " evaluating ", bot_waypoint_queue_goal.classname, " with distance ", ftos(d), "\n"));
if(tracewalk(bot_waypoint_queue_goal, self.origin, PL_MIN, PL_MAX, bot_waypoint_queue_goal.origin, bot_navigation_movemode))
{
if( d > bot_waypoint_queue_bestgoalrating)
{
if (bot_waypoint_queue_bestgoal)
{
- //dprint(self.netname, " stuck, reachable waypoint found, heading to it\n");
+ bot_debug(strcat(self.netname, " stuck, reachable waypoint found, heading to it\n"));
navigation_routetogoal(bot_waypoint_queue_bestgoal, self.origin);
self.bot_strategytime = time + autocvar_bot_ai_strategyinterval;
self.aistatus &~= AI_STATUS_STUCK;
}
else
{
- //dprint(self.netname, " stuck, cannot walk to any waypoint at all\n");
+ bot_debug(strcat(self.netname, " stuck, cannot walk to any waypoint at all\n"));
}
bot_waypoint_queue_owner = world;
return;
// build a new queue
- //dprint(self.netname, " stuck, scanning reachable waypoints within ", ftos(search_radius)," qu\n");
+ bot_debug(strcat(self.netname, " stuck, scanning reachable waypoints within ", ftos(search_radius)," qu\n"));
entity head, first;
bot_waypoint_queue_goal = first;
else
{
- //dprint(self.netname, " stuck, cannot walk to any waypoint at all\n");
+ bot_debug(strcat(self.netname, " stuck, cannot walk to any waypoint at all\n"));
bot_waypoint_queue_owner = world;
}
}