RimWorld

RimWorld

1,515 ratings
Perfect Pathfinding
11
7
4
16
7
3
11
5
2
2
3
3
2
2
2
   
Award
Favorite
Favorited
Unfavorite
Mod, 1.2, 1.3, 1.4
File Size
Posted
Updated
962.842 KB
29 Dec, 2020 @ 9:13pm
27 Nov, 2022 @ 5:45am
14 Change Notes ( view )

Subscribe to download
Perfect Pathfinding

Description
~ Features ~
Heuristic Patch:
When a pawn paths to a target a great enough distance away, the vanilla game utilizes an alternate heuristic to calculate the cost of a path that shortens the calculation time, but results in worse paths. This is the cause of the "zig-zag" diversions when approaching corners and doorways, and paths that ignore difficult terrain. This patch forces the algorithm to use the accurate heuristic every time.

Lighting and Weather Patches:
Pawns move slower when walking in the dark or in the rain. The vanilla algorithm uses the light and weather condition at the pawn's starting position for the entire length of the path. This patch calculates the real movement cost at each cell location, incentivizing pawns to avoid dark, stormy areas like they should.

Dirt Avoidance:
This patch was more of a personal challenge to come up with a method of avoiding dirt while maintaining the most optimal path. The strength can be adjusted in the settings, which is the number of added seconds a pawn is willing to spend taking a longer, cleaner path.

~ Questions ~
Can this mod be added and removed safely from existing saves?
Yes!

Does this mod impact performance?
The worst case performance impact that I measured were in the tens of milliseconds. On a regular sized map and with a reasonable CPU the performance impact of this mod should be negligible. Anyone who still needs a lightweight alternative, look into Clean Pathfinding.

So how is this different to Clean Pathfinding?
Perfect Pathfinding removes optimizations and adds complexity to the algorithm calculations with the goal of finding optimal, perfect paths.
Clean Pathfinding adds optimizations and uses lightweight methods to find paths that keep your pawns clean.

If all you want is for your ungrateful colonists to use the roads you lovingly paved for them, Clean Pathfinding is probably what you're looking for.

¯\_(ツ)_/¯
232 Comments
Няшко 18 Jan @ 12:08am 
at least may help optimize base routes
still waiting update
Няшко 18 Jan @ 12:07am 
may be [KV] Path Avoid can help better pathfinding . but it need manual work
The Viral Divinity 3 Jan @ 4:58pm 
Sucks too because the only other pathfinding mod is "Clean Pathfinding", and that literally just makes colonists path in the cleanest route, not the best or fastest, this is the only mod that actually does that.
The Viral Divinity 1 Jan @ 12:36am 
Most conditions it seems to work fine, but with enough mods or ones that change certain parts of the game, the mod just flat out breaks.
The Viral Divinity 1 Jan @ 12:35am 
Yeah, I don't think this mod is actually 1.5 Compatible guys.

Like some of the other people are saying, there are clearly bugs that don't trip the error log, as I've had pathfinding like it shows in the example screenshots for the "before", even with the mod, so something changed in the pathfinding between 1.4 and 1.5.
Greymalkin 17 Dec, 2024 @ 5:13am 
There seem to be mixed reports here about 1.5 compatibility, and an excellent but unanswered question about pathing behavior for Sanguaphages and light. Does anyone actually have answers, or dived the code looking for them?
Dyspeptic Icarus 11 Dec, 2024 @ 7:56am 
I'm pretty sure there's hidden bugs that aren't triggering errors, especially with all the new mods that adjust pathing in some way.

In the past, I was able to get it to nearly always walk on paths I build. Now they actively walk off ~10-25% of their time before getting back on path.

Perhaps a processing issue.
TheNamelessOne 29 Oct, 2024 @ 9:28am 
Godsend of a mod.
Skrip 16 Oct, 2024 @ 10:41pm 
Working great for me in 1.5. I have about a dozen mods
ProfZelonka 23 Sep, 2024 @ 10:22pm 
Weird pathing behavior, not sure this works in 1.5 all the time? Could be wrong, I'm pairing it with other mods so.. but others are all 1.5 official