-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ai microrevamp #31
base: main
Are you sure you want to change the base?
Ai microrevamp #31
Conversation
Includes various optimizations and bugfixes
Fix function names Fix `n_waypoints` calc Misc cleanups
Removed redundant "id" / "target_id" waypoint fields Update beta-map waypoint loading code to use waypoint "owners" rather than "links"
Tested maps f4ll, nacht, house. pathfinding behavior seems significantly improved |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mostly good. Just a few issues. Additionally, could you build with MEASURE_PF_PERF
and record similar situations with and without these changes? It would be useful to get an average performance difference value.
int openset[MAX_WAYPOINTS];//Actual sorted open list | ||
int opensetRef[MAX_WAYPOINTS];//Reference values of open list | ||
int opensetLength;//equivalent of javaScript's array[].length; | ||
|
||
#define MaxZombies 16 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this used? If so, what is this for?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's used to allocate memory to stash a path per-zombie as a list of waypoints.
|
||
char waypoint_set[MAX_WAYPOINTS]; // waypoint_set[i] contains the set identifier for the i-th waypoint | ||
unsigned short openset_waypoints[MAX_WAYPOINTS]; // List of waypoints currently in the open set sorted by heuristic cost (index 0 contains lowest cost waypoint) | ||
unsigned short openset_length; // Current length of the open set | ||
zombie_ai zombie_list[MaxZombies]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should use the same value returned by the PF_maxai builtin.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like nzp_maxai
maps to void PF_MaxZombies(void)
which has a hardcoded 12
I partly think we should rename things to be zombie-agnostic (for other AI types), but navmeshes will eventually replace it all.
I think for now the best move might be to update PF_MaxZombies
to instead return this MaxZombies
preprocessor define.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure. To clarify, my concern was the disparity between these numbers. If we can change this macro to 12 and have this builtin return this macro as well, that is perfectly fine.
void sv_way_print_sorted_open_set() { | ||
Con_Printf("Sorted open-set F-scores: "); | ||
for(int i = 0; i < openset_length; i++) { | ||
Con_Printf("%.0f, ",waypoints[openset_waypoints[i]].f_score); | ||
} | ||
Con_Printf("\n"); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you make these Con_Dprintf
s instead?
} | ||
|
||
if(n_openset_waypoints != openset_length) { | ||
Con_Printf("%i%i%i\n", n_openset_waypoints, openset_length); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Con_Dprintf
Starting conversation here to get these fixes merged into prod.
Testing on hardware / emu still pending, will report back once testing's done.