Paradise icon indicating copy to clipboard operation
Paradise copied to clipboard

[TM] Port TG Jump Point Search and SSpathfinder

Open Vi3trice opened this issue 2 years ago • 8 comments

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.

Bot

The pathfinding overlay for bots doesn't expect diagonals, so it's something that would need fixing later. JPS_BEEP

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:

Vi3trice avatar Sep 06 '22 23:09 Vi3trice

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.

Vi3trice avatar Sep 08 '22 17:09 Vi3trice

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.

Vi3trice avatar Sep 24 '22 00:09 Vi3trice

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.

Vi3trice avatar Sep 24 '22 16:09 Vi3trice

A lot of issues showing up with bots pathing strangely. image 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 image

image Bots trying to path through dense fences

image 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.

S34NW avatar Sep 27 '22 13:09 S34NW

image 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.

image bots randomly won't diagonal even though it is faster to do so here?

image same here

S34NW avatar Sep 27 '22 13:09 S34NW

image this mule took this path

S34NW avatar Sep 27 '22 13:09 S34NW

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.

Vi3trice avatar Oct 01 '22 16:10 Vi3trice

There is still some minor jank for diagonal pathing, but it's mostly working well now from what I can see

S34NW avatar Oct 11 '22 12:10 S34NW

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.

lewcc avatar Oct 17 '22 22:10 lewcc

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.

Vi3trice avatar Oct 18 '22 18:10 Vi3trice

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.

image

S34NW avatar Oct 24 '22 16:10 S34NW

image this one gets stuck by itself, weirdly

S34NW avatar Oct 24 '22 16:10 S34NW