Skip to content
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

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open

Ai microrevamp #31

wants to merge 6 commits into from

Conversation

blubs
Copy link

@blubs blubs commented May 20, 2024

Starting conversation here to get these fixes merged into prod.
Testing on hardware / emu still pending, will report back once testing's done.

@blubs blubs requested a review from MotoLegacy May 20, 2024 08:58
@blubs blubs self-assigned this May 20, 2024
blubs added 2 commits May 21, 2024 22:28
Removed redundant "id" / "target_id" waypoint fields
Update beta-map waypoint loading code to use waypoint "owners" rather than "links"
@blubs
Copy link
Author

blubs commented May 22, 2024

Tested maps f4ll, nacht, house. pathfinding behavior seems significantly improved
Tested new waypoint-loading code on beta map "ankunft", confirmed loading of beta waypoint files
Tested map f4ll on PSP 3k hardware, ran from round 10 -> 23, no issues spotted

Copy link
Member

@MotoLegacy MotoLegacy left a 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
Copy link
Member

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?

Copy link
Author

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];
Copy link
Member

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.

Copy link
Author

@blubs blubs May 31, 2024

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.

Copy link
Member

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.

Comment on lines +1508 to 1514
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");
}
Copy link
Member

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_Dprintfs instead?

}

if(n_openset_waypoints != openset_length) {
Con_Printf("%i%i%i\n", n_openset_waypoints, openset_length);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Con_Dprintf

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants