[nexuiz-commits] r7898 - in trunk/data: . qcsrc/server qcsrc/server/bot
DONOTREPLY at icculus.org
DONOTREPLY at icculus.org
Fri Sep 25 13:26:09 EDT 2009
Author: div0
Date: 2009-09-25 13:26:09 -0400 (Fri, 25 Sep 2009)
New Revision: 7898
Modified:
trunk/data/balance.cfg
trunk/data/balance25.cfg
trunk/data/balanceHavoc.cfg
trunk/data/defaultNexuiz.cfg
trunk/data/qcsrc/server/bot/navigation.qc
trunk/data/qcsrc/server/bot/navigation.qh
trunk/data/qcsrc/server/cl_impulse.qc
Log:
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
Modified: trunk/data/balance.cfg
===================================================================
--- trunk/data/balance.cfg 2009-09-25 16:31:20 UTC (rev 7897)
+++ trunk/data/balance.cfg 2009-09-25 17:26:09 UTC (rev 7898)
@@ -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
Modified: trunk/data/balance25.cfg
===================================================================
--- trunk/data/balance25.cfg 2009-09-25 16:31:20 UTC (rev 7897)
+++ trunk/data/balance25.cfg 2009-09-25 17:26:09 UTC (rev 7898)
@@ -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
Modified: trunk/data/balanceHavoc.cfg
===================================================================
--- trunk/data/balanceHavoc.cfg 2009-09-25 16:31:20 UTC (rev 7897)
+++ trunk/data/balanceHavoc.cfg 2009-09-25 17:26:09 UTC (rev 7898)
@@ -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
Modified: trunk/data/defaultNexuiz.cfg
===================================================================
--- trunk/data/defaultNexuiz.cfg 2009-09-25 16:31:20 UTC (rev 7897)
+++ trunk/data/defaultNexuiz.cfg 2009-09-25 17:26:09 UTC (rev 7898)
@@ -420,7 +420,8 @@
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
Modified: trunk/data/qcsrc/server/bot/navigation.qc
===================================================================
--- trunk/data/qcsrc/server/bot/navigation.qc 2009-09-25 16:31:20 UTC (rev 7897)
+++ trunk/data/qcsrc/server/bot/navigation.qc 2009-09-25 17:26:09 UTC (rev 7898)
@@ -249,6 +249,10 @@
// 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 @@
};
// 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,22 +499,33 @@
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<maxdistance;i+=increment);
}
- for(i=increment;!navigation_markroutes_nearestwaypoints(waylist, i)&&i<maxdistance;i+=increment);
-
searching = TRUE;
while (searching)
{
@@ -563,6 +578,69 @@
}
};
+// queries the entire spawnfunc_waypoint network for pathes leading to the bot
+void navigation_markroutes_inverted(entity fixed_source_waypoint)
+{
+ local entity w, wp, waylist;
+ local float searching, cost, cost2;
+ local vector p;
+ w = waylist = findchain(classname, "waypoint");
+ while (w)
+ {
+ w.wpconsidered = FALSE;
+ w.wpnearestpoint = '0 0 0';
+ w.wpcost = 10000000;
+ w.wpfire = 0;
+ w.enemy = world;
+ w = w.chain;
+ }
+
+ if(fixed_source_waypoint)
+ {
+ 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; // the cost to get from X to fixed_source_waypoint
+ fixed_source_waypoint.wpfire = 1;
+ fixed_source_waypoint.enemy = world;
+ }
+ else
+ {
+ error("need to start with a waypoint\n");
+ }
+
+ searching = TRUE;
+ while (searching)
+ {
+ searching = FALSE;
+ w = waylist;
+ while (w)
+ {
+ if (w.wpfire)
+ {
+ searching = TRUE;
+ w.wpfire = 0;
+ cost = w.wpcost; // cost to walk from w to home
+ p = w.wpnearestpoint;
+ for(wp = waylist; wp; wp = wp.chain)
+ {
+ if(w != wp.wp00) if(w != wp.wp01) if(w != wp.wp02) if(w != wp.wp03)
+ if(w != wp.wp04) if(w != wp.wp05) if(w != wp.wp06) if(w != wp.wp07)
+ if(w != wp.wp08) if(w != wp.wp09) if(w != wp.wp10) if(w != wp.wp11)
+ if(w != wp.wp12) if(w != wp.wp13) if(w != wp.wp14) if(w != wp.wp15)
+ if(w != wp.wp16) if(w != wp.wp17) if(w != wp.wp18) if(w != wp.wp19)
+ if(w != wp.wp20) if(w != wp.wp21) if(w != wp.wp22) if(w != wp.wp23)
+ if(w != wp.wp24) if(w != wp.wp25) if(w != wp.wp26) if(w != wp.wp27)
+ if(w != wp.wp28) if(w != wp.wp29) if(w != wp.wp30) if(w != wp.wp31)
+ continue;
+ cost2 = cost + wp.dmg;
+ navigation_markroutes_checkwaypoint(w, wp, cost2, p);
+ }
+ }
+ w = w.chain;
+ }
+ }
+};
+
void navigation_bestgoals_reset()
{
local float i;
@@ -895,7 +973,7 @@
navigation_bestrating = -1;
self.navigation_hasgoals = FALSE;
navigation_bestgoals_reset();
- navigation_markroutes();
+ navigation_markroutes(world);
};
// ends a goal selection session (updates goal stack to the best goal)
Modified: trunk/data/qcsrc/server/bot/navigation.qh
===================================================================
--- trunk/data/qcsrc/server/bot/navigation.qh 2009-09-25 16:31:20 UTC (rev 7897)
+++ trunk/data/qcsrc/server/bot/navigation.qh 2009-09-25 17:26:09 UTC (rev 7898)
@@ -63,7 +63,8 @@
void navigation_pushroute(entity e);
void navigation_poproute();
void navigation_markroutes_checkwaypoint(entity w, entity wp, float cost2, vector p);
-void navigation_markroutes();
+void navigation_markroutes(entity fixed_source_waypoint);
+void navigation_markroutes_inverted(entity fixed_source_waypoint);
void navigation_bestgoals_reset();
void navigation_add_bestgoal(entity goal);
void navigation_routerating(entity e, float f, float rangebias);
Modified: trunk/data/qcsrc/server/cl_impulse.qc
===================================================================
--- trunk/data/qcsrc/server/cl_impulse.qc 2009-09-25 16:31:20 UTC (rev 7897)
+++ trunk/data/qcsrc/server/cl_impulse.qc 2009-09-25 17:26:09 UTC (rev 7898)
@@ -512,7 +512,7 @@
}
}
}
- else if(imp >= 103 && imp <= 107)
+ else if(imp >= 103 && imp <= 108)
{
if(cvar("g_waypointeditor"))
{
@@ -538,7 +538,7 @@
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)
@@ -553,6 +553,22 @@
}
}
break;
+ case 108:
+ navigation_markroutes_inverted(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;
}
}
}
More information about the nexuiz-commits
mailing list