Skip to content

Jetpack/Jump-Aware Pathfinding #138

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

Merged
merged 36 commits into from
Aug 25, 2024
Merged

Jetpack/Jump-Aware Pathfinding #138

merged 36 commits into from
Aug 25, 2024

Conversation

Causeless
Copy link
Contributor

@Causeless Causeless commented Aug 22, 2024

This PR adds the capability to the pathfinder to intelligently generate paths based on the actor's jump height (i.e, how far vertically they can fly using their jetpack).

Previously, actors would pathfind without any sort of awareness of the ground. They pathfinder would generate a path through air assuming that everything can fly. Then a series of hacks were applied to clean up the path: we'd move all the points in the path down to the ground, and then the Lua AI would try to reconstruct "jumping" by moving the points back up where necessary.

This would very often generate paths are are impossible for the actor to follow, for example pathing up-and-around an entire building. This frequently led to bugs where actors would fly up-and-down on the spot without actually making any progress towards their destination. It would also generate very bad paths even when the actor has adequate jetpack strength, due to the varied hacks to cleanup the path.

With this change, actors now generate paths that stay on the ground naturally during the pathfinder itself, instead of needing to cleanup the path. They also generate jumps within the pathfinder, meaning that the actor understands much better how to navigate upwards. For example, actors will now try to use intermediate platforms to work their way upwards, if in a long vertical shaft with stopping points to stand on. Likewise. if an actor sees that it's absolutely impossible for them to jump up to a ledge to enter a base, they will now dig through the walls if necessary.

The pathfinder also has support for NoGrav areas, so all actors understand that they can pathfind up through movators, even without jetpacks. Support for flying pathfinding is still included, for example for dropships.

Just now it's hardcoded to assume that crabs have zero jump height, that humans have a fixed jump height, and that everything else (dropships, rockets, etc) are flying. Before merge I will add code to automatically calculate a jump height based on the actor's mass and their jetpack fuel and thrust.
Now the game uses an internal miniature iterative physics sim to calculate jetpack jump heights automatically. This is dynamic, so even takes into account the current actor's inventory mass.

…ust calling per-team repeatedly, so doing it like this is more flexible
Went back to SCENEGRIDSIZE
… etc)

Added lua bindings and plumbing to allow configurable jumpHeight from actor. Crabs right now are assumed to have 0 height, Humans are assumed to have 20, and anything else has infinite.
@Causeless Causeless merged commit cff4c28 into development Aug 25, 2024
4 of 5 checks passed
@Causeless Causeless deleted the jetpack-aware-pathing branch August 25, 2024 23:15
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.

1 participant