[1.3] [KV] Path Avoid [ModSync RW]

Started by Kiame, May 29, 2017, 12:25:25 AM

Previous topic - Next topic


I wonder why this mod not working with roads?

After picking slug

I have "Prefer" regions on my roads.

What's wrong with this pawns?


PathAvoid is really not meant for macro-scale endeavours and is more for micro-scale (room to room) tool. This is more an underlying problem with how the base game's pathfinding works and I welcome you to try different values and see if something else works.

In-depth for Path Avoid's hints: each tile can have a 0 to 255 value of 'difficulty'. W/o this mod every tile has a value of 0 and as things like grass, mud, trees, rocks, etc get put on a tile the difficulty goes up. This mod increases the base value to 10. Preferred becomes 0. From there dislike, hate, strong go 50, 150, 250 (iirc just going off memory). So surrounding the non-roads with 'strong' will probably give a stronger 'hint' to the pawns to use the roads but the pawns could very well ignore that too (especially for longer distances).

Workaround: In the mod's options you can click 'advanced' and you can put in your own values for each path avoid type. I have not personally tested it with other values with this release. Setting Normal to 50 might give a stronger hint to the pawns. Again though, especially for longer distances, your pawns will probably ignore path avoid.


Even over shorter distances sometimes you don't get what you'd expect though:

That said you also sometimes do. Like I said before, it's a bit erratic at times.
"The megasloth ducked behind the nearest piece of cover"


yes this is by no means perfect. Just a means to help the pathfinding do better. In the case of the room this is definitely the pathfinding - it appears to be favoring the shorter path over the easier one. You may try making both sides of the blue workbench strong to emphasize even more not to go that way (basically an up-side-down T of strong)


Actually what I think is happening here is that the pawn initially tries to walk directly toward his destination, but then encounters an obstacle and paths around it at the last minute. I've seen that happen in other situations as well. It just seems odd that it's quite THAT short-sighted, because this path gets chosen even if it starts from the position shown in the screenshots.
"The megasloth ducked behind the nearest piece of cover"


> your pawns will probably ignore path avoid.

What would be useful is having the "strong" region be like a constructed item (like a sleeping spot), and then have it set to impassable=true, but only for your own pawns. The game would definitely honor that.

CR All Mods and Tools Download Link
CR Total Texture Overhaul : Gives RimWorld a Natural Feel
CR Moddable: make RimWorld more moddable.
CR CompFX: display dynamic effects over RimWorld objects


Yeah, this one has me stumped. Behold this path:

And my pathing mask:

It's avoiding even going NEAR the "strong" tiles, it seems. When I set the stockpiles back to normal it becomes:

At this point I'm starting to think the unpredictability of this mod is rather defeating its purpose.
"The megasloth ducked behind the nearest piece of cover"


The low res makes it difficult to see. Is that an x in the doorway? If so that's why he's going around.

As for why he's not going through the base, the doors have a weight to them as well. What the pathfinding probably found is that the longer way around was less weighted than going through multiple doors. This path would have been found w/ or w/o this mod


Yeah, the door is forbidden. It originally pathed through there, so I wanted to see if forbidding it would improve the pathfinding. Instead, it made it worse.

And no, it would not have found the same path without the mod, because removing the weighting on the stockpiles changed the path it found. I made it choose a new path several times in a row, and it would always go the long way around until I did that.

(Enough for the fact that that long path goes through MORE doors than the short one.)
"The megasloth ducked behind the nearest piece of cover"


I'm experiencing the same issues. Look at the attached picture. Vasques is going to haul fine meal and Gruenfelder is going to research (I repainted their pathways with green lines for better visibility). The path through my dinner/rec room would be shorter, has less doors, doesn't include soil, bushes and darkened areas, and even includes more of "preferred" section. If I remove the pathing preferences in dinner/rec room, my pawns often will crawl through that row of arcades as i painted with purple line.

I think it's mostly issue of the vanilla pathfinding algorithm, because the same situations can happen in vanilla, it's just harder to create conditions for it. Sometimes pawns choose decently good paths. I have a suspicion that the game somehow chooses (probably dynamically, that's why it can't be reproduced reliably) only some tiles (or groups of them) to calculate, so it becomes like "if I can't go exactly that tile, I won't mind going anywhere near it". Probably it can also explain some "vacillations" like those I showed with blue circles and worse situations when pawns go from the good strict road to climb some tree nearby just to return on that same road again after that. And/or there could be something weird with the whole calculation of movement cost for obstacles.

[attachment deleted by admin: too old]
Think about it. Think around it. Perhaps you'll get some new good idea even if it would be completely different from my words.


Trying to get this pawn to take the patch up through the preferred area. She's taking wood from that little enclave you see at the bottom right, down across the bottom, and the up the left side of the screen, before finally taking it to the top right of the frame. I tried making this path so that they would stop walking through the forest going slow as dirt, but it seems like I can't get her to stick to the area I've designated as preferred.

Before I painted any of these cells, the pawns kept taking horrible paths. Now, they just taking a long way around the horrible paths :P


Update for 1.0:

Use ModSync RW to know if/when there's an update

"Normal" has been removed. Use "Prefer" to revert paths to their base value.
Fixed a bug where there would be an error if the pathing was dragged off the map.


Can't the value be less than zero?

EDIT: If everything starts with zero, then the only way to make a path that the pawn will prefer is to have a value below zero.

One hack would be to put the whole map on a given number like 50 or 100 for example, and then you remove the path you prefer, this way you can have a 'use this path' using this mod. It might confuse the pawn however on paths that costs a lot since the max is 255 so a lot of things could reach the max now when they couldn't before so the pawn won't differentiate them.



The game uses unsigned bytes for this information so the supported numbers are 0-255

The B18 version of this mod with 'Prefer' and 'Normal' worked off the idea of all tiles had a '10' weight (as opposed to 0). Normal was thus 10 and Prefer was 0.

The pathing is not the greatest in this game; specifically for longer paths. I'm not an expert but the last time i looked at the pathing code itself there is a kill-switch in the code to prevent it from costing too much for the CPU. Something like if the pathing hits a square that has a high enough weight it will try to find a better path with a BFS of a depth of 8 iirc. If it's unable to find a better path at depth 8 it cuts out and draws a straight line instead of using any intelligence in pathing.

The 1.0 version removes Normal and makes everything 0 to help prevent the above kill-switch from triggering as often (it still will in many cases though)

Remember, this mod is not a replacement for the base game's restricted zones. This is simply a way to give the pathing system 'hints' as to the best path to take.


Kiame, have you checked what would have a 255 value? Maybe the game is coded in a way that a high enough value is used to determine a threat instead of just a very costly path and so using a value so high for the higher tier of this mod might not be the best since it could cause pawns to not only avoid the tile but around the tile as well. That's the only explanation I could think of.