Paradise
Paradise copied to clipboard
[TM] Port TG Jump Point Search and SSpathfinder
What Does This PR Do
Ports https://github.com/tgstation/tgstation/pull/56780, and its associated subsystem.
Due to the nature of JPS, it has to be a uniform cost grid. This means diagonals are the same as horizontals, and due to the way the scanning works, bots will favor diagonals if there's a blocker nearby. Hence here, they will take a weird diagonal as the wall next to it gets detected, and the next closest valid tile is on a diagonal. The attempt at implementing cost didn't work quite properly for long distance, and thus broke mules.
If we're merging JPS, we'd have to accept that the bots will from then onward be a little quirky. Moreso with the 2-steps patrol routine that doesn't quite like diagonals.
The pathfinding overlay for bots doesn't expect diagonals, so it's something that would need fixing later.
Why It's Good For The Game
A test run would be needed to see the actual perf cost. Fixes #19322 as MULEs weren't actually incrementing their path when moving.
Testing
Added obstacles all over, let the bots do their things. Summoning them as well since it forces them to deviate from their typical paths. Ran around lavaland as well to catch anything.
Changelog
:cl: tweak: Mob pathing can take diagonal directions, and should be faster for summoned bots. fix: MULE pathing clears properly when they move around /:cl:
Messing around, I found out that the bots passing through windows wasn't an issue with pathfinding, but one of how movement is handled by them.
Once a path is made and chosen by AStar/JPS, it's transfered over to the mob and they'll handle it from there.
I haven't figured out to fix that specifically, though I did spot that admin spawned full windows do not trip AStar, so there's a fix for that.
I added a fix for cleanbots as they were busted to begin with.
Medbots do not seem to have proper handling for their paths being nulled unlike the others, I added an extra check.
I just went and replaced all path.lens.
Floorbots also had the same issue as Cleanbots where their tile routine was placed too far down and would just repath once reaching their target.
A lot of issues showing up with bots pathing strangely.
This mule was stuck in this door, when sent back and tried again it got stuck here until the door opened, where it proceeded to get stuck in the door again
Bots trying to path through dense fences
there isn't even a bot here, but the path remains
bots also teleport when moving diagonally, instead of gliding properly. It's really jarring, the diagonal paths are also quite jarring.
this mule was stuck "Waiting for clear path", his directional indicator facing backwards?
Mule path hud icons seem to linger even when a mule passes over a turf, unlike beepers or other bots.
bots randomly won't diagonal even though it is faster to do so here?
same here
this mule took this path
Oh well. You can't actually put weight on diagonals for JPS.
Gain some, lose some. Increased perf, but you gain slightly sillier bots who will do sick diagonal drifts occasionally.
I put an Astar check for mules, so they don't end up constantly blocking each other.
There is still some minor jank for diagonal pathing, but it's mostly working well now from what I can see
I've noticed that when mulebots follow a diagonal path, they just jump to the next turf in their path rather than gliding to it. Only seems to happen on the "new" diagonal paths that look a little scuffed.
Not much I can do about mules. They use step_towards
for their movement unlike other bots, and it sort of works half the time for diagonals.
Issue with EDs, they get stuck trying to move onto the same tile at the same time, and just break. Beepers reroutes around them fine but they get stuck.
this one gets stuck by itself, weirdly