From: terencehill Date: Mon, 19 Dec 2016 17:43:42 +0000 (+0100) Subject: Bot logic: tweak bunnyhop stop distance, improve trigger_hurt detection and bot react... X-Git-Tag: xonotic-v0.8.2~343^2~17 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=a37e993a511788cd56cd5fab0731548e8d3ae6d6;p=xonotic%2Fxonotic-data.pk3dir.git Bot logic: tweak bunnyhop stop distance, improve trigger_hurt detection and bot reaction if one is found in front of it. Now there's little chance of falling off the map getting the Mortar on Dance, furthermore bots can now bunnyhop on paths with harmless holes (see lower level of Implosion) --- diff --git a/defaultXonotic.cfg b/defaultXonotic.cfg index bf35a4189..bbdbdcb74 100644 --- a/defaultXonotic.cfg +++ b/defaultXonotic.cfg @@ -382,7 +382,7 @@ set bot_ai_friends_aware_pickup_radius "500" "Bots will not pickup items if a te set bot_ai_ignoregoal_timeout 3 "Ignore goals making bots to get stuck in front of a wall for N seconds" set bot_ai_bunnyhop_skilloffset 7 "Bots with skill equal or greater than this value will perform the \"bunnyhop\" technique" set bot_ai_bunnyhop_startdistance 200 "Run to goals located further than this distance" -set bot_ai_bunnyhop_stopdistance 200 "Stop jumping after reaching this distance to the goal" +set bot_ai_bunnyhop_stopdistance 300 "Stop jumping after reaching this distance to the goal" set bot_ai_bunnyhop_firstjumpdelay 0.2 "Start running to the goal only if it was seen for more than N seconds" set bot_god 0 "god mode for bots" set bot_ai_navigation_jetpack 0 "Enable bots to navigate maps using the jetpack" diff --git a/qcsrc/server/bot/default/havocbot/havocbot.qc b/qcsrc/server/bot/default/havocbot/havocbot.qc index 39665a651..b3c0f58d9 100644 --- a/qcsrc/server/bot/default/havocbot/havocbot.qc +++ b/qcsrc/server/bot/default/havocbot/havocbot.qc @@ -350,7 +350,8 @@ void havocbot_bunnyhop(entity this, vector dir) if(checkdistance) { this.aistatus &= ~AI_STATUS_RUNNING; - if(bunnyhopdistance > autocvar_bot_ai_bunnyhop_stopdistance) + // increase stop distance in case the goal is on a slope or a lower platform + if(bunnyhopdistance > autocvar_bot_ai_bunnyhop_stopdistance + (this.origin.z - gco.z)) PHYS_INPUT_BUTTON_JUMP(this) = true; } else @@ -721,10 +722,8 @@ void havocbot_movetogoal(entity this) } // avoiding dangers and obstacles - vector dst_ahead, dst_down; - makevectors(this.v_angle.y * '0 1 0'); - dst_ahead = this.origin + this.view_ofs + (this.velocity * 0.4) + (v_forward * 32 * 3); - dst_down = dst_ahead - '0 0 1500'; + vector dst_ahead = this.origin + this.view_ofs + this.velocity * 0.5; + vector dst_down = dst_ahead - '0 0 3000'; // Look ahead traceline(this.origin + this.view_ofs, dst_ahead, true, NULL); @@ -761,12 +760,12 @@ void havocbot_movetogoal(entity this) this.aistatus &= ~AI_STATUS_DANGER_AHEAD; if(trace_fraction == 1 && this.jumppadcount == 0 && !this.goalcurrent.wphardwired ) - if((IS_ONGROUND(this)) || (this.aistatus & AI_STATUS_RUNNING) || PHYS_INPUT_BUTTON_JUMP(this)) + if((IS_ONGROUND(this)) || (this.aistatus & AI_STATUS_RUNNING) || (this.aistatus & AI_STATUS_ROAMING) || PHYS_INPUT_BUTTON_JUMP(this)) { // Look downwards traceline(dst_ahead , dst_down, true, NULL); - // te_lightning2(NULL, this.origin, dst_ahead); // Draw "ahead" look - // te_lightning2(NULL, dst_ahead, dst_down); // Draw "downwards" look + //te_lightning2(NULL, this.origin + this.view_ofs, dst_ahead); // Draw "ahead" look + //te_lightning2(NULL, dst_ahead, dst_down); // Draw "downwards" look if(trace_endpos.z < this.origin.z + this.mins.z) { s = pointcontents(trace_endpos + '0 0 1'); @@ -775,18 +774,11 @@ void havocbot_movetogoal(entity this) evadelava = normalize(this.velocity) * -1; else if (s == CONTENT_SKY) evadeobstacle = normalize(this.velocity) * -1; - else if (!boxesoverlap(dst_ahead - this.view_ofs + this.mins, dst_ahead - this.view_ofs + this.maxs, - this.goalcurrent.absmin, this.goalcurrent.absmax)) + else { - // if ain't a safe goal with "holes" (like the jumpad on soylent) - // and there is a trigger_hurt below - if(tracebox_hits_trigger_hurt(dst_ahead, this.mins, this.maxs, trace_endpos)) - { - // Remove dangerous dynamic goals from stack - LOG_TRACE("bot ", this.netname, " avoided the goal ", this.goalcurrent.classname, " ", etos(this.goalcurrent), " because it led to a dangerous path; goal stack cleared"); - navigation_clearroute(this); - return; - } + tracebox(dst_ahead, this.mins, this.maxs, dst_down, true, this); + if (tracebox_hits_trigger_hurt(dst_ahead, this.mins, this.maxs, trace_endpos)) + evadelava = normalize(this.velocity) * -1; } } }