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

[WIP] Artificial Brilliance 0.1: Dijikstra Maps #6069

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

DeltaEpsilon7787
Copy link
Contributor

@DeltaEpsilon7787 DeltaEpsilon7787 commented Feb 9, 2025

Purpose of change (The Why)

Current A* pathfinding is trash.

  1. It's one-to-one pathfinding system that does not utilize the fact that the vast majority of pathfinding done targets the same location within a turn.
  2. It's VERY old code and it shows in how spaghetti it has become
  3. Implementing any sort of potential fields is maddening due to how the algorithm is written
  4. A* progression is pretty hard to introspect into.
  5. Not a lot of knobs to turn, pathfinding is very same-y across runs, leading to congested routes, uninteresting pathing etc.
  6. It doesn't actually work because of max_length being so low, 99% of the time it never reaches the target.

Describe the solution (The How)

Dijikstra maps.
A significantly more aggressive pathfinding system for AI to use that will be necessary for more complicated AI behaviors related to pathing around obstacles and dangers to be done after this system is implemented.
Dijikstra maps allow many-to-1 pathfinding, i.e. from any position to some specific target. This is our most common case objectively, many zombies pathing towards the player.
I have implemented almost everything current pathfinding can do along with a number of additional features to be given JSON flags at a later point.

Feature list:

  • Consider terrain/furniture move cost when pathing
  • Adjustable costs for various terrain features
  • Recent death avoidance: preferably route around recently spawned corpses of same species
  • Live mob avoidance: pathing around other mobs
  • Suboptimal pathing: not always choosing the shortest paths available
  • Adjustable heurestic coeff: change from raw dijikstra to A*-like heurestics
  • Pathfinding area of search limits: only search within specific radius from target, only search within a certain angle from ourselves to target, ignore paths that are too long step-wise or too long cost-wise.
  • Support for flying mobs
  • Support for non-euclidean maps (mostly related to stairs that teleport you elsewhere)

Testing

To be done.

Additional context

To be done.

Checklist

Mandatory

@github-actions github-actions bot added the src changes related to source code. label Feb 9, 2025
Copy link
Contributor

autofix-ci bot commented Feb 9, 2025

Autofix has formatted code style violation in this PR.

I edit commits locally (e.g: git, github desktop) and want to keep autofix
  1. Run git pull. this will merge the automated commit into your local copy of the PR branch.
  2. Continue working.
I do not want the automated commit
  1. Format your code locally, then commit it.
  2. Run git push --force to force push your branch. This will overwrite the automated commit on remote with your local one.
  3. Continue working.

If you don't do this, your following commits will be based on the old commit, and cause MERGE CONFLICT.

@scarf005 scarf005 marked this pull request as draft February 9, 2025 01:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
src changes related to source code.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant