]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Add some randomness to the goal selection when a bot is stuck on a jump pad, increasi...
authorterencehill <piuntn@gmail.com>
Mon, 19 Dec 2016 17:32:02 +0000 (18:32 +0100)
committerterencehill <piuntn@gmail.com>
Mon, 19 Dec 2016 17:32:02 +0000 (18:32 +0100)
qcsrc/server/bot/default/havocbot/havocbot.qc

index b23c15bcafdeccbfb0b4874f0d8cfe77f18c5aaa..39665a6515ba11a1fd50491bbbed3e8f9445f201 100644 (file)
@@ -492,6 +492,7 @@ void havocbot_movetogoal(entity this)
        if(this.jumppadcount)
        {
                // If got stuck on the jump pad try to reach the farthest visible waypoint
+               // but with some randomness so it can try out different paths
                if(this.aistatus & AI_STATUS_OUT_JUMPPAD)
                {
                        if(fabs(this.velocity.z)<50)
@@ -504,7 +505,7 @@ void havocbot_movetogoal(entity this)
                                        if(trace_fraction < 1)
                                                continue;
 
-                                       if(!newgoal || vlen2(it.origin - this.origin) > vlen2(newgoal.origin - this.origin))
+                                       if(!newgoal || ((random() < 0.8) && vlen2(it.origin - this.origin) > vlen2(newgoal.origin - this.origin)))
                                                newgoal = it;
                                });
 
@@ -514,6 +515,8 @@ void havocbot_movetogoal(entity this)
                                        this.ignoregoaltime = time + autocvar_bot_ai_ignoregoal_timeout;
                                        navigation_clearroute(this);
                                        navigation_routetogoal(this, newgoal, this.origin);
+                                       if(autocvar_bot_debug_goalstack)
+                                               debuggoalstack(this);
                                        this.aistatus &= ~AI_STATUS_OUT_JUMPPAD;
                                }
                        }