From 54d41409ec3d51689d139a8065c1c2ed036efc6e Mon Sep 17 00:00:00 2001 From: div0 Date: Fri, 25 Sep 2009 17:26:09 +0000 Subject: [PATCH] new waypoint debugging: impulse 108 marks all WPs that cannot go TO here if neither 107 nor 108 highlight any waypoint, then the waypoint network is perfectly connected git-svn-id: svn://svn.icculus.org/nexuiz/trunk@7898 f962a42d-fe04-0410-a3ab-8c8b0445ebaa --- data/balance.cfg | 2 +- data/balance25.cfg | 2 +- data/balanceHavoc.cfg | 2 +- data/defaultNexuiz.cfg | 3 +- data/qcsrc/server/bot/navigation.qc | 102 ++++++++++++++++++++++++---- data/qcsrc/server/bot/navigation.qh | 3 +- data/qcsrc/server/cl_impulse.qc | 20 +++++- 7 files changed, 115 insertions(+), 19 deletions(-) diff --git a/data/balance.cfg b/data/balance.cfg index 44e784a26..9824f60bf 100644 --- a/data/balance.cfg +++ b/data/balance.cfg @@ -3,7 +3,7 @@ // // And... don't forget to edit the other balance*.cfg too. -set cvar_check_balance df069a840b96084fe7ea4de2efb12ae5 +set cvar_check_balance 59ee376a58dfcc2e2ee440c6a9508e11 // {{{ weapon replacement // NOTE: this only replaces weapons on the map diff --git a/data/balance25.cfg b/data/balance25.cfg index 86e4b6ba8..d1f975ba4 100644 --- a/data/balance25.cfg +++ b/data/balance25.cfg @@ -3,7 +3,7 @@ // // And... don't forget to edit the other balance*.cfg too. -set cvar_check_balance df069a840b96084fe7ea4de2efb12ae5 +set cvar_check_balance 59ee376a58dfcc2e2ee440c6a9508e11 // {{{ weapon replacement // NOTE: this only replaces weapons on the map diff --git a/data/balanceHavoc.cfg b/data/balanceHavoc.cfg index fe8c1f3ae..b5067e05f 100644 --- a/data/balanceHavoc.cfg +++ b/data/balanceHavoc.cfg @@ -3,7 +3,7 @@ // // And... don't forget to edit the other balance*.cfg too. -set cvar_check_balance df069a840b96084fe7ea4de2efb12ae5 +set cvar_check_balance 59ee376a58dfcc2e2ee440c6a9508e11 // {{{ weapon replacement // NOTE: this only replaces weapons on the map diff --git a/data/defaultNexuiz.cfg b/data/defaultNexuiz.cfg index ea1d25ee9..35180c297 100644 --- a/data/defaultNexuiz.cfg +++ b/data/defaultNexuiz.cfg @@ -420,7 +420,8 @@ alias g_waypointeditor_spawn "impulse 103" alias g_waypointeditor_remove "impulse 104" alias g_waypointeditor_relinkall "impulse 105" alias g_waypointeditor_saveall "impulse 106" -alias g_waypointeditor_checkunreachable "impulse 107" +alias g_waypointeditor_checkunreachable_fromhere "impulse 107" +alias g_waypointeditor_checkunreachable_tohere "impulse 108" locs_enable 0 pausable 0 diff --git a/data/qcsrc/server/bot/navigation.qc b/data/qcsrc/server/bot/navigation.qc index 18a7503ad..39fb5471b 100644 --- a/data/qcsrc/server/bot/navigation.qc +++ b/data/qcsrc/server/bot/navigation.qc @@ -249,6 +249,10 @@ void navigation_clearroute() // add a new goal at the beginning of the stack // (in other words: add a new prerequisite before going to the later goals) +// NOTE: when a waypoint is added, the WP gets pushed first, then the +// next-closest WP on the shortest path to the WP +// That means, if the stack overflows, the bot will know how to do the FIRST 32 +// steps to the goal, and then recalculate the path. void navigation_pushroute(entity e) { //print("bot ", etos(self), " push ", etos(e), "\n"); @@ -479,7 +483,7 @@ void navigation_markroutes_checkwaypoint(entity w, entity wp, float cost2, vecto }; // queries the entire spawnfunc_waypoint network for pathes leading away from the bot -void navigation_markroutes() +void navigation_markroutes(entity fixed_source_waypoint) { local entity w, wp, waylist; local float searching, cost, cost2; @@ -495,21 +499,32 @@ void navigation_markroutes() w = w.chain; } - // try a short range search for the nearest waypoints, and expand the search repeatedly if none are found - // as this search is expensive we will use lower values if the bot is on the air - local float i, increment, maxdistance; - if(self.flags & FL_ONGROUND) + if(fixed_source_waypoint) { - increment = 750; - maxdistance = 50000; + fixed_source_waypoint.wpconsidered = TRUE; + fixed_source_waypoint.wpnearestpoint = fixed_source_waypoint.origin + 0.5 * (fixed_source_waypoint.mins + fixed_source_waypoint.maxs); + fixed_source_waypoint.wpcost = fixed_source_waypoint.dmg; + fixed_source_waypoint.wpfire = 1; + fixed_source_waypoint.enemy = world; } else { - increment = 500; - maxdistance = 1500; - } + // try a short range search for the nearest waypoints, and expand the search repeatedly if none are found + // as this search is expensive we will use lower values if the bot is on the air + local float i, increment, maxdistance; + if(self.flags & FL_ONGROUND) + { + increment = 750; + maxdistance = 50000; + } + else + { + increment = 500; + maxdistance = 1500; + } - for(i=increment;!navigation_markroutes_nearestwaypoints(waylist, i)&&i= 103 && imp <= 107) + else if(imp >= 103 && imp <= 108) { if(cvar("g_waypointeditor")) { @@ -538,7 +538,23 @@ void ImpulseCommands (void) waypoint_saveall(); break; case 107: - navigation_markroutes(); + navigation_markroutes(navigation_findnearestwaypoint(self, FALSE)); + for(e = findchain(classname, "waypoint"); e; e = e.chain) + { + if(e.wpcost < 10000000) + { + e.colormod_x = 1; + e.effects &~= EF_NODEPTHTEST; + } + else + { + e.colormod_x = 0.1; + e.effects |= EF_NODEPTHTEST; + } + } + break; + case 108: + navigation_markroutes_inverted(navigation_findnearestwaypoint(self, FALSE)); for(e = findchain(classname, "waypoint"); e; e = e.chain) { if(e.wpcost < 10000000) -- 2.39.2