keyboard = CS(this).movement / autocvar_sv_maxspeed;
float trigger = autocvar_bot_ai_keyboard_threshold;
- float trigger1 = -trigger;
// categorize forward movement
// at skill < 1.5 only forward
if (sk < 2.5)
keyboard.y = 0;
}
- else if (keyboard.x < trigger1 && sk > 1.5)
+ else if (keyboard.x < -trigger && sk > 1.5)
{
keyboard.x = -1;
if (sk < 4.5)
if (keyboard.y > trigger)
keyboard.y = 1;
- else if (keyboard.y < trigger1)
+ else if (keyboard.y < -trigger)
keyboard.y = -1;
else
keyboard.y = 0;
if (keyboard.z > trigger)
keyboard.z = 1;
- else if (keyboard.z < trigger1)
+ else if (keyboard.z < -trigger)
keyboard.z = -1;
else
keyboard.z = 0;
+ // make sure bots don't get stuck if havocbot_keyboardtime is very high
+ if (keyboard == '0 0 0')
+ this.havocbot_keyboardtime = min(this.havocbot_keyboardtime, time + 0.2);
+
this.havocbot_keyboard = keyboard * autocvar_sv_maxspeed;
if (this.havocbot_ducktime > time)
PHYS_INPUT_BUTTON_CROUCH(this) = true;
- }
- keyboard = this.havocbot_keyboard;
- float blend = bound(0, vlen(destorg - this.origin) / autocvar_bot_ai_keyboard_distance, 1); // When getting close move with 360 degree
- //dprint("movement ", vtos(CS(this).movement), " keyboard ", vtos(keyboard), " blend ", ftos(blend), "\n");
- CS(this).movement = CS(this).movement + (keyboard - CS(this).movement) * blend;
+ keyboard = this.havocbot_keyboard;
+ float blend = bound(0, vlen(destorg - this.origin) / autocvar_bot_ai_keyboard_distance, 1); // When getting close move with 360 degree
+ //dprint("movement ", vtos(CS(this).movement), " keyboard ", vtos(keyboard), " blend ", ftos(blend), "\n");
+ CS(this).movement = CS(this).movement + (keyboard - CS(this).movement) * blend;
+ }
}
void havocbot_bunnyhop(entity this, vector dir)
// Jetpack navigation
if(this.navigation_jetpack_goal)
if(this.goalcurrent==this.navigation_jetpack_goal)
- if(GetResourceAmount(this, RESOURCE_FUEL))
+ if(GetResource(this, RES_FUEL))
{
if(autocvar_bot_debug_goalstack)
{
return;
}
else if(!this.jumppadcount && !this.goalcurrent.wphardwired
- && GetResourceAmount(this, RESOURCE_HEALTH) + GetResourceAmount(this, RESOURCE_ARMOR) > ROCKETJUMP_DAMAGE())
+ && GetResource(this, RES_HEALTH) + GetResource(this, RES_ARMOR) > ROCKETJUMP_DAMAGE())
{
if(this.velocity.z < 0)
{
this.bot_stop_moving_timeout = time + 0.4 + random() * 0.2;
}
- offset = (vdist(this.velocity, >, 32) ? this.velocity * 0.2 : v_forward * 32);
+ offset = (vdist(this.velocity, >, 32) ? this.velocity * 0.2 : flatdir * 32);
vector dst_ahead = this.origin + this.view_ofs + offset;
vector dst_down = dst_ahead - '0 0 3000';
traceline(this.origin + this.view_ofs, dst_ahead, true, NULL);
// Look downwards
traceline(dst_ahead , dst_down, true, NULL);
//te_lightning2(NULL, this.origin + this.view_ofs, dst_ahead); // Draw "ahead" look
- //te_lightning2(NULL, dst_ahead, dst_down); // Draw "downwards" look
+ //te_lightning2(NULL, dst_ahead, trace_endpos); // Draw "downwards" look
if(trace_endpos.z < this.origin.z + this.mins.z)
{
s = pointcontents(trace_endpos + '0 0 1');
traceline(this.origin+this.view_ofs, ( this.enemy.absmin + this.enemy.absmax ) * 0.5,false,NULL);
if (trace_ent == this.enemy || trace_fraction == 1)
if (vdist(((this.enemy.absmin + this.enemy.absmax) * 0.5) - this.origin, <, 1000))
- if (GetResourceAmount(this, RESOURCE_HEALTH) > 30)
+ if (GetResource(this, RES_HEALTH) > 30)
{
// remain tracking him for a shot while (case he went after a small corner or pilar
this.havocbot_chooseenemy_finished = time + 0.5;
t += xydistance / autocvar_g_jetpack_maxspeed_side;
fuel = t * autocvar_g_jetpack_fuel * 0.8;
- LOG_DEBUG("jetpack ai: required fuel ", ftos(fuel), ", have ", ftos(GetResourceAmount(this, RESOURCE_FUEL)));
+ LOG_DEBUG("jetpack ai: required fuel ", ftos(fuel), ", have ", ftos(GetResource(this, RES_FUEL)));
// enough fuel ?
- if(GetResourceAmount(this, RESOURCE_FUEL) > fuel || (this.items & IT_UNLIMITED_WEAPON_AMMO))
+ if(GetResource(this, RES_FUEL) > fuel || (this.items & IT_UNLIMITED_WEAPON_AMMO))
{
// Estimate cost
// (as onground costs calculation is mostly based on distances, here we do the same establishing some relationship
this.goalstack31 = NULL;
navigation_routetogoal(this, navigation_bestgoal, this.origin);
- LOG_DEBUG("best goal ", this.goalcurrent.classname);
+ LOG_DEBUG("best goal ", navigation_bestgoal.classname);
if (wp && this.goalcurrent == wp)
navigation_poproute(this);
// server settings
hostname "Xonotic $g_xonoticversion Server"
set sv_mapchange_delay 5
- set minplayers 0 "fill server with bots to reach this number of players (if bot_number is not enough)"
+ set minplayers 0 "fill server with bots to reach this number of players in teamless games (if bot_number is not enough)"
+ set minplayers_per_team 0 "fill server with bots to reach this number of players per team (if bot_number is not enough)"
// restart server if all players hit "ready"-button
set sv_ready_restart 0 "allow a map to be restarted once all players pressed the \"ready\" button"
set bot_ai_navigation_jetpack_mindistance 3500 "Bots will try fly to objects located farther than this distance"
// Better don't touch these, there are hard to tweak!
set bot_ai_aimskill_order_mix_1st 0.01 "Amount of the 1st filter output to apply to the aiming angle"
-set bot_ai_aimskill_order_mix_2nd 0.1 "Amount of the 2nd filter output to apply to the aiming angle"
+set bot_ai_aimskill_order_mix_2nd 0.075 "Amount of the 2nd filter output to apply to the aiming angle"
set bot_ai_aimskill_order_mix_3th 0.01 "Amount of the 3th filter output to apply to the aiming angle"
-set bot_ai_aimskill_order_mix_4th 0.05 "Amount of the 4th filter output to apply to the aiming angle"
+set bot_ai_aimskill_order_mix_4th 0.0375 "Amount of the 4th filter output to apply to the aiming angle"
set bot_ai_aimskill_order_mix_5th 0.01 "Amount of the 5th filter output to apply to the aiming angle"
-set bot_ai_aimskill_order_filter_1st 0.4 "Position filter"
-set bot_ai_aimskill_order_filter_2nd 0.4 "Movement filter"
-set bot_ai_aimskill_order_filter_3th 0.2 "Acceleration filter"
-set bot_ai_aimskill_order_filter_4th 0.4 "Position prediction filter. Used rarely"
-set bot_ai_aimskill_order_filter_5th 0.5 "Movement prediction filter. Used rarely"
+set bot_ai_aimskill_order_filter_1st 0.2 "Position filter"
+set bot_ai_aimskill_order_filter_2nd 0.2 "Movement filter"
+set bot_ai_aimskill_order_filter_3th 0.1 "Acceleration filter"
+set bot_ai_aimskill_order_filter_4th 0.2 "Position prediction filter. Used rarely"
+set bot_ai_aimskill_order_filter_5th 0.25 "Movement prediction filter. Used rarely"
set bot_ai_timeitems 1 "allow skilled bots to run to important items a little time before respawning"
set bot_ai_timeitems_minrespawndelay 25 "bots run to items with this minimum respawn delay before respawning"