Skip to content

Implement Dijkstra-floodfill-based meetingPosition with motion prediction#4159

Draft
Henrybk wants to merge 5 commits intomasterfrom
newMeeting
Draft

Implement Dijkstra-floodfill-based meetingPosition with motion prediction#4159
Henrybk wants to merge 5 commits intomasterfrom
newMeeting

Conversation

@Henrybk
Copy link
Contributor

@Henrybk Henrybk commented Mar 7, 2026

Overhauls the tactical interception logic to use a new Dijkstra floodfill algorithm for efficient reachability analysis. Replaces simple distance checks in meetingPosition with predictive "motion snapshots" that account for actor and target movement speeds, allowing the bot to better intercept moving targets or maintain distance while kiting.

Key changes:

  • Refactored meetingPosition in Misc.pm to use score-based selection and time-based position prediction.
  • Introduced testNewMeeting plugin and field files for validating tactical movement scenarios.

A bit more technical:

  • Added Dijkstra floodfill routines to the C++ pathfinding core and exposed them via XS. This reduces calls to the XS/X++ Pathfinding algorithmn from ~700 to 2 in each cycle
  • Introduced isTargetProbablyComingToMe to detect approaching monsters based on AI state and proximity.
  • Updated meetingPosition to use chase-aware motion snapshots and instability penalties for better spot selection.
  • Adjusted default attack configurations to favor waiting for aggressive targets and prioritize stable attack positions.
  • Added algorithm to determine the cell the target will try to reach to attack the character, now calculates arrival to this cell instead of actor cell
  • Added occupancy and portal checks to exclude invalid candidate spots.
  • Ensured deterministic spot selection by sorting coordinate keys during iteration.
  • Improved selection logic to better handle score ties using distance and time heuristics.

Draft for now

Video showcases

Video version 1
Video version 2

Overhauls the tactical interception logic to use a new Dijkstra floodfill algorithm for efficient reachability analysis. Replaces simple distance checks in `meetingPosition` with predictive "motion snapshots" that account for actor and target movement speeds, allowing the bot to better intercept moving targets or maintain distance while kiting.

Key changes:
- Added Dijkstra floodfill routines to the C++ pathfinding core and exposed them via XS.
- Refactored `meetingPosition` in `Misc.pm` to use score-based selection and time-based position prediction.
- Introduced `testNewMeeting` plugin and field files for validating tactical movement scenarios.
@Henrybk Henrybk marked this pull request as draft March 7, 2026 00:40
Henrybk added 2 commits March 7, 2026 10:11
Refines tactical movement logic to better handle monsters chasing the player. Instead of relying solely on whether damage has been dealt, the AI now uses movement vectors and aggression state to predict if a target is approaching.

- Introduced `isTargetProbablyComingToMe` to detect approaching monsters based on AI state and proximity.
- Updated `meetingPosition` to use chase-aware motion snapshots and instability penalties for better spot selection.
- Adjusted default attack configurations to favor waiting for aggressive targets and prioritize stable attack positions.
- Added algorithm to determine the cell the target will try to reach to attack the character, now calculates arrival to this cell instead of actor cell
- Added occupancy and portal checks to exclude invalid candidate spots.
- Ensured deterministic spot selection by sorting coordinate keys during iteration.
- Improved selection logic to better handle score ties using distance and time heuristics.
@blankusername69ers

This comment was marked as off-topic.

@blankusername69ers

This comment was marked as off-topic.

@Henrybk
Copy link
Contributor Author

Henrybk commented Mar 12, 2026

I got kinda carried away with this one, There is still somethings to improve upon, a few minor bugs to fix and a lot to clean and move

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.

2 participants