Ludeon Forums

RimWorld => Releases => Mods => Outdated => Topic started by: Zhentar on October 02, 2016, 07:43:01 PM

Title: [A16] Better Pathfinding (v1.5.2 update 2/22)
Post by: Zhentar on October 02, 2016, 07:43:01 PM
Better Pathfinding

Vanilla pawns have a tendency to make some... odd... decisions when finding their way to their destination. Like going out of their way to avoid those nice, fast paths you built to slowly trudge through dirt, snow, and debris. Better Pathfinding brings an end to that, teaching pawns (friend and foe alike) to take sane, near-optimal paths - while trying to keep performance near Vanilla.

PathAvoid (https://ludeon.com/forums/index.php?topic=29194.0) is compatible with Better Pathfinding.

A16
A16 1.5.2 Download (https://github.com/Zhentar/BetterPathfinding/releases/download/1.5.2/Better.Pathfinding.v1.5.2.zip)
Version 1.5.2 Changelog
Version 1.5.1 Changelog
Version 1.5 Changelog
Version 1.4.3 Changelog
Version 1.4.2 Changelog
Version 1.4.1 Changelog
Version 1.4 Changelog

Note that for A16 I have to use a MapComponent to tie pathfinder instances to maps. This means disabling Better Pathfinding will cause an error to be logged when you load a game saved while Better Pathfinding was enabled, but it is benign and can be safely ignored. It can be safely added to existing games with no errors.

A15
Download Link: https://github.com/Zhentar/BetterPathfinding/releases/download/1.3.2/Better.Pathfinding.v1.3.2.zip

Version 1.3.2 Changelog

Version 1.3.1 Changelog

Version 1.3 Changelog

Version 1.2.1 Changelog

Version 1.2 Changelog


Version 1.1 Changelog


Comparison images:
(http://imgur.com/vTJ0xOl.jpg)
Vanilla Pathfinding
The colored squares show which tiles the pathfider has examined while looking for the best path to the destination. You can clearly see the usual behavior for long paths here - it tries to go straight towards the destination, only going around when it runs into something. It didn't even try to avoid the marshy bit at the beginning of the path!

The path chose here is 10% longer than the optimal path.

(http://imgur.com/tINQyee.jpg)
If We Used A Naive Admissable Distance Heuristic
This test used a simple octile distance heuristic. This is the standard "right" way to implement an A* pathfinder, and it always chooses an optimal path.

You can see it looks at an awful lot more tiles (even though many are "obviously" stupid and not going to work), which carries a pretty significant performance cost. That performance cost is why this isn't how Vanilla works.

(http://imgur.com/MjrLJlL.jpg)
The "Better Pathfinding" Way
Like the octile distance, we get an optimal path here, but we only look at two thirds as many tiles! You can see it's quite a bit smarter - it knows there's a mountain in the way. It doesn't explore every nook and cranny hoping to find a way through the mountain, and it gives up on going around to the left when it finds the marsh. Most of the tiles explored are through the plains area, basically hoping to find a road to cross it faster. (This raises the obvious question, why didn't I put a road in for my promo pics to better demonstrate my algorithm's cleverness? This is why I'm a software developer and not a marketer)

Version 1.1 - Look at all the performance!
(http://imgur.com/MNe4oZv.jpg)
Vanilla & Admissable Heuristic
With very hard paths like this one, the Vanilla pathfinder and the simple optimal heuristic have very nearly identical performance. Both find the optimal path, by searching a very large area.

(http://imgur.com/4yBw0jh.jpg)
The "Better Pathfinding" Way
This round, I thought ahead and used a layout that better demonstrates the brilliance of my approach! On the right side, there's a door but it's forbidden. It knows that door is forbidden, so it doesn't even try to find a way through there; it knows not to to go down the dead ends.

However, you can also see that a number of the cells are more opaque than others. This is a new behavior in 1.1; sometimes it needs to revisit cells it has already visited once. This part isn't so clever, particularly since it's revisiting some of them half a dozen times, but in the end, it finds the optimal path in 1/4th the time that Vanilla takes.

License: Do whatever the hell you want with this. No credit required.
Source is on Github here: https://github.com/Zhentar/BetterPathfinding

Title: Re: [A15] Better Pathfinding
Post by: EldVarg on October 02, 2016, 08:06:12 PM
Woho! Tried out an earlier version of this and it was good :).
Title: Re: [A15] Better Pathfinding
Post by: Crossbowman on October 02, 2016, 08:07:02 PM
Somehow, I saw your name, saw the title, and though we have never met, I had a good feeling about this mod. So far, it looks excellent; my colonists finally take the roads I built for them instead of trudging through filthy swamps and fetid pools of stagnant pond water, and they finally stop trampling my crops in the fields and instead take the stone paths paved along the rims. Occasionally they do have the odd sort of behaviour where they unnecessarily take a diagonal path instead of a straightaway, but otherwise, it's exciting to see that my colonists behave more like human beings now!

As far as performance goes, there is a noticeable hit when all colonists are awake, so my guess is that the performance decrease is more severe for when there are lots of pawns who need to go to set destinations. Animals wandering around the map seem to have no real effect, so that is good. A big thumbs up from me!
Title: Re: [A15] Better Pathfinding
Post by: Zhentar on October 02, 2016, 09:26:32 PM
Yeah, I've noticed it takes funny diagonal cuts occasionally. I think it's because my heuristic slightly breaks consistency (around the corners of regions, moving one tile closer to the goal can result in the heuristic incorrectly claiming that it moved further away from the goal). There should be a way to fix it, but I haven't tried yet.

I believe the main performance concern for the vanilla pathfinder was not the common cases dragging down average FPS, but rather worst cases causing hitching/jank. If that is true, then this mod shouldn't cause any performance problems, because it performs as well or better than Vanilla in the really bad cases that I've tested.
Title: Re: [A15] Better Pathfinding
Post by: BetaSpectre on October 02, 2016, 10:55:22 PM
+1 This mod looks really nice. I'm sticking to vanilla cause I think it's more realistic that people IRL might not know the optimal paths.
Title: Re: [A15] Better Pathfinding
Post by: iceteazz on October 02, 2016, 11:33:40 PM
 _ Nice work, i gonna test it now, thx alot :)
Title: Re: [A15] Better Pathfinding
Post by: Dingo on October 03, 2016, 05:55:02 AM
Been waiting for this ever since you posted your attempt on Reddit :)
Title: Re: [A15] Better Pathfinding
Post by: huyderman on October 03, 2016, 07:09:10 AM
Quote from: BetaSpectre on October 02, 2016, 10:55:22 PM
+1 This mod looks really nice. I'm sticking to vanilla cause I think it's more realistic that people IRL might not know the optimal paths.

Sure, people might not know the optimal path. But unlike vanilla, people IRL can spot an obstacle ahead before they're standing right in front of it... Or would stick to the road or walk around a march... We do a lot of micro-optimizations to how we walk without thinking about it, and IMHO the results of the optimized pathfinding here is closer to how people actually plan a route than vanilla.
Title: Re: [A15] Better Pathfinding
Post by: kcirdor on October 03, 2016, 09:56:47 AM
People may not know the optimal path their first trip, maybe not even their second trip.  But after 100 trips they better damn well know the best past to take. Also, the Pawns make so many dumb decisions like hauling that 4 stack of steel from across the map, and then going right back to the same location and hauling that 6 stack of steel that was just barely out of range for multi stack pick up previously.  Thanks for the mod.  This is just a straight forward installation for a mod, right? Drop in the mod folder?
Title: Re: [A15] Better Pathfinding
Post by: Dingo on October 03, 2016, 10:01:39 AM
You drop the folder into RimWorld/Mods just like any other mod.
Title: Re: [A15] Better Pathfinding
Post by: EldVarg on October 03, 2016, 01:17:11 PM
Quote from: huyderman on October 03, 2016, 07:09:10 AM
Quote from: BetaSpectre on October 02, 2016, 10:55:22 PM
+1 This mod looks really nice. I'm sticking to vanilla cause I think it's more realistic that people IRL might not know the optimal paths.

Sure, people might not know the optimal path. But unlike vanilla, people IRL can spot an obstacle ahead before they're standing right in front of it... Or would stick to the road or walk around a march... We do a lot of micro-optimizations to how we walk without thinking about it, and IMHO the results of the optimized pathfinding here is closer to how people actually plan a route than vanilla.

Exactly! Vanilla pathfinding is very very stupid, and they never learn. Making roads was completely useless.
Title: Re: [A15] Better Pathfinding
Post by: re1wind on October 03, 2016, 04:02:45 PM
I don't think it's a case of knowing/finding the "optimal path", but rather not doing stupid things like walking through a marsh or making large diversions that don't make any sense.
Title: Re: [A15] Better Pathfinding
Post by: biship on October 03, 2016, 06:41:59 PM
Mod of the year.
Title: Re: [A15] Better Pathfinding
Post by: deliveryservice on October 03, 2016, 10:10:04 PM
is the area colored in rainbow, means calculated area for optimal path?
So it's become narrower, then it means it's more memory friendly?
Title: Re: [A15] Better Pathfinding
Post by: Thirite on October 04, 2016, 07:28:20 PM
Great mod, works well with my existing large mod collection with no errors.
Title: Re: [A15] Better Pathfinding
Post by: mabor0shi on October 04, 2016, 10:56:12 PM
seems like a great idea, but how can u stand to have that rainbow overlay covering half the map? that wud annoy the hell out of me. no thank you sir. jk i hope this isnt too much for my weak cpu, because in theory i love this. meybe i'll turn off plant sway, i hear that helps FPS
Title: Re: [A15] Better Pathfinding
Post by: Zhentar on October 04, 2016, 11:26:00 PM
Quote from: deliveryservice on October 03, 2016, 10:10:04 PM
is the area colored in rainbow, means calculated area for optimal path?
So it's become narrower, then it means it's more memory friendly?

It does mean it was the area considered for the path. It actually doesn't mean it's more memory friendly, though - RimWorld actually always keeps a chunk of memory set aside that is the right size to search the entire map (it's only a few megabytes, and it helps performance quite a bit). It (very) roughly means more CPU friendly, but mostly I just want to show off that it's more clever :)
Title: Re: [A15] Better Pathfinding
Post by: KTVSUN on October 06, 2016, 01:02:57 PM
Great mod, thank you.

I have noted some wierd behaviour sometimes.

Here is an example of a raider deciding to dig through various hills to escape.

https://dl.dropboxusercontent.com/u/10144/wierd%20path.jpg

Note: the first block he digged was a silver block and the raiders had decided to "pick whatever they can and flee". He actually grabbed the silver before fleeing. I dont know if there is a link there.

Cheers
Title: Re: [A15] Better Pathfinding
Post by: Serenity on October 06, 2016, 01:12:07 PM
That can happen in vanilla too.

I just had a case where sappers dug through distant hills where they spawned instead of digging into walls near by base. But I have no idea whether that's mod related.
Title: Re: [A15] Better Pathfinding
Post by: kcirdor on October 06, 2016, 02:05:06 PM
Quote from: KTVSUN on October 06, 2016, 01:02:57 PM
Great mod, thank you.

I have noted some wierd behaviour sometimes.

Here is an example of a raider deciding to dig through various hills to escape.

https://dl.dropboxusercontent.com/u/10144/wierd%20path.jpg

Note: the first block he digged was a silver block and the raiders had decided to "pick whatever they can and flee". He actually grabbed the silver before fleeing. I dont know if there is a link there.

Cheers

That isn't typical fleeing, that looks like we've run out of time, and we are hungry and tired so lets go home fleeing.  That type of fleeing is bugged. I have had people "start" to flee after running out of time, but they were busy trying to beat down my door and I was sitting there repairing it cause I wasn't ready to take them on. They kept beating the door down for nearly half a day until I finally opened it and started shooting at them.  They then stopped beating the door  because I jarred them from their task they couldn't finish and started taking their sweet sweet time to leave the map. So I killed them with out any resistance.

Title: Re: [A15] Better Pathfinding
Post by: marvin__ on October 06, 2016, 03:08:25 PM
Quote from: KTVSUN on October 06, 2016, 01:02:57 PM
Great mod, thank you.

I have noted some wierd behaviour sometimes.

Here is an example of a raider deciding to dig through various hills to escape.

https://dl.dropboxusercontent.com/u/10144/wierd%20path.jpg

Note: the first block he digged was a silver block and the raiders had decided to "pick whatever they can and flee". He actually grabbed the silver before fleeing. I dont know if there is a link there.

Cheers

What mod is that on the colonist bar? The one that shows weapons.
Title: Re: [A15] Better Pathfinding
Post by: kcirdor on October 06, 2016, 03:13:29 PM
Quote from: marvin__ on October 06, 2016, 03:08:25 PM

What mod is that on the colonist bar? The one that shows weapons.

ColonistBar.  Get the latest version on page fifteen, « Reply #219 on: September 22, 2016, 07:22:59 PM »

https://ludeon.com/forums/index.php?topic=20771.0
Title: Re: [A15] Better Pathfinding
Post by: KTVSUN on October 06, 2016, 03:37:42 PM
Quote from: Serenity on October 06, 2016, 01:12:07 PM
That can happen in vanilla too.

I just had a case where sappers dug through distant hills where they spawned instead of digging into walls near by base. But I have no idea whether that's mod related.

Ok thank you i was just about to post this screenshot with another raid. Their sapper did a beeline to my base digging everythign he could until they abandoned and left.
https://dl.dropboxusercontent.com/u/10144/digging%20again.jpg
Cheers
Title: Re: [A15] Better Pathfinding
Post by: Serenity on October 06, 2016, 03:53:00 PM
To be clear that happened with this mod! That's why I don't know if that's normal

But I've seen the tunneling while leaving thing in vanilla, so it wouldn't surprise me. Might warrant some further investigation though. If it happens too often it could be the mod. Usually sappers pick a good spot for their tunnels.
Title: Re: [A15] Better Pathfinding
Post by: Zhentar on October 06, 2016, 07:04:42 PM
Thanks for reporting this; I'll take a look into it. Currently, it's supposed to use the vanilla logic for sappers (my fancy heuristic doesn't work for sappers), but there certainly could be a bug with that. And even if it is a Vanilla behavior, that's something I'd want to improve anyway.
Title: Re: [A15] Better Pathfinding
Post by: 14m1337 on October 06, 2016, 08:36:47 PM
did you ever upload this mod to steam workshop ? I thought I had seen it ~3 days ago, and when I wanted to download it there today, it was gone.
Title: Re: [A15] Better Pathfinding
Post by: Zhentar on October 06, 2016, 10:56:27 PM
I did not upload this to the Steam workshop, and do not plan to.


I can confirm there is a bug in my handling for sappers which makes them tremendously stupid about avoiding sapping. I'll have a fix up tomorrow.
Title: Re: [A15] Better Pathfinding
Post by: Zhentar on October 07, 2016, 01:15:03 AM
Alright, I haven't given this as much testing as I would like... but I'm sure at least some of you would rather I post it now and let you be the testers, so here you go.

Version 1.1: https://drive.google.com/open?id=0B_iRcVI-TJMZalNYSnNBaXhJOFU

Overall, this should significantly improve performance; in most cases it meets or significantly beats Vanilla performance, although there are still some cases I want to work on further.
Title: Re: [A15] Better Pathfinding
Post by: KTVSUN on October 07, 2016, 02:01:37 AM
Great, thank you.

Installing now and will test tomorrow.

Cheers,

K
Title: Re: [A15] Better Pathfinding
Post by: hiepbg on October 07, 2016, 02:08:04 AM
Great mod. I try it now.
Title: Re: [A15] Better Pathfinding
Post by: Nimrod on October 07, 2016, 07:26:23 AM
Quote
(This raises the obvious question, why didn't I put a road in for my promo pics to better demonstrate my algorithm's cleverness? This is why I'm a software developer and not a marketer)

That sold me xD ... fantastic mod! updating to 1.1 now (no sappers so far)
Title: Re: [A15] Better Pathfinding (v1.1 update 10/6)
Post by: mmance on October 07, 2016, 04:36:42 PM
I tried v1.0 and I had a problem with visitors tunneling to leave my base.  I once had 25 visitors take 12 different paths where they dug very long tunnels (some 30 blocks long) to leave.  They were not trapped, but I had the doors forbidden.  I don't know if that was it.  I disabled your mod and have not had any other experiences.   I will try v1.1 today.

I also have had the sappers dig through a distant mountain for no reason and then give up and leave.
Title: Re: [A15] Better Pathfinding (v1.1 update 10/6)
Post by: ahouneko on October 08, 2016, 06:49:32 AM
The sapper pathfinding (v1.1) does great than Vanilla. But in some situation it seems odd.......
Especially in narrow tunnel with doors.

----------------------------------------------------------------
Obviously, AI were smart enough to choose the short-cut.
(http://i1043.photobucket.com/albums/b432/ahouneko03t/FQP01/FQP-PF-01_zpsj1zlalyc.jpg) (http://s1043.photobucket.com/user/ahouneko03t/media/FQP01/FQP-PF-01_zpsj1zlalyc.jpg.html)



But they would throw grenade on the door while their men were digging.
(http://i1043.photobucket.com/albums/b432/ahouneko03t/FQP01/FQP-PF-02_zpsvkrbw40k.jpg) (http://s1043.photobucket.com/user/ahouneko03t/media/FQP01/FQP-PF-02_zpsvkrbw40k.jpg.html)



Even worse in the narrow tunnel. Non-stopping team kills.
(http://i1043.photobucket.com/albums/b432/ahouneko03t/FQP01/FQP-PF-03_zpsehbbqeae.jpg) (http://s1043.photobucket.com/user/ahouneko03t/media/FQP01/FQP-PF-03_zpsehbbqeae.jpg.html)



Error Log. It might come from pathfinding overflow ?  And that made AI keep killing their own guys ?
(http://i1043.photobucket.com/albums/b432/ahouneko03t/FQP01/FQP-PF-04_zpsgzn7cxjc.jpg) (http://s1043.photobucket.com/user/ahouneko03t/media/FQP01/FQP-PF-04_zpsgzn7cxjc.jpg.html)



Comparison in Vanilla. Kept Waiting for the digging job finished.
(http://i1043.photobucket.com/albums/b432/ahouneko03t/FQP01/FQP-PF-05_zpswxhevdt1.jpg) (http://s1043.photobucket.com/user/ahouneko03t/media/FQP01/FQP-PF-05_zpswxhevdt1.jpg.html)



By the way, it also worked well and had no problem like that in v1.0 . Perhaps due to sapper pathfinding logic (Vanilla Like) ?

Title: Re: [A15] Better Pathfinding (v1.1 update 10/6)
Post by: Serenity on October 08, 2016, 09:14:02 AM
I might be able to test later if visitors like to dig themselves out of the map. I have a boomalope man hunter pack roaming at the main entrance, so I forbade that door. And I there is a group of visitors in my base. There is however an alternative exit off the map that may be even shorter to walk. I just hope they don't do anything stupid :(

EDIT:
Things went fine. Hooray. They recognized the alternative exit and used that :)

I also just got another sapper raid and with the new version they directly attacked by base
Title: Re: [A15] Better Pathfinding (v1.1 update 10/6)
Post by: kcirdor on October 09, 2016, 02:49:06 PM
I just had some guest dig through the wall of my base to exit instead of going to the door a few feet away. If i didn't notice it I'd have been screwed on the next raid.
Title: Re: [A15] Better Pathfinding (v1.1 update 10/6)
Post by: KTVSUN on October 09, 2016, 03:29:33 PM
Quote from: kcirdor on October 09, 2016, 02:49:06 PM
I just had some guest dig through the wall of my base to exit instead of going to the door a few feet away. If i didn't notice it I'd have been screwed on the next raid.

I have the same issue with guests from the hospitality mod but it looks like it is an issue on the side of hospitality. It has just been updated to try to fix it. Will post if it keeps doing it.

And actually it s not all guests, it s guest while there is a raid.

K

K
Title: Re: [A15] Better Pathfinding (v1.1 update 10/6)
Post by: Dingo on October 12, 2016, 08:11:45 PM
MAJOR bug with this mod: A sapper-based raid spawned on the other side of the map, their pawns can't actually get to me because they reach a pathfinding threshold. Every pawn that reaches this threshold resets their search, micro-freezes the entire client and of course does it again, freezes again etc.

They will never get to my colony unless I disable BP. I can safely disable BP, make them raid me, finish the raid and enable BP without corrupting my save.

Here are downloads for testing, if you need it:
The buggy save file (https://drive.google.com/file/d/0Bz2imWwZydMqd1AwdzIwX1hvVWM/view?usp=sharing)
My currently installed mod pack (https://drive.google.com/file/d/0Bz2imWwZydMqR2ZSRVk0eVRkWlE/view?usp=sharing)
My ModsConfig with current load order (https://drive.google.com/file/d/0Bz2imWwZydMqM2VFR1daSGFkN0E/view?usp=sharing)

(http://i.imgur.com/JeS16Zc.png)
Title: Re: [A15] Better Pathfinding (v1.1 update 10/6)
Post by: hentiger on October 13, 2016, 12:02:49 PM
oh my god
Title: Re: [A15] Better Pathfinding (v1.1 update 10/6)
Post by: Zhentar on October 13, 2016, 11:34:06 PM
Quote from: Dingo on October 12, 2016, 08:11:45 PM
MAJOR bug with this mod: A sapper-based raid spawned on the other side of the map, their pawns can't actually get to me because they reach a pathfinding threshold. Every pawn that reaches this threshold resets their search, micro-freezes the entire client and of course does it again, freezes again etc.

Thank you for the excellent bug report. I immediately knew what the cause was (and had actually already unintentionally fixed it in my in-progress development), but the save really helped me test that the fix worked - and find a couple other issues at the same time (including a Vanilla pathfinding bug!)

New Release:
Better Pathfinding v1.2
https://github.com/Zhentar/BetterPathfinding/releases/download/1.2/Better.Pathfinding.v1.2.zip
Title: Re: [A15] Better Pathfinding (v1.2 update 10/13)
Post by: Dingo on October 14, 2016, 12:31:40 AM
Thank you! Glad I could help fix some issues.
Title: Re: [A15] Better Pathfinding (v1.2 update 10/13)
Post by: Nimrod on October 14, 2016, 09:10:35 AM
I get a bug (critical error in the debugger) with v1.2 - single pawns freeze.

Happened twice - both times visitors where around (I use Hospitality)
One was a chunk-to-stockpile job, the other a steel-to-wall if I remember correctly.
when I disable BetterPathfinding the bug disappears

I am almost certain the bug comes from this mod, but of course I cant be sure if its some interaction with others (especially hospitality)

I know, I know ... debug log ...  I just wanted to play a little today, not debug (but I guess I can provide a screen if it helps) xD

Just a heads up. Great mod!
cheers!
Title: Re: [A15] Better Pathfinding (v1.2 update 10/13)
Post by: JerryBi on October 14, 2016, 10:34:41 AM
Exception ticking Dorna: System.NullReferenceException: Object reference not set to an instance of an object
  at BetterPathfinding.RegionLinkDijkstra.GetRegionDistance (Verse.Region region, Verse.RegionLink& minLink) [0x00000] in <filename unknown>:0
  at BetterPathfinding.RegionPathCostHeuristic.GetPathCostToRegion (Int32 cellIndex) [0x00000] in <filename unknown>:0
  at BetterPathfinding.PathFinder.FindPathInner (IntVec3 start, TargetInfo dest, TraverseParms traverseParms, PathEndMode peMode, HeuristicMode mode) [0x00000] in <filename unknown>:0
  at BetterPathfinding.PathFinder._FindPath (IntVec3 start, TargetInfo dest, TraverseParms traverseParms, PathEndMode peMode) [0x00000] in <filename unknown>:0
  at Verse.AI.PathFinder.FindPath (IntVec3 start, TargetInfo dest, Verse.Pawn pawn, PathEndMode peMode) [0x00000] in <filename unknown>:0
  at Verse.AI.Pawn_PathFollower.GenerateNewPath () [0x00000] in <filename unknown>:0
  at Verse.AI.Pawn_PathFollower.TrySetNewPath () [0x00000] in <filename unknown>:0
  at Verse.AI.Pawn_PathFollower.TryEnterNextPathCell () [0x00000] in <filename unknown>:0
  at Verse.AI.Pawn_PathFollower.PatherTick () [0x00000] in <filename unknown>:0
  at Verse.Pawn.Tick () [0x00000] in <filename unknown>:0
  at Verse.TickList.Tick () [0x00000] in <filename unknown>:0


pawn just froze , and error in one second was repeated more then 200 times..
Title: Re: [A15] Better Pathfinding (v1.2 update 10/13)
Post by: Nimrod on October 14, 2016, 11:03:11 AM
Quote from: masaykh on October 14, 2016, 10:34:41 AM
Exception ticking Dorna: System.NullReferenceException: Object reference not set to an instance of an object
  at BetterPathfinding.RegionLinkDijkstra.GetRegionDistance (Verse.Region region, Verse.RegionLink& minLink) [0x00000] in <filename unknown>:0
  at BetterPathfinding.RegionPathCostHeuristic.GetPathCostToRegion (Int32 cellIndex) [0x00000] in <filename unknown>:0
  at BetterPathfinding.PathFinder.FindPathInner (IntVec3 start, TargetInfo dest, TraverseParms traverseParms, PathEndMode peMode, HeuristicMode mode) [0x00000] in <filename unknown>:0
  at BetterPathfinding.PathFinder._FindPath (IntVec3 start, TargetInfo dest, TraverseParms traverseParms, PathEndMode peMode) [0x00000] in <filename unknown>:0
  at Verse.AI.PathFinder.FindPath (IntVec3 start, TargetInfo dest, Verse.Pawn pawn, PathEndMode peMode) [0x00000] in <filename unknown>:0
  at Verse.AI.Pawn_PathFollower.GenerateNewPath () [0x00000] in <filename unknown>:0
  at Verse.AI.Pawn_PathFollower.TrySetNewPath () [0x00000] in <filename unknown>:0
  at Verse.AI.Pawn_PathFollower.TryEnterNextPathCell () [0x00000] in <filename unknown>:0
  at Verse.AI.Pawn_PathFollower.PatherTick () [0x00000] in <filename unknown>:0
  at Verse.Pawn.Tick () [0x00000] in <filename unknown>:0
  at Verse.TickList.Tick () [0x00000] in <filename unknown>:0


pawn just froze , and error in one second was repeated more then 200 times..

Ha, thats the one I got too. There you go :D
Title: Re: [A15] Better Pathfinding (v1.2 update 10/13)
Post by: Zhentar on October 14, 2016, 11:43:48 AM
Thanks for reporting the issue. I'll get a fix up tonight; in the meantime I've put the 1.1 download link back in the OP.
Title: Re: [A15] Better Pathfinding (v1.2 update 10/13)
Post by: Facepunch on October 14, 2016, 05:03:27 PM
This really shoukd be in the vanilla game
Title: Re: [A15] Better Pathfinding (v1.2 update 10/13)
Post by: Zhentar on October 15, 2016, 02:53:16 AM
No fix tonight because I haven't been able to reproduce the problem. Anyone able to share a save that demonstrates it?
Title: Re: [A15] Better Pathfinding (v1.2 update 10/13)
Post by: RemingtonRyder on October 15, 2016, 05:15:55 AM
Not sure what the cause is, to be honest. I thought that maybe area restrictions mess with the pathfinding but testing hasn't turned up anything.
Title: Re: [A15] Better Pathfinding (v1.2 update 10/13)
Post by: Nimrod on October 15, 2016, 06:09:02 AM
Quote from: Zhentar on October 15, 2016, 02:53:16 AM
No fix tonight because I haven't been able to reproduce the problem. Anyone able to share a save that demonstrates it?

I will put 1.2 back in and see if I can come up with anything that narrows it down...
Title: Re: [A15] Better Pathfinding (v1.2 update 10/13)
Post by: Nimrod on October 15, 2016, 07:13:54 AM
Okay, got the error again.

I saved my game - exited the program - restarted, loaded and the error cleared - the pawn did the job that froze him without problem

Once again there where Visitor pawns on my map - Hospitality Mod was active
Are the other who see that error using Hospitality too?

Title: Re: [A15] Better Pathfinding (v1.2 update 10/13)
Post by: Nimrod on October 15, 2016, 07:28:09 AM
Just got it without visitors too.

Screenshot attached.

edit: after I unpaused the game the error cleared itself and the job continued.

edit2: it happens quite regularly now. If I draft the pawn and move him around, the error clears sometimes, sometimes it doesnt (depends if the job gets canceled I guess) - switching back to 1.1 now

edit3: exact same setup with v1.1 throws zero errors - so at least its narrowed down to "the changes you made from 1.1 to 1.2" Its something, eh? :D

[attachment deleted by admin - too old]
Title: Re: [A15] Better Pathfinding (v1.2 update 10/13)
Post by: zloitermit on October 15, 2016, 11:05:01 AM
После обновления 1.2 колонисты стали ни с то ни с сего вставать на месте, после откакта на 1.1 проблема пропала ;(


Translation through Google: After the update 1.2 Colonists began for no reason with any of this up on the spot after otkakta 1.1 problem disappeared; (


User has been sent a PM in regards to the forums being English only broken or otherwise.
Title: Re: [A15] Better Pathfinding (v1.2 update 10/13)
Post by: Zhentar on October 15, 2016, 01:52:33 PM
Quote from: Nimrod on October 15, 2016, 07:28:09 AM
edit3: exact same setup with v1.1 throws zero errors - so at least its narrowed down to "the changes you made from 1.1 to 1.2" Its something, eh? :D

I'm pretty sure I know what is happening... the problem is, by my understanding that should be impossible. I have to be wrong about at least one of those two things... from what you've posted, I'm pretty sure it's the impossible happening.

Could you guys give this version a try? It will still log an error if what I think is happening happens, but it also tries a possible fix, so hopefully your pawn can still get where they are going. Additionally, it flashes the cell(s) responsible red (with a "!!!" label); a screenshot of that would be very helpful.

[attachment deleted by admin - too old]
Title: Re: [A15] Better Pathfinding (v1.2 update 10/13)
Post by: Nimrod on October 15, 2016, 02:02:31 PM
Quote from: Zhentar on October 15, 2016, 01:52:33 PM
I'm pretty sure I know what is happening... the problem is, by my understanding that should be impossible. I have to be wrong about at least one of those two things... from what you've posted, I'm pretty sure it's the impossible happening.

Could you guys give this version a try? It will still log an error if what I think is happening happens, but it also tries a possible fix, so hopefully your pawn can still get where they are going. Additionally, it flashes the cell(s) responsible red (with a "!!!" label); a screenshot of that would be very helpful.


No problem, mate. Giving it a try now.
Feedback will follow as soon as I got something. ;)

cheers

edit: okay, I get the error again - pawns freeze and cant complete their job but there a absolutely no flashing cells ...

I am playing on the biggest map possible - may that be a factor to consider?

edit2: it seems to happen very often when my pawns want to build something...

edit3: as I said, there a no flashing cells, but for what its worth, here is a screen. The two pawns in the red circle want to get to the blue circle and have to follow the arrows. Both are frozen at this moment, the debug log shows both of them with the same error as above.

edit4: when I unpause after a long game pause (like now when I made the screenshot and post) - the error disappears and the job(s) continue as intended.

[attachment deleted by admin - too old]
Title: Re: [A15] Better Pathfinding (v1.2 update 10/13)
Post by: Zhentar on October 15, 2016, 03:39:29 PM
Hmm. Then I was wrong about what was happening; I see one other reasonable possibility. This should be a fix, then. Can you see if it works?

[attachment deleted by admin - too old]
Title: Re: [A15] Better Pathfinding (v1.2 update 10/13)
Post by: zloitermit on October 15, 2016, 09:12:36 PM
After Update 1.2 colonists became either with no rhyme or reason to get up on the spot, after returning to 1.1 problem disappeared;(
Try an updated version, then accomplish
Title: Re: [A15] Better Pathfinding (v1.2 update 10/13)
Post by: Nimrod on October 16, 2016, 02:17:07 AM
Quote from: Zhentar on October 15, 2016, 03:39:29 PM
Hmm. Then I was wrong about what was happening; I see one other reasonable possibility. This should be a fix, then. Can you see if it works?

I can and will test this tomorrow!

Thanks!
Title: Re: [A15] Better Pathfinding (v1.2 update 10/13)
Post by: Jcewazhere on October 16, 2016, 03:35:23 AM
Looks like a great mod going to try it tonight, however I had another question you might be able to answer: In some games, especially ones with big groups of mobs one unit is promoted to pathfinder and others stay near him to limit the overall pathfinding done. If the pathfinder dies a new one is promoted. Does/can Rimworld do anything like that for those 50+ tribesman raids? Would it help?
Title: Re: [A15] Better Pathfinding (v1.2 update 10/13)
Post by: JerryBi on October 16, 2016, 12:20:51 PM
Exception ticking Boomalope202125: System.IndexOutOfRangeException: Array index is out of range.
  at Verse.RegionGrid.GetRegionAt_InvalidAllowed (IntVec3 c) [0x00000] in <filename unknown>:0
  at BetterPathfinding.PathFinder+<>c.<FindPathInner>b__47_0 (IntVec3 c) [0x00000] in <filename unknown>:0
  at System.Linq.Enumerable.All[IntVec3] (IEnumerable`1 source, System.Func`2 predicate) [0x00000] in <filename unknown>:0
  at BetterPathfinding.PathFinder.FindPathInner (IntVec3 start, TargetInfo dest, TraverseParms traverseParms, PathEndMode peMode, HeuristicMode mode) [0x00000] in <filename unknown>:0
  at BetterPathfinding.PathFinder._FindPath (IntVec3 start, TargetInfo dest, TraverseParms traverseParms, PathEndMode peMode) [0x00000] in <filename unknown>:0
  at Verse.AI.PathFinder.FindPath (IntVec3 start, TargetInfo dest, Verse.Pawn pawn, PathEndMode peMode) [0x00000] in <filename unknown>:0
  at Verse.AI.Pawn_PathFollower.GenerateNewPath () [0x00000] in <filename unknown>:0
  at Verse.AI.Pawn_PathFollower.TrySetNewPath () [0x00000] in <filename unknown>:0
  at Verse.AI.Pawn_PathFollower.TryEnterNextPathCell () [0x00000] in <filename unknown>:0
  at Verse.AI.Pawn_PathFollower.PatherTick () [0x00000] in <filename unknown>:0
  at Verse.Pawn.Tick () [0x00000] in <filename unknown>:0
  at Verse.TickList.Tick () [0x00000] in <filename unknown>:0

no visitors, raiders

just boomlape froze on map
Title: Re: [A15] Better Pathfinding (v1.2 update 10/13)
Post by: Nimrod on October 16, 2016, 12:23:36 PM
Quote from: Zhentar on October 15, 2016, 03:39:29 PM
Hmm. Then I was wrong about what was happening; I see one other reasonable possibility. This should be a fix, then. Can you see if it works?

Yes, I think that fixed it! Been testing for 30 minutes now, no errors. :)
Excellent work!
Title: Re: [A15] Better Pathfinding (v1.2.1 update 10/16)
Post by: Zhentar on October 16, 2016, 09:09:40 PM
Okay, here's the 1.2.1 release: https://github.com/Zhentar/BetterPathfinding/releases/download/1.2.1/Better.Pathfinding.v1.2.1.zip

Fixes the issue reported by Nimrod et. al, and I think masaykh's issue as well.
Title: Re: [A15] Better Pathfinding (v1.2.1 update 10/16)
Post by: RemingtonRyder on October 17, 2016, 10:15:17 AM
Thanks for the update!
Title: Re: [A15] Better Pathfinding (v1.2.1 update 10/16)
Post by: JerryBi on October 18, 2016, 01:39:58 AM
bug fixed , thank you.
Title: Re: [A15] Better Pathfinding (v1.2.1 update 10/16)
Post by: biship on October 20, 2016, 06:31:54 PM
I don't know if your mod is causing this, but haven't seen this error until I installed your mod today (on a new game). Using 1.2.1.

Exception ticking Maskinnen: System.NullReferenceException: Object reference not set to an instance of an object
  at RimWorld.PawnUtility.AnyPawnBlockingPathAt (IntVec3 c, Verse.Pawn forPawn, Boolean actAsIfHadCollideWithPawnsJob, Boolean collideOnlyWithStandingPawns) [0x00000] in <filename unknown>:0
  at Verse.AI.Pawn_PathFollower.NeedNewPath () [0x00000] in <filename unknown>:0
  at Verse.AI.Pawn_PathFollower.TryEnterNextPathCell () [0x00000] in <filename unknown>:0
  at Verse.AI.Pawn_PathFollower.PatherTick () [0x00000] in <filename unknown>:0
  at Verse.Pawn.Tick () [0x00000] in <filename unknown>:0
  at Verse.TickList.Tick () [0x00000] in <filename unknown>:0


Oh, It happened while a pawn was rescuing another pawn that died in their arms! The pawn that was recusing still showed a path to the hospital bed, but the dead pawn was on the ground and the recusing pawn wasn't moving. Stuck!
Title: Re: [A15] Better Pathfinding (v1.2.1 update 10/16)
Post by: Tynan on October 22, 2016, 01:29:02 AM
Very interesting. Just from a really cursory look at the code, it looks like you're doing some kind of region-level path cost caching. Is this hierarchical pathfinding, or cost caching, or what?
Title: Re: [A15] Better Pathfinding (v1.2.1 update 10/16)
Post by: Zhentar on October 22, 2016, 11:54:34 AM
The algorithm is still the Vanilla A* algorithm, except that it will revisit closed nodes. I'm using the region system to create a high accuracy, low cost heuristic. There's actually nothing cached across pathfinding calls - I had planned to but the calculations turned out to be cheap enough that there's little need to.

The heuristic starts with an A* search (called Dijkstra in the code because I only recently added the heuristic to it) to traverse a RegionLink graph from the destination to the start, building a map of estimated costs for the regionlinks (using the octile distance between the centers of the regionlinks), and the cheapest regionlink for each region. Then, when calculating the heuristic cost for each cell, it just calculates the distance to the cheapest regionlink for the current region, and adds on the cost.
Title: Re: [A15] Better Pathfinding (v1.2.1 update 10/16)
Post by: Skyfaller on October 26, 2016, 02:35:28 PM
So I found a bug where colonists will take an inefficient, longer path with 3 autodoors just to avoid one single regular door -- even if that door is forced open. I will explain below, but first an annotated screenshot.

(http://i.imgur.com/jDU6JtA.png)

I've used the dining room as an example destination for a route path. The situation:
1. The door circled in red is a standard granite door, commanded to stay open.
2. Because the door stays open, colonists are not slowed down waiting for it to open. Colonists *should* be using the green path.
3. Colonists are actually using the yellow path in all cases - crossing 3 granite autodoors instead.
4. Solution: Replacing the regular door (red) fixes the pathfinding problem, and colonist use expected paths to their destinations again.

So the bug here is related to the force open command, I think? Does the pathfinding algorithm need to be updated to consider this?

I can provide a savegame demonstrating this issue, if you would like. The file is too big to attach to this post, but I will be happy to provide an alternative link if desired.

Hope this helps!
Title: Re: [A15] Better Pathfinding (v1.2.1 update 10/16)
Post by: Zhentar on October 26, 2016, 03:34:39 PM
Please do share the save. The heuristic does consider held/left open doors to be zero cost - and even if it didn't, it should still consider opening the door to be faster than taking that long path.
Title: Re: [A15] Better Pathfinding (v1.2.1 update 10/16)
Post by: Rock5 on October 30, 2016, 02:44:11 AM
I always thought that when it zigzagged diagonally that that meant that it would take the same amount of time as going straight, ie. they go faster diagonally to compensate.

Because of this post I did a quick test and sure enough a pawn going straight takes a lot less time than one zigzagging diagonally.

Conclusion: This mod is a must.
Title: Re: [A15] Better Pathfinding (v1.2.1 update 10/16)
Post by: Oragepoilu on October 31, 2016, 08:41:32 AM
In case someone would try to use it,

mod that add floor with hight speed (like the sensor panels from http://steamcommunity.com/sharedfiles/filedetails/?id=784370602, they give 162% speed) break this mod as an error pop up saying they search for over 160 000 cell, leaving your pawn stuck.

I didn't need more than about 10 modded tiles to have the error happen, so don't use it. (edit : I mean, don't use the tile, not this mod, it's a great one)
Title: Re: [A15] Better Pathfinding (v1.2.1 update 10/16)
Post by: Simulacrum0 on October 31, 2016, 05:13:29 PM
i'm seeing the 160000 search error as well on a 400x400 open area map that's mostly sand.
Title: Re: [A15] Better Pathfinding (v1.2.1 update 10/16)
Post by: Oragepoilu on October 31, 2016, 06:57:33 PM
yeah, I can see why it would happen on big map. however, with the modded tile my guys can't even cross sometime more than 20 square distance, so there is something wrong with this.
Title: Re: [A15] Better Pathfinding (v1.2.1 update 10/16)
Post by: Zhentar on November 03, 2016, 10:18:48 AM
Could you two test this and see if it resolves your issues? Better Pathfinding v1.3 RC (https://drive.google.com/open?id=0B_iRcVI-TJMZaHpwLV85T0o3azQ)
Title: Re: [A15] Better Pathfinding (v1.2.1 update 10/16)
Post by: Seinne on November 03, 2016, 12:59:07 PM
love this mod btw, don't think I mentioned it before. Fixes an issue that drove me nuts playing this game.
Title: Re: [A15] Better Pathfinding (v1.2.1 update 10/16)
Post by: biship on November 04, 2016, 09:47:54 AM
Better Pathfinding v1.3 RC seems to working for me. I hadn't seen any issues with the previous versions tho.
Title: Re: [A15] Better Pathfinding (v1.2.1 update 10/16)
Post by: KONO_DIO_DA on November 04, 2016, 10:14:59 AM
Ran into an interesting issue between this mod and another.
(http://i.imgur.com/C8NEgjg.jpg)

As far as I can tell, Better Pathfinding is somehow speeding up the tickrate, which reduces the cooldown of SS13 Syndicate Mod's Syndicate Minibomb Grenade to effectively zero, allowing it to become a "cone of fuck " instead of a grenade. I can confirm this issue stopped once Better Pathfinding was disabled.
Title: Re: [A15] Better Pathfinding (v1.2.1 update 10/16)
Post by: Zhentar on November 04, 2016, 04:03:23 PM
That makes absolutely no sense, but I'll check it out and see if I can find anything.
Title: Re: [A15] Better Pathfinding (v1.2.1 update 10/16)
Post by: steenhole on November 04, 2016, 08:49:39 PM
Thank you for a fantastic mod.  It is the only mod I use, and has improved my gameplay experience.

I've observed what may be an unintended consequence.  Many issues with hauling, mostly on large maps have improved.  I've been experimenting with field size, placement of storage areas, and manipulating priorities to get more efficient hauling, and have achieved some good results.  I still needed to manually adjust work priorities, and force hauling now and then using my methods.  After installing your mod, I was shocked to find the fields cleared after the last harvest without me doing anything.  (I was busy micromanaging an infestation.)
Title: Re: [A15] Better Pathfinding (v1.2.1 update 10/16)
Post by: MikeExp on November 06, 2016, 04:26:33 PM
Breaks the hospitality mod.
Title: Re: [A15] Better Pathfinding (v1.2.1 update 10/16)
Post by: Litcube on November 06, 2016, 04:51:31 PM
There's an issue with what I can only guess is "fast colonists".

One of my colonists, Peter, has a lot of bionics that puts him at 260% move speed.  I'd tell Peter to inject some Gojuice, and Peter would.  But as soon as Peter did, the game would lock up.  Not crash, just freeze completely.  No output.txt addendums.  Fuck, Peter.

So I looked into it, and had a hunch it might be this mod.  The only thing I did was disable it and try again, and boom, no lockup.  I tried it again with the mod enabled again, and lock up.

Other colonists who aren't nearly as fast as Peter can gojuice all they want with your mod no problem.

Gojuice puts Peter at 290%.
Title: Re: [A15] Better Pathfinding (v1.2.1 update 10/16)
Post by: leestriter on November 06, 2016, 06:03:28 PM
Is this compatible with britnothe experiments https://ludeon.com/forums/index.php?topic=17094.0
Title: Re: [A15] Better Pathfinding (v1.2.1 update 10/16)
Post by: EldVarg on November 06, 2016, 06:29:55 PM
Quote from: MikeExp on November 06, 2016, 04:26:33 PM
Breaks the hospitality mod.

Ah that might be why my traders flag always disappears and why visitors stop going to correct room.
Title: Re: [A15] Better Pathfinding (v1.2.1 update 10/16)
Post by: Zhentar on November 07, 2016, 12:30:51 AM
Quote from: Litcube on November 06, 2016, 04:51:31 PM
There's an issue with what I can only guess is "fast colonists".

One of my colonists, Peter, has a lot of bionics that puts him at 260% move speed.  I'd tell Peter to inject some Gojuice, and Peter would.  But as soon as Peter did, the game would lock up.  Not crash, just freeze completely.  No output.txt addendums.  Fuck, Peter.

Do you have a floor mod that makes colonists move faster? Try the 1.3 release candidate I posted a page back.


For Hospitality, can you be more specific about how it breaks? I haven't played with it so it will be difficult for me to reproduce any issues.
Title: Re: [A15] Better Pathfinding (v1.2.1 update 10/16)
Post by: MikeExp on November 07, 2016, 01:07:09 AM
NPCs normally have an additional tab where you can edit settings like whether to try to recruit them or not and stuff. This tab is completely missing. Also they choose the wrong room as guest room, not the one with the guest beds but my diningroom.
Title: Re: [A15] Better Pathfinding (v1.2.1 update 10/16)
Post by: Dave-In-Texas on November 07, 2016, 10:38:38 PM
Quote from: MikeExp on November 07, 2016, 01:07:09 AM
NPCs normally have an additional tab where you can edit settings like whether to try to recruit them or not and stuff. This tab is completely missing. Also they choose the wrong room as guest room, not the one with the guest beds but my diningroom.

I'm glad to report that I don't have this issue :)
Title: Re: [A15] Better Pathfinding (v1.2.1 update 10/16)
Post by: Alenerel on November 08, 2016, 04:39:09 AM
With this mod, do raiders will fall into paths of traps and killboxes? Or they will just try to dig? I mean, when they arent sappers.

Could you release it on steam? For lazy people.
Title: Re: [A15] Better Pathfinding (v1.2.1 update 10/16)
Post by: Canute on November 08, 2016, 06:03:19 AM
Raiders remember traps and dangerous areas by default when you let them escape, then they avoid them at the next attack.
Same with the digging, it is an anti imprision code.

The mod just let people take a faster way to the destination.
Title: Re: [A15] Better Pathfinding (v1.2.1 update 10/16)
Post by: faltonico on November 08, 2016, 06:34:21 AM
Quote from: EldVarg on November 06, 2016, 06:29:55 PM
Quote from: MikeExp on November 06, 2016, 04:26:33 PM
Breaks the hospitality mod.

Ah that might be why my traders flag always disappears and why visitors stop going to correct room.
I had Hospitality with this mod (and many others), and that never happened to me.
Title: Re: [A15] Better Pathfinding (v1.2.1 update 10/16)
Post by: skullywag on November 08, 2016, 07:10:10 AM
Load order maybe? you guys with it working...you running pathfinding after or before Hospitality?
Title: Re: [A15] Better Pathfinding (v1.2.1 update 10/16)
Post by: Seinne on November 08, 2016, 07:43:12 AM
I had Hospitality long before this, and it was high in the order, yours near the bottom, I had no issues with it. W
Title: Re: [A15] Better Pathfinding (v1.2.1 update 10/16)
Post by: faltonico on November 08, 2016, 09:40:12 AM
Quote from: skullywag on November 08, 2016, 07:10:10 AM
Load order maybe? you guys with it working...you running pathfinding after or before Hospitality?
I had Hospitality almost at the very bottom.
Title: Re: [A15] Better Pathfinding (v1.2.1 update 10/16)
Post by: Litcube on November 08, 2016, 11:58:39 AM
Quote from: Zhentar on November 07, 2016, 12:30:51 AM
Quote from: Litcube on November 06, 2016, 04:51:31 PM
There's an issue with what I can only guess is "fast colonists".

One of my colonists, Peter, has a lot of bionics that puts him at 260% move speed.  I'd tell Peter to inject some Gojuice, and Peter would.  But as soon as Peter did, the game would lock up.  Not crash, just freeze completely.  No output.txt addendums.  Fuck, Peter.

Do you have a floor mod that makes colonists move faster? Try the 1.3 release candidate I posted a page back.

I tried it and Peter still can't gojuice without freezing the game.
Title: Re: [A15] Better Pathfinding (v1.2.1 update 10/16)
Post by: Zhentar on November 08, 2016, 02:11:19 PM
Quote from: leestriter on November 06, 2016, 06:03:28 PM
Is this compatible with britnothe experiments https://ludeon.com/forums/index.php?topic=17094.0

Technically speaking, this is compatible with all mods that don't modify the pathfinding code, and as far as I know there isn't any other such mod, so this has universal compatibility.

Practically speaking, a few mods have caused bugs in my code to be encountered that wouldn't have otherwise, and it's theoretically possible that it could do the same to other mods.

This mod can be safely added to/removed from active saves, so if it does cause problems for you it can simply be disabled.


Quote from: Litcube on November 08, 2016, 11:58:39 AM
I tried it and Peter still can't gojuice without freezing the game.

Hmmm, I'll have to investigate further. Would it be possible for you to post the save, along with a zip of your mods folder?
Title: Re: [A15] Better Pathfinding (v1.2.1 update 10/16)
Post by: System.Linq on November 08, 2016, 03:23:15 PM
This is something that's always bothered me when I see my colonists taking these inane zig-zag paths around my colony and I applaud you for putting your practical programming knowledge to good use. I'm also very glad that Rimworld is so flexible as to allow a mod like this to exist.
Title: Re: [A15] Better Pathfinding (v1.2.1 update 10/16)
Post by: Litcube on November 08, 2016, 06:05:03 PM
Quote from: Zhentar on November 08, 2016, 02:11:19 PM
Hmmm, I'll have to investigate further. Would it be possible for you to post the save, along with a zip of your mods folder?

PM sent.
Title: Re: [A15] Better Pathfinding (v1.3 update 11/8)
Post by: Zhentar on November 08, 2016, 10:21:44 PM
Thanks, I was able to track down the problem. I've posted an updated release that should work for you, although Peter can sometimes take paths that are a bit funny looking.
Title: Re: [A15] Better Pathfinding (v1.3 update 11/8)
Post by: skullywag on November 09, 2016, 03:56:01 AM
Zhentar, incase you didnt see it on Discord:

Exception ticking Skullywag: System.NullReferenceException: Object reference not set to an instance of an object
  at BetterPathfinding.RegionLinkDijkstra.RegionLinkPathCostInfo (Verse.Region region, Verse.RegionLink minLink, BetterPathfinding.RegionLinkPathCostInfo& result) [0x00000] in <filename unknown>:0
  at BetterPathfinding.RegionLinkDijkstra.GetNextRegionOverDistance (Verse.Region region, System.Nullable`1& secondBest) [0x00000] in <filename unknown>:0
  at BetterPathfinding.RegionPathCostHeuristic.GetPathCostToRegion (Int32 cellIndex) [0x00000] in <filename unknown>:0
  at BetterPathfinding.PathFinder.FindPathInner (IntVec3 start, TargetInfo dest, TraverseParms traverseParms, PathEndMode peMode, HeuristicMode mode) [0x00000] in <filename unknown>:0
  at BetterPathfinding.PathFinder._FindPath (IntVec3 start, TargetInfo dest, TraverseParms traverseParms, PathEndMode peMode) [0x00000] in <filename unknown>:0
  at Verse.AI.PathFinder.FindPath (IntVec3 start, TargetInfo dest, Verse.Pawn pawn, PathEndMode peMode) [0x00000] in <filename unknown>:0
  at Verse.AI.Pawn_PathFollower.GenerateNewPath () [0x00000] in <filename unknown>:0
  at Verse.AI.Pawn_PathFollower.TrySetNewPath () [0x00000] in <filename unknown>:0
  at Verse.AI.Pawn_PathFollower.TryEnterNextPathCell () [0x00000] in <filename unknown>:0
  at Verse.AI.Pawn_PathFollower.PatherTick () [0x00000] in <filename unknown>:0
  at Verse.Pawn.Tick () [0x00000] in <filename unknown>:0
  at Verse.TickList.Tick () [0x00000] in <filename unknown>:0

this is with the 1.3 PR, is this what was fixed in the latest one.
Title: Re: [A15] Better Pathfinding (v1.3 update 11/8)
Post by: Litcube on November 09, 2016, 02:50:33 PM
Quote from: Zhentar on November 08, 2016, 10:21:44 PM
Peter can sometimes take paths that are a bit funny looking.

We all know Peter's an idiot.
Title: Re: [A15] Better Pathfinding (v1.3 update 11/8)
Post by: Alenerel on November 09, 2016, 08:11:02 PM
Im using the 1.3 RC (the one on page 5, not the 1.3 one you just uploaded, idk if they are the same) and this builder got stuck trying to build that wall you see. I saved and loaded and then he went around correctly, but drafting/undrafting didnt work to fix it before loading.

http://images.akamai.steamusercontent.com/ugc/147885146666556332/AB69CC687568C532A87B288978C45460ADAECC27/
Title: Re: [A15] Better Pathfinding (v1.3.1 update 11/9)
Post by: Zhentar on November 10, 2016, 12:55:44 AM
That sounds like the same thing skullywag encountered. I think I know what's going on, so I've released a minor update that I hope will fix it.
Title: Re: [A15] Better Pathfinding (v1.3 update 11/8)
Post by: hiepbg on November 10, 2016, 02:47:47 AM
Quote from: Alenerel on November 09, 2016, 08:11:02 PM
Im using the 1.3 RC (the one on page 5, not the 1.3 one you just uploaded, idk if they are the same) and this builder got stuck trying to build that wall you see. I saved and loaded and then he went around correctly, but drafting/undrafting didnt work to fix it before loading.

http://images.akamai.steamusercontent.com/ugc/147885146666556332/AB69CC687568C532A87B288978C45460ADAECC27/



Have the same problem with 1.3. But  drafting then undrafting can fix.
Title: Re: [A15] Better Pathfinding (v1.3.1 update 11/9)
Post by: zava on November 11, 2016, 06:21:57 AM
Hi I've been having the same getting stuck problem. Drafting didnt fix it unless you had another pawn doing the job in the meantime.

Can you implement a fallback that uses the original pathfinding should the improved one bug?

Title: Re: [A15] Better Pathfinding (v1.3.1 update 11/9)
Post by: skullywag on November 11, 2016, 07:37:29 AM
Did you try the latest version? it seems to have cleared my issue up (well I havent had it again in a few hours now)
Title: Re: [A15] Better Pathfinding (v1.3.1 update 11/9)
Post by: Litcube on November 11, 2016, 05:04:57 PM
When a raid comes, and the pawns decide to flee, some of them near doors freeze.  This causes lag to the point where I will get 1 frame per two seconds.  As the pawns die, while they're standing still, the frame rate increases.

I have a save.  Without the mod, they flee fine.  This save should still work ok with the mod packs I sent you.  If not, let me know.

https://www.dropbox.com/s/0zkycebpa6dmofi/Quicksave.rws?dl=0
Title: Re: [A15] Better Pathfinding (v1.3.1 update 11/9)
Post by: Zhentar on November 13, 2016, 12:52:21 AM
Thanks for the save, I never would have found the issue without it. The problem only occurs when you have a door within range of at least 22 turrets. I'll finish up testing it tomorrow & post the fix.
Title: Re: [A15] Better Pathfinding (v1.3.1 update 11/9)
Post by: Litcube on November 13, 2016, 12:54:33 AM
That sounds really specific!
Title: Re: [A15] Better Pathfinding (v1.3.2 update 11/13)
Post by: Zhentar on November 13, 2016, 08:48:29 PM
Indeed. I've posted the fix release now.
Title: Re: [A15] Better Pathfinding (v1.3.2 update 11/13)
Post by: Alenerel on November 13, 2016, 09:33:13 PM
In some scenarios it lags like hell, I think it gets stuck somewhere. I have experienced it two times, but it ended up solving itself before I thought of saving it.
Title: Re: [A15] Better Pathfinding (v1.3.2 update 11/13)
Post by: hiepbg on November 14, 2016, 12:43:07 PM
Sometime my colonist freeze when they build the war or haul stone block to the pending wall.
And the game start lagging.

I'm using lastest version.
Title: Re: [A15] Better Pathfinding (v1.3.2 update 11/13)
Post by: Zhentar on November 14, 2016, 01:26:48 PM
Is there anything in the dev mode log/output_log.txt?
Title: Re: [A15] Better Pathfinding (v1.3.2 update 11/13)
Post by: hiepbg on November 15, 2016, 05:00:47 AM
Quote from: Zhentar on November 14, 2016, 01:26:48 PM
Is there anything in the dev mode log/output_log.txt?

Yes.  There is it.

[attachment deleted by admin due to age]
Title: Re: [A15] Better Pathfinding (v1.3.2 update 11/13)
Post by: Zhentar on November 15, 2016, 01:44:47 PM
Looking at the code, I can't see any way this mod would cause that exception (even though it is pathing related, the exception would have to be caused by an invalid Pawn, from my understanding of it). If you share your save file & mods folder with me, I can investigate further.
Title: Re: [A15] Better Pathfinding (v1.3.2 update 11/13)
Post by: hiepbg on November 16, 2016, 01:50:57 AM
Quote from: Zhentar on November 15, 2016, 01:44:47 PM
Looking at the code, I can't see any way this mod would cause that exception (even though it is pathing related, the exception would have to be caused by an invalid Pawn, from my understanding of it). If you share your save file & mods folder with me, I can investigate further.

Sr, but i don't keep the save file.
I remember when i enable debugger option, it shows:

QuoteException ticking Camiño: System.NullReferenceException: Object reference not set to an instance of an object
  at RimWorld.PawnUtility.AnyPawnBlockingPathAt (IntVec3 c, Verse.Pawn forPawn, Boolean actAsIfHadCollideWithPawnsJob, Boolean collideOnlyWithStandingPawns) [0x00000] in <filename unknown>:0
  at Verse.AI.Pawn_PathFollower.NeedNewPath () [0x00000] in <filename unknown>:0
  at Verse.AI.Pawn_PathFollower.TryEnterNextPathCell () [0x00000] in <filename unknown>:0
  at Verse.AI.Pawn_PathFollower.PatherTick () [0x00000] in <filename unknown>:0
  at Verse.Pawn.Tick () [0x00000] in <filename unknown>:0
  at Verse.TickList.Tick () [0x00000] in <filename unknown>:0

(Filename: C:/buildslave/unity/build/artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 37)

Exception ticking Trobo: System.NullReferenceException: Object reference not set to an instance of an object
  at RimWorld.PawnUtility.AnyPawnBlockingPathAt (IntVec3 c, Verse.Pawn forPawn, Boolean actAsIfHadCollideWithPawnsJob, Boolean collideOnlyWithStandingPawns) [0x00000] in <filename unknown>:0
  at Verse.AI.Pawn_PathFollower.NeedNewPath () [0x00000] in <filename unknown>:0
  at Verse.AI.Pawn_PathFollower.TryEnterNextPathCell () [0x00000] in <filename unknown>:0
  at Verse.AI.Pawn_PathFollower.PatherTick () [0x00000] in <filename unknown>:0
  at Verse.Pawn.Tick () [0x00000] in <filename unknown>:0
  at Verse.TickList.Tick () [0x00000] in <filename unknown>:0

(Filename: C:/buildslave/unity/build/artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 37)
Title: Re: [A15] Better Pathfinding (v1.3.2 update 11/13)
Post by: katjezz on November 17, 2016, 07:52:29 AM
Same Issue here, it completely destroys my FPS down to like 3 or 4.

Quote(Filename: C:/buildslave/unity/build/artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 37)

Exception ticking Orange: System.NullReferenceException: Object reference not set to an instance of an object
  at BetterPathfinding.RegionLinkDijkstra.RegionLinkPathCostInfo (Verse.Region region, Verse.RegionLink minLink, BetterPathfinding.RegionLinkPathCostInfo& result) [0x00000] in <filename unknown>:0
  at BetterPathfinding.RegionLinkDijkstra.GetNextRegionOverDistance (Verse.Region region, System.Nullable`1& secondBest) [0x00000] in <filename unknown>:0
  at BetterPathfinding.RegionPathCostHeuristic.GetPathCostToRegion (Int32 cellIndex) [0x00000] in <filename unknown>:0
  at BetterPathfinding.PathFinder.FindPathInner (IntVec3 start, TargetInfo dest, TraverseParms traverseParms, PathEndMode peMode, HeuristicMode mode) [0x00000] in <filename unknown>:0
  at BetterPathfinding.PathFinder._FindPath (IntVec3 start, TargetInfo dest, TraverseParms traverseParms, PathEndMode peMode) [0x00000] in <filename unknown>:0
  at Verse.AI.PathFinder.FindPath (IntVec3 start, TargetInfo dest, Verse.Pawn pawn, PathEndMode peMode) [0x00000] in <filename unknown>:0
  at Verse.AI.Pawn_PathFollower.GenerateNewPath () [0x00000] in <filename unknown>:0
  at Verse.AI.Pawn_PathFollower.TrySetNewPath () [0x00000] in <filename unknown>:0
  at Verse.AI.Pawn_PathFollower.TryEnterNextPathCell () [0x00000] in <filename unknown>:0
  at Verse.AI.Pawn_PathFollower.PatherTick () [0x00000] in <filename unknown>:0
  at Verse.Pawn.Tick () [0x00000] in <filename unknown>:0
  at Verse.TickList.Tick () [0x00000] in <filename unknown>:0

(Filename: C:/buildslave/unity/build/artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 37)

Exception ticking Orange: System.NullReferenceException: Object reference not set to an instance of an object
  at BetterPathfinding.RegionLinkDijkstra.RegionLinkPathCostInfo (Verse.Region region, Verse.RegionLink minLink, BetterPathfinding.RegionLinkPathCostInfo& result) [0x00000] in <filename unknown>:0
  at BetterPathfinding.RegionLinkDijkstra.GetNextRegionOverDistance (Verse.Region region, System.Nullable`1& secondBest) [0x00000] in <filename unknown>:0
  at BetterPathfinding.RegionPathCostHeuristic.GetPathCostToRegion (Int32 cellIndex) [0x00000] in <filename unknown>:0
  at BetterPathfinding.PathFinder.FindPathInner (IntVec3 start, TargetInfo dest, TraverseParms traverseParms, PathEndMode peMode, HeuristicMode mode) [0x00000] in <filename unknown>:0
  at BetterPathfinding.PathFinder._FindPath (IntVec3 start, TargetInfo dest, TraverseParms traverseParms, PathEndMode peMode) [0x00000] in <filename unknown>:0
  at Verse.AI.PathFinder.FindPath (IntVec3 start, TargetInfo dest, Verse.Pawn pawn, PathEndMode peMode) [0x00000] in <filename unknown>:0
  at Verse.AI.Pawn_PathFollower.GenerateNewPath () [0x00000] in <filename unknown>:0
  at Verse.AI.Pawn_PathFollower.TrySetNewPath () [0x00000] in <filename unknown>:0
  at Verse.AI.Pawn_PathFollower.TryEnterNextPathCell () [0x00000] in <filename unknown>:0
  at Verse.AI.Pawn_PathFollower.PatherTick () [0x00000] in <filename unknown>:0
  at Verse.Pawn.Tick () [0x00000] in <filename unknown>:0
  at Verse.TickList.Tick () [0x00000] in <filename unknown>:0

(Filename: C:/buildslave/unity/build/artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 37)

Exception ticking Orange: System.NullReferenceException: Object reference not set to an instance of an object
  at BetterPathfinding.RegionLinkDijkstra.RegionLinkPathCostInfo (Verse.Region region, Verse.RegionLink minLink, BetterPathfinding.RegionLinkPathCostInfo& result) [0x00000] in <filename unknown>:0
  at BetterPathfinding.RegionLinkDijkstra.GetNextRegionOverDistance (Verse.Region region, System.Nullable`1& secondBest) [0x00000] in <filename unknown>:0
  at BetterPathfinding.RegionPathCostHeuristic.GetPathCostToRegion (Int32 cellIndex) [0x00000] in <filename unknown>:0
  at BetterPathfinding.PathFinder.FindPathInner (IntVec3 start, TargetInfo dest, TraverseParms traverseParms, PathEndMode peMode, HeuristicMode mode) [0x00000] in <filename unknown>:0
  at BetterPathfinding.PathFinder._FindPath (IntVec3 start, TargetInfo dest, TraverseParms traverseParms, PathEndMode peMode) [0x00000] in <filename unknown>:0
  at Verse.AI.PathFinder.FindPath (IntVec3 start, TargetInfo dest, Verse.Pawn pawn, PathEndMode peMode) [0x00000] in <filename unknown>:0
  at Verse.AI.Pawn_PathFollower.GenerateNewPath () [0x00000] in <filename unknown>:0
  at Verse.AI.Pawn_PathFollower.TrySetNewPath () [0x00000] in <filename unknown>:0
  at Verse.AI.Pawn_PathFollower.TryEnterNextPathCell () [0x00000] in <filename unknown>:0
  at Verse.AI.Pawn_PathFollower.PatherTick () [0x00000] in <filename unknown>:0
  at Verse.Pawn.Tick () [0x00000] in <filename unknown>:0
  at Verse.TickList.Tick () [0x00000] in <filename unknown>:0

(Filename: C:/buildslave/unity/build/artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 37)

Exception ticking Orange: System.NullReferenceException: Object reference not set to an instance of an object
  at BetterPathfinding.RegionLinkDijkstra.RegionLinkPathCostInfo (Verse.Region region, Verse.RegionLink minLink, BetterPathfinding.RegionLinkPathCostInfo& result) [0x00000] in <filename unknown>:0
  at BetterPathfinding.RegionLinkDijkstra.GetNextRegionOverDistance (Verse.Region region, System.Nullable`1& secondBest) [0x00000] in <filename unknown>:0
  at BetterPathfinding.RegionPathCostHeuristic.GetPathCostToRegion (Int32 cellIndex) [0x00000] in <filename unknown>:0
  at BetterPathfinding.PathFinder.FindPathInner (IntVec3 start, TargetInfo dest, TraverseParms traverseParms, PathEndMode peMode, HeuristicMode mode) [0x00000] in <filename unknown>:0
  at BetterPathfinding.PathFinder._FindPath (IntVec3 start, TargetInfo dest, TraverseParms traverseParms, PathEndMode peMode) [0x00000] in <filename unknown>:0
  at Verse.AI.PathFinder.FindPath (IntVec3 start, TargetInfo dest, Verse.Pawn pawn, PathEndMode peMode) [0x00000] in <filename unknown>:0
  at Verse.AI.Pawn_PathFollower.GenerateNewPath () [0x00000] in <filename unknown>:0
  at Verse.AI.Pawn_PathFollower.TrySetNewPath () [0x00000] in <filename unknown>:0
  at Verse.AI.Pawn_PathFollower.TryEnterNextPathCell () [0x00000] in <filename unknown>:0
  at Verse.AI.Pawn_PathFollower.PatherTick () [0x00000] in <filename unknown>:0
  at Verse.Pawn.Tick () [0x00000] in <filename unknown>:0
  at Verse.TickList.Tick () [0x00000] in <filename unknown>:0

(Filename: C:/buildslave/unity/build/artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 37)

Exception ticking Orange: System.NullReferenceException: Object reference not set to an instance of an object
  at BetterPathfinding.RegionLinkDijkstra.RegionLinkPathCostInfo (Verse.Region region, Verse.RegionLink minLink, BetterPathfinding.RegionLinkPathCostInfo& result) [0x00000] in <filename unknown>:0
  at BetterPathfinding.RegionLinkDijkstra.GetNextRegionOverDistance (Verse.Region region, System.Nullable`1& secondBest) [0x00000] in <filename unknown>:0
  at BetterPathfinding.RegionPathCostHeuristic.GetPathCostToRegion (Int32 cellIndex) [0x00000] in <filename unknown>:0
  at BetterPathfinding.PathFinder.FindPathInner (IntVec3 start, TargetInfo dest, TraverseParms traverseParms, PathEndMode peMode, HeuristicMode mode) [0x00000] in <filename unknown>:0
  at BetterPathfinding.PathFinder._FindPath (IntVec3 start, TargetInfo dest, TraverseParms traverseParms, PathEndMode peMode) [0x00000] in <filename unknown>:0
  at Verse.AI.PathFinder.FindPath (IntVec3 start, TargetInfo dest, Verse.Pawn pawn, PathEndMode peMode) [0x00000] in <filename unknown>:0
  at Verse.AI.Pawn_PathFollower.GenerateNewPath () [0x00000] in <filename unknown>:0
  at Verse.AI.Pawn_PathFollower.TrySetNewPath () [0x00000] in <filename unknown>:0
  at Verse.AI.Pawn_PathFollower.TryEnterNextPathCell () [0x00000] in <filename unknown>:0
  at Verse.AI.Pawn_PathFollower.PatherTick () [0x00000] in <filename unknown>:0
  at Verse.Pawn.Tick () [0x00000] in <filename unknown>:0
  at Verse.TickList.Tick () [0x00000] in <filename unknown>:0

(Filename: C:/buildslave/unity/build/artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 37)
Title: Re: [A15] Better Pathfinding (v1.3.2 update 11/13)
Post by: mabor0shi on November 17, 2016, 11:23:31 PM
Hey Zhentar, I want to complain too! I tried to set this thread to 'unnotify', but I keep getting notified anyway. I am always seeing people complain about this great mod and it is driving me insane. Better Pathfinding is fantastic, I'm sick of this negativity. I'm feeling very negative about it. Better Pathfinding is doing a lot of good and it's time somebody stood up and said something about it >:( I just wanted to bring some positivity to this thread.
Title: Re: [A15] Better Pathfinding (v1.3.2 update 11/13)
Post by: Seinne on November 18, 2016, 12:29:03 AM
Didn't know you were getting shit on, so I'll voice my support too. Great mod, and I never drop below 60fps ever.
Using this with at least 3 dozen mods also, no errors form this mod.
Title: Re: [A15] Better Pathfinding (v1.3.2 update 11/13)
Post by: Knedl on November 18, 2016, 03:35:25 AM
I vote for support too, this is a MUST mod so keep up the awesome work. In regards to two previous bug posts - it happened to me that when you have an area where you set up roof to be build but the pawn can't get to that tile this is what happened. So check if you have any inacessible build roof spots. Sometimes there is also an error when two pawns want to get a meal from the same tile in the same tick. My guess is that pawn wants to build roof but can't get to it. Hope it helps.
Title: Re: [A15] Better Pathfinding (v1.3.2 update 11/13)
Post by: biship on November 18, 2016, 08:01:34 AM
Best mod ever.
Title: Re: [A15] Better Pathfinding (v1.3.2 update 11/13)
Post by: hiepbg on November 18, 2016, 08:11:04 AM
Even the best software still has some bugs. Reporting bugs only make this mod greater more :D

There is no negativity here. Please do keep supporting it :D
Title: Re: [A15] Better Pathfinding (v1.3.2 update 11/13)
Post by: PaoLorenz on November 18, 2016, 08:27:01 AM
So far I did not experience anything negative... and my silly pawns stopped wading through marsh water instead of circling the small body of water to get to their destination.
I am content, by far.
Will stay alert for any potential bug, but with a "normal" PC and like 40 mods, still all works smoothly.
Thank you !
Title: Re: [A15] Better Pathfinding (v1.3.2 update 11/13)
Post by: mabor0shi on November 18, 2016, 05:28:51 PM
Quote from: hiepbg on November 18, 2016, 08:11:04 AM
Even the best software still has some bugs. Reporting bugs only make this mod greater more :D

There is no negativity here. Please do keep supporting it :D
No negativity here now :P Of course people should report bugs, but I have never seen so much reporting for one mod. I'm sure that's due to the complexity of it (Tynan even asked how it works). IMHO we should show more appreciation for the mods we like as well as report problems.
Title: Re: [A15] Better Pathfinding (v1.3.2 update 11/13)
Post by: samuk190 on November 18, 2016, 05:53:27 PM
Zhentar, you're software developer right..
Try understand this poor brazilian-english suggestion.
You can add statistics
to look better the pathfinding? Example: I will go to the kitchen. Obviously I don't need see the map again to go to the kitchen in the second time.
Except if you modify any tiles around the kitchen..
This will make the game runs smoother with much more fps. Example: 50 colonists makes alot of CPU usage trying to look for a path..
if you have saved in statistics, they will just move to the saved route location instead of finding the location from zero.
Its like route system...
The performance logic:
http://prntscr.com/d91yk9 Look the pic.
You / vanilla logic.
http://prntscr.com/d91zmd
its like you did  in the montain, but with a improved statistics for more routes...
See the difference.
I'm not software developer, I just know some logic of C++.
In this logic, the only trouble is when you modify a tile that have much paths saved in statistics. This will cause a bit lag like the vanilla but only for 5 seconds to reorganize and rebuild the path statistics.
Title: Re: [A15] Better Pathfinding (v1.3.2 update 11/13)
Post by: Zhentar on November 18, 2016, 10:11:21 PM
Caching paths is one of the approaches I considered. But ultimately, I rejected it because RimWorld isn't very well suited to it. There are a number of problems that reduce the effectiveness of it. There are different sets of rules that apply to different pawns, or the same pawns in different circumstances, so you would have to save half a dozen different types of paths, and even within a single group of pawns, the optimal path depends on the pawn's move speed (terrain adds a fixed number of ticks to the movement cost, rather than a percentage as the UI suggests, so for a luciferium enhanced bionic jogger it can be faster to take a much longer path across paved tiles, while it's faster for the stoned peg legged geezer with a bad back to cut through a swamp to move fewer tiles), and path costs are highly dynamic (holding open a door, dropping a stone chunk, etc., would affect optimal paths), so your path would be invalidated frequently. And on top of that, the most expensive paths are rarely taken; calculating the shortest path from the freezer to the dining room is easy so caching that doesn't help much.
Title: Re: [A15] Better Pathfinding (v1.3.2 update 11/13)
Post by: EldVarg on November 19, 2016, 07:16:10 PM
What he means is that he is lazy? Jk :p
Title: Re: [A15] Better Pathfinding (v1.3.2 update 11/13)
Post by: skullywag on November 20, 2016, 05:12:11 AM
Zhentar not sure its this or the mods in question but I get that same error I posted when using:

https://ludeon.com/forums/index.php?topic=27331
https://ludeon.com/forums/index.php?topic=26958

Its ALWAYS when roofs need constructing, now it could be it does it without those mods but I havent checked yet, i just get spammed with:

Exception ticking James: System.NullReferenceException: Object reference not set to an instance of an object
  at BetterPathfinding.RegionLinkDijkstra.RegionLinkPathCostInfo (Verse.Region region, Verse.RegionLink minLink, BetterPathfinding.RegionLinkPathCostInfo& result) [0x00000] in <filename unknown>:0
  at BetterPathfinding.RegionLinkDijkstra.GetNextRegionOverDistance (Verse.Region region, System.Nullable`1& secondBest) [0x00000] in <filename unknown>:0
  at BetterPathfinding.RegionPathCostHeuristic.GetPathCostToRegion (Int32 cellIndex) [0x00000] in <filename unknown>:0
  at BetterPathfinding.PathFinder.FindPathInner (IntVec3 start, TargetInfo dest, TraverseParms traverseParms, PathEndMode peMode, HeuristicMode mode) [0x00000] in <filename unknown>:0
  at BetterPathfinding.PathFinder._FindPath (IntVec3 start, TargetInfo dest, TraverseParms traverseParms, PathEndMode peMode) [0x00000] in <filename unknown>:0
  at Verse.AI.PathFinder.FindPath (IntVec3 start, TargetInfo dest, Verse.Pawn pawn, PathEndMode peMode) [0x00000] in <filename unknown>:0
  at Verse.AI.Pawn_PathFollower.GenerateNewPath () [0x00000] in <filename unknown>:0
  at Verse.AI.Pawn_PathFollower.TrySetNewPath () [0x00000] in <filename unknown>:0
  at Verse.AI.Pawn_PathFollower.TryEnterNextPathCell () [0x00000] in <filename unknown>:0
  at Verse.AI.Pawn_PathFollower.PatherTick () [0x00000] in <filename unknown>:0
  at Verse.Pawn.Tick () [0x00000] in <filename unknown>:0
  at Verse.TickList.Tick () [0x00000] in <filename unknown>:0

Let me know if I can help with repro or anything.
Title: Re: [A15] Better Pathfinding (v1.3.2 update 11/13)
Post by: Canute on November 20, 2016, 10:11:20 AM
QuoteZhentar not sure its this or the mods in question but I get that same error I posted when using:

https://ludeon.com/forums/index.php?topic=27331
https://ludeon.com/forums/index.php?topic=26958

Its ALWAYS when roofs need constructing, now it could be it does it without those mods but I havent checked yet, i just get spammed with:
I think it might be an issue with [A15] Work Smarter, the 1. link, because i use Hauling hyst. and better path. too and don't got this problems.
Title: Re: [A15] Better Pathfinding (v1.3.2 update 11/13)
Post by: samuk190 on November 20, 2016, 03:44:21 PM
Quote from: Zhentar on November 18, 2016, 10:11:21 PM
Caching paths is one of the approaches I considered. But ultimately, I rejected it because RimWorld isn't very well suited to it. There are a number of problems that reduce the effectiveness of it. There are different sets of rules that apply to different pawns, or the same pawns in different circumstances, so you would have to save half a dozen different types of paths, and even within a single group of pawns, the optimal path depends on the pawn's move speed (terrain adds a fixed number of ticks to the movement cost, rather than a percentage as the UI suggests, so for a luciferium enhanced bionic jogger it can be faster to take a much longer path across paved tiles, while it's faster for the stoned peg legged geezer with a bad back to cut through a swamp to move fewer tiles), and path costs are highly dynamic (holding open a door, dropping a stone chunk, etc., would affect optimal paths), so your path would be invalidated frequently. And on top of that, the most expensive paths are rarely taken; calculating the shortest path from the freezer to the dining room is easy so caching that doesn't help much.
Thanks for the answer... so there's a way to make the game run with more fps and taking it all circumstances? I have a fx 6350 and the game starts to be laggy after 25 colonists...
Title: Re: [A15] Better Pathfinding (v1.3.2 update 11/13)
Post by: skullywag on November 20, 2016, 03:55:28 PM
Quote from: samuk190 on November 20, 2016, 03:44:21 PM
Quote from: Zhentar on November 18, 2016, 10:11:21 PM
Caching paths is one of the approaches I considered. But ultimately, I rejected it because RimWorld isn't very well suited to it. There are a number of problems that reduce the effectiveness of it. There are different sets of rules that apply to different pawns, or the same pawns in different circumstances, so you would have to save half a dozen different types of paths, and even within a single group of pawns, the optimal path depends on the pawn's move speed (terrain adds a fixed number of ticks to the movement cost, rather than a percentage as the UI suggests, so for a luciferium enhanced bionic jogger it can be faster to take a much longer path across paved tiles, while it's faster for the stoned peg legged geezer with a bad back to cut through a swamp to move fewer tiles), and path costs are highly dynamic (holding open a door, dropping a stone chunk, etc., would affect optimal paths), so your path would be invalidated frequently. And on top of that, the most expensive paths are rarely taken; calculating the shortest path from the freezer to the dining room is easy so caching that doesn't help much.
Thanks for the answer... so there's a way to make the game run with more fps and taking it all circumstances? I have a fx 6350 and the game starts to be laggy after 25 colonists...

I would suggest deleting all your worldpawns (dead and alive) from your save, leaving your faction leaders and anyone you care about(buried colonists etc) as these worldpawns eat ticks in late game colonies.
For example I found EVERY animal ive ever sold in there, that amounted to 100s of pigs...100s. All ticking...im looking into ways of automating this.
Title: Re: [A15] Better Pathfinding (v1.3.2 update 11/13)
Post by: hiepbg on November 21, 2016, 01:49:01 AM
Quote from: skullywag on November 20, 2016, 03:55:28 PM
Quote from: samuk190 on November 20, 2016, 03:44:21 PM
Quote from: Zhentar on November 18, 2016, 10:11:21 PM
Caching paths is one of the approaches I considered. But ultimately, I rejected it because RimWorld isn't very well suited to it. There are a number of problems that reduce the effectiveness of it. There are different sets of rules that apply to different pawns, or the same pawns in different circumstances, so you would have to save half a dozen different types of paths, and even within a single group of pawns, the optimal path depends on the pawn's move speed (terrain adds a fixed number of ticks to the movement cost, rather than a percentage as the UI suggests, so for a luciferium enhanced bionic jogger it can be faster to take a much longer path across paved tiles, while it's faster for the stoned peg legged geezer with a bad back to cut through a swamp to move fewer tiles), and path costs are highly dynamic (holding open a door, dropping a stone chunk, etc., would affect optimal paths), so your path would be invalidated frequently. And on top of that, the most expensive paths are rarely taken; calculating the shortest path from the freezer to the dining room is easy so caching that doesn't help much.
Thanks for the answer... so there's a way to make the game run with more fps and taking it all circumstances? I have a fx 6350 and the game starts to be laggy after 25 colonists...

I would suggest deleting all your worldpawns (dead and alive) from your save, leaving your faction leaders and anyone you care about(buried colonists etc) as these worldpawns eat ticks in late game colonies.
For example I found EVERY animal ive ever sold in there, that amounted to 100s of pigs...100s. All ticking...im looking into ways of automating this.

How can i delete them from my save ? :D

Thanks,
Title: Re: [A15] Better Pathfinding (v1.3.2 update 11/13)
Post by: Alenerel on November 22, 2016, 06:57:05 PM
Quote from: skullywag on November 20, 2016, 03:55:28 PM
I would suggest deleting all your worldpawns (dead and alive) from your save, leaving your faction leaders and anyone you care about(buried colonists etc) as these worldpawns eat ticks in late game colonies.
For example I found EVERY animal ive ever sold in there, that amounted to 100s of pigs...100s. All ticking...im looking into ways of automating this.

Thats awful. I can understand somehow the pawns, but the animals ticking? I think that this is something that should be addressed in the game. Both pawns and animals, since long saves with this are going to have speed problems.
Title: Re: [A15] Better Pathfinding (v1.3.2 update 11/13)
Post by: Thirite on December 01, 2016, 02:46:17 AM
I got this error when a pawn was standing in an open door that was currently forbidden (click to enlarge)
(http://i.imgur.com/E8IqOHh.png)
Title: Re: [A15] Better Pathfinding (v1.3.2 update 11/13)
Post by: hoochy on December 01, 2016, 03:35:49 AM
Quote from: skullywag on November 20, 2016, 03:55:28 PM
Quote from: samuk190 on November 20, 2016, 03:44:21 PM
Quote from: Zhentar on November 18, 2016, 10:11:21 PM
Caching paths is one of the approaches I considered. But ultimately, I rejected it because RimWorld isn't very well suited to it. There are a number of problems that reduce the effectiveness of it. There are different sets of rules that apply to different pawns, or the same pawns in different circumstances, so you would have to save half a dozen different types of paths, and even within a single group of pawns, the optimal path depends on the pawn's move speed (terrain adds a fixed number of ticks to the movement cost, rather than a percentage as the UI suggests, so for a luciferium enhanced bionic jogger it can be faster to take a much longer path across paved tiles, while it's faster for the stoned peg legged geezer with a bad back to cut through a swamp to move fewer tiles), and path costs are highly dynamic (holding open a door, dropping a stone chunk, etc., would affect optimal paths), so your path would be invalidated frequently. And on top of that, the most expensive paths are rarely taken; calculating the shortest path from the freezer to the dining room is easy so caching that doesn't help much.
Thanks for the answer... so there's a way to make the game run with more fps and taking it all circumstances? I have a fx 6350 and the game starts to be laggy after 25 colonists...

I would suggest deleting all your worldpawns (dead and alive) from your save, leaving your faction leaders and anyone you care about(buried colonists etc) as these worldpawns eat ticks in late game colonies.
For example I found EVERY animal ive ever sold in there, that amounted to 100s of pigs...100s. All ticking...im looking into ways of automating this.

I saw this too. As soon as the save gets big (due to history) the game lags a lot. Didn't know they were all ticking but it makes sense. Is this fixed in A16? A tool to do it would be great otherwise.
Title: Re: [A15] Better Pathfinding (v1.3.2 update 11/13)
Post by: pinguin42 on December 07, 2016, 09:34:13 AM
I'm using 30ish mods, but this one would seem the logical cause for this (rare) issue that I'm having. Sometimes my pawns freeze in place and will not move until I either double tap the R key or prioritize a new job to them. The game does not freeze at all, just a single pawn. Their job description will say they have a task, like "hauling granite blocks to granite wall (blueprint)", but they will not actually move at all. I've seen it happen with different tasks as well, hauling, building roof, building floor. This has happened 5 times in 2 years of game time now.

I'm running Rimworld on an old computer and have noticed the game needs a second or two when spawning large groups of visitors (Hospitality mod) or trade caravans, even though I'm on a 275x275 map with only 4 pawns and a very small base (and 9 pets). I have been unable to replicate this situation at all, reloading does not make it happen again, even from an autosave that was under an hour of ingame time before. Which is why I'm thinking it might be pathfinding related, pawns will end up in a slightly different spot at a different time and not get stuck because of it.

I have not tried to let the game run when it happens, so I have no clue whether a pawn will actually starve to death when getting stuck like this or that it will prioritize eating before finishing the task it got stuck on. Will try and remember to do that if it happens again.

Anyone care to guess at what's causing this?

P.S. If you want log files, mod lists or somesuch, please tell me where to find those and the easiest way to get those to you. I'm not that tech savvy  ;)
Title: Re: [A15] Better Pathfinding (v1.3.2 update 11/13)
Post by: Zhentar on December 07, 2016, 01:13:57 PM
That sounds like what happens when pathfinding fails, though it may not be the fault of this mod; I know there's at least one case where the core reachability check fails (reported & fixed for A16). The log file should show an error message if it's the mod's fault; you can find instructions on where to get the log file here: https://ludeon.com/forums/index.php?topic=513.0
Title: Re: [A15] Better Pathfinding (v1.3.2 update 11/13)
Post by: pinguin42 on December 08, 2016, 02:50:09 PM
Here's the log: http://pastebin.com/Sp3rhixK
Title: Re: [A15] Better Pathfinding (v1.3.2 update 11/13)
Post by: Zhentar on December 09, 2016, 12:57:07 PM
Thanks. There's nothing pathfinding related in there, so I think it is a reachability issue (and therefore core, not this mod). I think for A16 I'll add in a bit more logging to help with tracking this sort of thing down.
Title: Re: [A15] Better Pathfinding (v1.3.2 update 11/13)
Post by: faltonico on December 12, 2016, 05:07:23 PM
Does any of these has anything to do with pathfinding?:
Pathfinding destination not in region, must fall back to vanilla!

(Filename: C:/buildslave/unity/build/artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 37)

Kangaroo pathing from (127, 0, 260) to (216, 0, 306) ran out of cells to process.
Job:BuildRoof A=(216, 0, 306) B=(216, 0, 306)
Faction: Villa Del Pinar

This will be the last message to avoid spam.

(Filename: C:/buildslave/unity/build/artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 37)

Exception in BreadthFirstTraverse: System.NullReferenceException: Object reference not set to an instance of an object
  at (wrapper stelemref) object:stelemref (object,intptr,object)
  at System.Collections.Generic.Queue`1[Verse.Region].Enqueue (Verse.Region item) [0x00000] in <filename unknown>:0
  at Verse.RegionTraverser+BFSWorker.QueueNewOpenRegion (Verse.Region region) [0x00000] in <filename unknown>:0
  at Verse.RegionTraverser+BFSWorker.BreadthFirstTraverseWork (Verse.Region root, Verse.RegionEntryPredicate entryCondition, Verse.RegionProcessor regionProcessor, Int32 maxRegions) [0x00000] in <filename unknown>:0
  at Verse.RegionTraverser.BreadthFirstTraverse (Verse.Region root, Verse.RegionEntryPredicate entryCondition, Verse.RegionProcessor regionProcessor, Int32 maxRegions) [0x00000] in <filename unknown>:0

(Filename: C:/buildslave/unity/build/artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 37)

It is a mess of a log and save file, and there could be various issues happening at the same time. Pawns froze, even a husky and hauler bots xD
Title: Re: [A15] Better Pathfinding (v1.3.2 update 11/13)
Post by: Zhentar on December 12, 2016, 10:05:48 PM
Two of those errors are pathfinding related, but the first of them is a "this should never happen" precondition. Something else is borked (something region system probably considering the breadfirsttraverse error), and it's killing the pathfinder.
Title: Re: [A15] Better Pathfinding (v1.3.2 update 11/13)
Post by: faltonico on December 13, 2016, 05:43:08 AM
Quote from: Zhentar on December 12, 2016, 10:05:48 PM
Two of those errors are pathfinding related, but the first of them is a "this should never happen" precondition. Something else is borked (something region system probably considering the breadfirsttraverse error), and it's killing the pathfinder.
I think it's not worth bothering you with this, i intended to "upgrade" my embrasures to a new mod, but i thought i could enable both the new one and the old one at the same time, AND a bunch of other mods.
The new embrasure ended up overriding the old one, and a shitload of exceptions exploded when i replaced a particular row of them (kind of extrange that it didn't hapen with all of them). Things got worst when i used dev mode to delete the new stuff i added, to the point the game eventually crashed -_-'
(on a side note, this is not related to that  other crash i posted somewhere else).

btw, Thank you for the mod!, i have used it so much that i forgot how is vanilla behavior xD
Title: Re: [A15] [A16] Better Pathfinding (v1.4RC1 update 12/12)
Post by: faltonico on December 17, 2016, 07:30:06 AM
Welp,
I have to apologize to Tynan,
I was absolutely certain that it was his fault for not making the game 64-bit, but i managed to replicate a crash involving a memory leak and your mod.
I'll send you everything i got:
Save: https://www.sendspace.com/file/5ngr74
Config folder: https://www.sendspace.com/file/qwyu4k
Mods used (virgin core included): https://www.sendspace.com/file/hd3v00
Crash log and output log: https://www.sendspace.com/file/pff5oj

The only thing you have to do to replicate the crash is to restrict the pawns to the area "cleaner bots", (i haven't tested if you need to do that to replicate the crash but that is what i did). Follow the pawn "Giannini", and as soon as she finishes his early coffee, the crash happens.
Don't even bother with the +100 angry mechanoids raiding the base... they will not get past the first line of defense.
Played it again without your mod on, and it got past that point, and the memory usage was almost 1 GB less.

I find it even amazing that the pawns behave kind of different without your mod on.
Anyways, i don't know if it is a incompatibility with another mod (high chances it might be with that many mods), but i do hope you could tell me, you do know how to read crash logs xD

On a side note, feel free to correct any mistakes in my English, is not my first language (I'll appreciate it ;) ).

EDIT: The red error on load is from the "Orassan empire" mod, i refused to update it to full furry, but i needed the EPOE patch that came later. If that is the source of all my problems please tell me.
Title: Re: [A15] [A16] Better Pathfinding (v1.4RC1 update 12/12)
Post by: Rock5 on December 17, 2016, 07:38:44 AM
Um... I don't think you need to apologize that English is not your first language. You speak it like a native. :) I never would have guessed if you hadn't mentioned it.
Title: Re: [A15] [A16] Better Pathfinding (v1.4RC1 update 12/12)
Post by: faltonico on December 17, 2016, 08:19:45 AM
Quote from: Rock5 on December 17, 2016, 07:38:44 AM
Um... I don't think you need to apologize that English is not your first language. You speak it like a native. :) I never would have guessed if you hadn't mentioned it.
Great to know *blush*
Title: Re: [A15] [A16] Better Pathfinding (v1.4RC1 update 12/12)
Post by: Fafn1r on December 17, 2016, 08:29:02 AM
Quote from: faltonico on December 17, 2016, 07:30:06 AM
Don't even bother with the +100 angry mechanoids raiding the base... they will not get past the first line of defense.

I just wanted to say that this sounded really badass. Posting a save with crash report. What? Are there hundred mechanoids raiding my base? I didn't even realize, it must be tuesday, pay no attention to them them. :D
Title: Re: [A15] [A16] Better Pathfinding (v1.4RC1 update 12/12)
Post by: faltonico on December 17, 2016, 08:30:53 AM
Quote from: Fafn1r on December 17, 2016, 08:29:02 AM
Quote from: faltonico on December 17, 2016, 07:30:06 AM
Don't even bother with the +100 angry mechanoids raiding the base... they will not get past the first line of defense.

I just wanted to say that this sounded really badass. Posting a save with crash report. What? Are there hundred mechanoids raiding my base? I didn't even realize, it must be tuesday, pay no attention to them them. :D
I would tell you about the 1100 tribal raid... but that would be too boring.
Title: Re: [A15] [A16] Better Pathfinding (v1.4RC1 update 12/12)
Post by: joaonunes on December 17, 2016, 01:20:48 PM
Error report:
When building walls I randomly get an error that keeps spamming and pulling away all of the processing power unless I draft the pawn causing the error. The error shown is the exact same "Thirite" posted on his screenshot, except in my case it happened when building walls...
(http://i1107.photobucket.com/albums/h384/JOHNFIRE/exception_pathfinding.png)


I have the following mod order:

    <li>Core</li>
    <li>LessIncidentTrolling</li>
    <li>BalancingAct</li>
    <li>Grenade Fix Rearmed</li>
    <li>Less-Rebuff</li>
    <li>Stonecutting Tweak</li>
    <li>WanderDontDrop</li>
    <li>Better Pathfinding</li>
    <li>Refactored Work Priorities</li>
    <li>Hand Me That Brick</li>
    <li>PetFollow</li>
    <li>Efficient Light</li>
    <li>More Factions Spawn</li>
    <li>CombatReadinessCheck</li>
    <li>MarvsCRC_DoublePopAddon</li>
    <li>FluffierThanThou-RW_Manager-ae03913</li>
    <li>FluffierThanThou-RW_EnhancedTabs-f5e58d9</li>
    <li>FluffierThanThou-RW_MedicalInfo-62a1705</li>
    <li>kNumbers-0.5.2-A15</li>
    <li>RW_ColonistBarKF-0.15.3.2</li>
    <li>RW_Outfitter-0.15.3</li>
    <li>MadSkills-A15-1.1.7-T</li>
    <li>[A15] Expanded Traits 1.4</li>
    <li>[A15] Realistic Darkness</li>
    <li>AMC(1) DE Surgeries</li>
    <li>AMC(1) ExpandedProsthetics&amp;OrganEngineering</li>
    <li>AMC(2) ADogSaid</li>
    <li>AMC(2) Chemicals &amp; Neutroamine</li>
    <li>AMC(2) EmergencyTreatment</li>
    <li>AMC(2) Improved Surgery</li>
    <li>AMC(2) Medical Training</li>
    <li>AMC(2) Realistic Medical System EPOE Version</li>
    <li>AMC(3) Compatibility patch_ADog &amp; ISurgery</li>
    <li>AMC(3) Compatibility patch_DESurgery &amp; ISurgery</li>
    <li>AMC(3) Compatibility patch_EPOE &amp; ISurgery</li>
    <li>AMC(4) Compatibility patch_EPOE Realiistic Medical &amp; ISurgery</li>
    <li>JTEfficientBatteries</li>
    <li>JTReplaceWalls</li>
    <li>Medical Training</li>
    <li>Apparello</li>
    <li>FashionRIMsta</li>
    <li>RTFTJ</li>
    <li>TradingSpot</li>
    <li>TimerSwitches</li>
    <li>TilledSoil-0.15.1280</li>
    <li>TargetPractise</li>
    <li>sd_power</li>
    <li>AllowTool</li>
    <li>CrashLanding</li>
    <li>Bulk_Meals</li>
    <li>DefensivePositions</li>
    <li>ED-LaserDrill</li>
    <li>ED-ReverseCycleCooler</li>
    <li>ED-ShieldsBasic</li>
    <li>CP</li>
    <li>CPD</li>
    <li>Vegetable Garden</li>
    <li>ADDON_Soda Garden v15</li>
    <li>Animal Feed Trough V1.1 A15 [V.G.]</li>
    <li>AJO</li>
    <li>EXP</li>
    <li>QRY</li>
    <li>ExtendedStorage-ExtendedStorage1.12</li>
    <li>RimFridge</li>
    <li>RT_Fuse-A15-1.0.3</li>
    <li>RT_SolarFlareShield-A15-1.0.6</li>
    <li>RumoursAndDeception</li>
    <li>VeinMiner</li>
    <li>Improved Increased Stack</li>
    <li>CraftingHysteresis</li>
    <li>RW_FacialStuff-0.15.3.1</li>
    <li>Mending</li>
    <li>Hospitality</li>
    <li>DoIT</li>
    <li>BigBatterys</li>
    <li>Organ thoughts</li>
    <li>20th Century Weapons Mod (20CWМ)</li>
    <li>High Caliber</li>
    <li>LT_DoorMat</li>
    <li>TrueMods - immersive balance - cosmetic - armor vest cost fix</li>
    <li>TrueMods - immersive balance - cosmetic - foxes and wolves comfortable temperature fix</li>
    <li>TrueMods - immersive balance - cosmetic - no medicine for hospital bed</li>
    <li>TrueMods - immersive balance - cosmetic - vitals monitor resources mod</li>
    <li>No more random death</li>
    <li>AC-Work Tab</li>
    <li>ICanFixIt</li>
    <li>SillyBuilder</li>


The mods I think could be related to the error are those:
- Refactored Work Priorities
- Hand Me That Brick
- JTReplaceWalls

Is there any known incompatibility with any of the mods I'm using? Or has this issue already been discussed elsewhere?

This is the wall I've been trying to build for example...
(http://i1107.photobucket.com/albums/h384/JOHNFIRE/damnwall.png)
Exception appears mostly when carrying the resources to the spot, if I manually force the pawn to build the wall the exception does not occur...

EDIT: added screenshots of my own as it kept happening again...
Title: Re: [A15] [A16] Better Pathfinding (v1.4RC1 update 12/12)
Post by: Zhentar on December 19, 2016, 12:06:29 AM
Quote from: faltonico on December 17, 2016, 07:30:06 AM
Welp,
I have to apologize to Tynan,
I was absolutely certain that it was his fault for not making the game 64-bit, but i managed to replicate a crash involving a memory leak and your mod.

Technically, it's actually an infinite loop (containing a memory allocation), not a memory leak. But the end result is an out of memory crash either way, so that's just semantics.

I'll have a fix up in a day or two.
Title: Re: [A15] [A16] Better Pathfinding (v1.4RC1 update 12/12)
Post by: faltonico on December 19, 2016, 04:35:58 AM
Quote from: Zhentar on December 19, 2016, 12:06:29 AM
Technically, it's actually an infinite loop (containing a memory allocation), not a memory leak. But the end result is an out of memory crash either way, so that's just semantics.
I told you you were the one who knew how to read logs xD
Thanks a lot!
Now that i disabled the mod, I had to be remembered of that unsightly view of my pawns zigzagging all over the place. I'll really appreciate you fixing it as soon as you can, but take your time, we are in holidays anyways.
Title: Re: [A15] [A16] Better Pathfinding (v1.4RC1 update 12/12)
Post by: joaonunes on December 19, 2016, 05:53:19 AM
Zhentar, any idea regarding my issue or you need more data?
Title: Re: [A15] [A16] Better Pathfinding (v1.4RC1 update 12/12)
Post by: Zhentar on December 19, 2016, 10:31:45 AM
I've got enough data. Haven't decided on how I'm going to resolve it yet... I might just make the code responsible stop existing, but I have to do some more testing first.
Title: Re: [A15] [A16] Better Pathfinding (v1.4RC1 update 12/12)
Post by: joaonunes on December 19, 2016, 11:12:45 AM
Quote from: Zhentar on December 19, 2016, 10:31:45 AM
I've got enough data. Haven't decided on how I'm going to resolve it yet... I might just make the code responsible stop existing, but I have to do some more testing first.

Alright, thanks for the reply :)
Title: Re: [A15] [A16] Better Pathfinding (v1.4RC1 update 12/12)
Post by: tirramissu on December 20, 2016, 10:01:43 AM
This is AWESOME!!!
Thank you!
Title: Re: [A15] [A16] Better Pathfinding (v1.4RC1 update 12/12)
Post by: Kadjunga on December 21, 2016, 05:13:38 AM
For some reasons, my pawns are "teleporting" around the base on higher loads. Had a pack of manhunters spawn on a far side of the map and while going into the defensive positions, the pawns randomly teleported around in a 5-10 tile radius of where they were moving. Looked odd as hell, but eventually when the manhunters got their "path" straight, everything went back to normal.

Not sure how to upload the savefile / log though
Title: Re: [A15] [A16] Better Pathfinding (v1.4 update 12/21)
Post by: Zhentar on December 21, 2016, 06:26:13 PM
I've uploaded a new A16 version which fixes some bugs and improves performance.
Title: Re: [A15] [A16] Better Pathfinding (v1.4 update 12/21)
Post by: Facepunch on December 21, 2016, 08:22:12 PM
This is a sexy mod.
Title: Re: [A15] [A16] Better Pathfinding (v1.4 update 12/21)
Post by: Palypso on December 22, 2016, 04:19:28 PM
I get some trippy visuals probably thanks to this mod: https://i.imgur.com/yVIg9FL.png https://i.imgur.com/xPCGyGf.png
removing the mod fixed it
Title: Re: [A15] [A16] Better Pathfinding (v1.4 update 12/21)
Post by: joaonunes on December 22, 2016, 04:58:25 PM
Quote from: Palypso on December 22, 2016, 04:19:28 PM
I get some trippy visuals probably thanks to this mod: https://i.imgur.com/yVIg9FL.png https://i.imgur.com/xPCGyGf.png
removing the mod fixed it

That looks like the dev mode for this mod... How did you even activate it? Downloaded the experimental release from github instead of the release? XD
Title: Re: [A15] [A16] Better Pathfinding (v1.4 update 12/21)
Post by: Zhentar on December 22, 2016, 05:02:13 PM
You can manually enable it by going into Dev Mode, and enabling 'Draw Paths' in the Dev Mode View Settings screen. It will persist even if you turn off Dev Mode, but it shouldn't persist if you close & reopen the game.

My debug builds turn that on automatically to save me a couple clicks, but I checked the 1.4 I uploaded and it's definitely not a debug build.
Title: Re: [A15] [A16] Better Pathfinding (v1.4 update 12/21)
Post by: joaonunes on December 22, 2016, 05:06:44 PM
Quote from: Zhentar on December 22, 2016, 05:02:13 PM
You can manually enable it by going into Dev Mode, and enabling 'Draw Paths' in the Dev Mode View Settings screen. It will persist even if you turn off Dev Mode, but it shouldn't persist if you close & reopen the game.

My debug builds turn that on automatically to save me a couple clicks, but I checked the 1.4 I uploaded and it's definitely not a debug build.

Hummm... Good to know how to activate it
(*evil laughter*)
Title: Re: [A15] [A16] Better Pathfinding (v1.4 update 12/21)
Post by: Zakhad on December 23, 2016, 05:06:10 AM
Anyone else getting horrible animal path finding lag when they're confined to a location? The animals keep trying to search for a path to food but unable to, due to confinement but that calculation keeps happening and it lags the entire game down, as soon as I put food in the room or the animals go to sleep or die the lag disappears :S
Title: Re: [A15] [A16] Better Pathfinding (v1.4 update 12/21)
Post by: Zhentar on December 23, 2016, 04:48:57 PM
Can you share a save or a screenshot of your setup?
Title: Re: [A15] [A16] Better Pathfinding (v1.4 update 12/21)
Post by: Zakhad on December 23, 2016, 10:08:28 PM
Quote from: Zhentar on December 23, 2016, 04:48:57 PM
Can you share a save or a screenshot of your setup?

You're mod was not at fault sorry for the accusation it was WM smarter food selection. Ty for being helpful, I would have posted a save but then you'd need all the mods, and at the time I wasn't even able to get into my save due to a mod update requiring me to change my load order, which took a while to figure out*.

*When I was trying to figure out this problem with the animal pathfinding lag, I disabled BetterPathfinding and because it needed to update my mod load order it made my at the time current load order incompatible disabling all my mods (Due to another mod auto update via steam - Really odd bug :P I was somehow playing with a broken load order)
Title: Re: [A15] [A16] Better Pathfinding (v1.4 update 12/21)
Post by: Knedl on December 28, 2016, 06:20:00 PM
I am hunting for a bug that crashes the game. Could this part be related to this mod? Like deer spawned inside a mountain or something like that and causes the crash?

Exception ticking Deer79462: System.OutOfMemoryException: Out of memory
  at (wrapper managed-to-native) object:__icall_wrapper_mono_array_new_specific (intptr,int)
  at System.Array.Resize[IntVec3] (Verse.IntVec3[]& array, Int32 length, Int32 newSize) [0x00000] in <filename unknown>:0
  at System.Array.Resize[IntVec3] (Verse.IntVec3[]& array, Int32 newSize) [0x00000] in <filename unknown>:0
  at System.Collections.Generic.List`1[Verse.IntVec3].set_Capacity (Int32 value) [0x00000] in <filename unknown>:0
  at System.Collections.Generic.List`1[Verse.IntVec3].GrowIfNeeded (Int32 newCount) [0x00000] in <filename unknown>:0
  at System.Collections.Generic.List`1[Verse.IntVec3].Add (IntVec3 item) [0x00000] in <filename unknown>:0
  at Verse.AI.PawnPath.AddNode (IntVec3 nodePosition) [0x00000] in <filename unknown>:0
  at BetterPathfinding.NewPathFinder.FinalizedPath () [0x00000] in <filename unknown>:0
  at BetterPathfinding.NewPathFinder.FindPathInner (IntVec3 start, LocalTargetInfo dest, TraverseParms traverseParms, PathEndMode peMode, HeuristicMode mode) [0x00000] in <filename unknown>:0
  at BetterPathfinding.NewPathFinder.FindPath (IntVec3 start, LocalTargetInfo dest, TraverseParms traverseParms, PathEndMode peMode) [0x00000] in <filename unknown>:0
  at BetterPathfinding.PathFinderDetour.FindPath (Verse.AI.PathFinder this, IntVec3 start, LocalTargetInfo dest, TraverseParms traverseParms, PathEndMode peMode) [0x00000] in <filename unknown>:0
  at Verse.AI.PathFinder.FindPath (IntVec3 start, LocalTargetInfo dest, Verse.Pawn pawn, PathEndMode peMode) [0x00000] in <filename unknown>:0
  at Verse.AI.Pawn_PathFollower.GenerateNewPath () [0x00000] in <filename unknown>:0
  at Verse.AI.Pawn_PathFollower.TrySetNewPath () [0x00000] in <filename unknown>:0
  at Verse.AI.Pawn_PathFollower.TryEnterNextPathCell () [0x00000] in <filename unknown>:0
  at Verse.AI.Pawn_PathFollower.PatherTick () [0x00000] in <filename unknown>:0
  at Verse.Pawn.Tick () [0x00000] in <filename unknown>:0
  at Verse.TickList.Tick () [0x00000] in <filename unknown>:0
Title: Re: [A15] [A16] Better Pathfinding (v1.4 update 12/21)
Post by: Zhentar on December 29, 2016, 11:54:30 AM
Are you using the lastest version? The "RC1" version I posted before the official A16 release had a bug that could cause that, but it should have been resolved.
Title: Re: [A15] [A16] Better Pathfinding (v1.4 update 12/21)
Post by: Knedl on December 29, 2016, 12:18:16 PM
Zhentar thank you for reply! I see I have a 1.4RC version (downloaded 20. Dec) and have now downloaded the last one (ver. 1.3.2.). Will test and I hope I won't report anything back which means it runs fine :) Using approx. 70 mods, made some changes to mods to kill the bugs but this one was above my knowledge of coding.

Thank you for your awesome work on this mod!

EDIT: I wrote versions because if was strange to me that the ver. nr. I downloaded was lower that the one I had. No freaking idea how I did that but sure I got a crash since it's for A15 lol. Downloaded again now and it's the 1.4. ver. so I am going for it again lol. Anyway I'am posting this just to let you know that about.xml should be changed to .1393.
Title: Re: [A15] [A16] Better Pathfinding (v1.4 update 12/21)
Post by: terrordrone_nl on December 30, 2016, 12:46:56 PM
Playing on a large sized Large Hills map, my game freezes every few seconds. Decided to check out the logs and found the following line repeating whenever the game stuttered:
QuoteAlphabeaver217069 pathing from (287, 0, 239) to (90, 0, 96) hit search limit of 160000 cells.
Not sure if your mod messes with animal pathing. The Alphabeaver that's causing the issue arrived in a group of ~12 beavers, and Self-tamed after a small while. Another beaver in the group also self-tamed, and he walked to my base just fine. There's an animal zone in my base that I assigned the beavers to. 
Full debug log can be found at https://gist.github.com/HugsLibRecordKeeper/e369c6d79941902b13dfb3ab45f52dd1
Haven't tested it just yet, but I'll butcher the beaver later to see if it stops the errors. I suspect it will, since the stuttering stopped when it fell asleep.
If your mod doesn't mess with animal pathing, let me know and I'll hit up the official bug reports sections. 

Edit: enabled "Draw Paths" in the dev mode options, game crashed when it checked pathing again. Output.log is claiming a stackoverflow exception:
QuoteException ticking Alphabeaver217069: System.StackOverflowException: The requested operation caused a stack overflow.
  at BetterPathfinding.NewPathFinder.FindPathInner (IntVec3 start, LocalTargetInfo dest, TraverseParms traverseParms, PathEndMode peMode, HeuristicMode mode) [0x00000] in <filename unknown>:0
  at BetterPathfinding.NewPathFinder.FindPath (IntVec3 start, LocalTargetInfo dest, TraverseParms traverseParms, PathEndMode peMode) [0x00000] in <filename unknown>:0
  at BetterPathfinding.PathFinderDetour.FindPath (Verse.AI.PathFinder this, IntVec3 start, LocalTargetInfo dest, TraverseParms traverseParms, PathEndMode peMode) [0x00000] in <filename unknown>:0
  at Verse.AI.PathFinder.FindPath (IntVec3 start, LocalTargetInfo dest, Verse.Pawn pawn, PathEndMode peMode) [0x00000] in <filename unknown>:0
  at Verse.AI.Pawn_PathFollower.GenerateNewPath () [0x00000] in <filename unknown>:0
  at Verse.AI.Pawn_PathFollower.TrySetNewPath () [0x00000] in <filename unknown>:0
  at Verse.AI.Pawn_PathFollower.TryEnterNextPathCell () [0x00000] in <filename unknown>:0
  at Verse.AI.Pawn_PathFollower.PatherTick () [0x00000] in <filename unknown>:0
  at Verse.Pawn.Tick () [0x00000] in <filename unknown>:0
  at Verse.TickList.Tick () [0x00000] in <filename unknown>:0
Title: Re: [A15] [A16] Better Pathfinding (v1.4 update 12/21)
Post by: Zhentar on December 30, 2016, 01:02:01 PM
It's definitely caused by this mod. Which biome? Can you post the save, or at least a screenshot of the map?

And I'm disappointed to hear that draw paths crash is happening to other people too :( It doesn't make any sense...
Title: Re: [A15] [A16] Better Pathfinding (v1.4 update 12/21)
Post by: terrordrone_nl on December 30, 2016, 01:36:31 PM
Map is too big for screenshots, unless there's a way to zoom out even more.
It's a mountainous Boreal Forest map with size Large.
Onedrive link to save-file: https://1drv.ms/u/s!AnKrUiQqz90DgYh6Ka6Hlj-GHl_o1Q
You'll find my base on the south-west edge of the map, with the bugged alphabeaver near the north-eastern part of the map. Alphabeaver is called "Alphabeaver 2."
You can see the modlist in the debug log I posted earlier, although you shouldn't need any of those mods to load this file.
Title: Re: [A15] [A16] Better Pathfinding (v1.4 update 12/21)
Post by: Zhentar on December 30, 2016, 02:02:50 PM
Bah, Boreal Forests are such troublemakers. Thanks, that should be enough to figure it out.

As an easy workaround, you could set up a new allowed area that's about half way to your base, and assign the problem beaver to it. Once the beaver is closer it should be able to path to your base successfully.
Title: Re: [A15] [A16] Better Pathfinding (v1.4 update 12/21)
Post by: terrordrone_nl on December 30, 2016, 02:21:03 PM
I butchered the Beaver and went on with life already. Killing that which gives you problems seems to always work in Rimworld.
Title: Re: [A15] [A16] Better Pathfinding (v1.4 update 12/21)
Post by: Devdisigdu on January 06, 2017, 01:25:37 PM
So I've recently been getting some problems on my current save of about 50 hours playtime, where Pawns are trying to path towards something they can't get to. Sometimes it's been colonist trying to remove a roof that's behind a wall, which I can solve by removing the remove roof designation on the area, but the current issue is my hauling huskies. They keep trying to haul things like psychic insanity lances or luciferium that's in one of those ancient vaults hidden in a mountain. The warning seems to indicate that it's Better Pathfinding that is trying to path them towards the object which is unreachable.

Is this a Better Pathfinding problem, or is it Rimworld and it's just your code being used to try and make the path?

Husky3305881 pathing from (177, 0, 154) to Thing_Luciferium96719 ran out of cells to process.
Job:HaulToCell A=Thing_Luciferium96719 B=(182, 0, 191)
Faction: Hastur's Will

This will be the last message to avoid spam.
Verse.Log:Warning(String)
BetterPathfinding.NewPathFinder:FindPathInner(IntVec3, LocalTargetInfo, TraverseParms, PathEndMode, HeuristicMode)
BetterPathfinding.NewPathFinder:FindPath(IntVec3, LocalTargetInfo, TraverseParms, PathEndMode)
BetterPathfinding.PathFinderDetour:FindPath(PathFinder, IntVec3, LocalTargetInfo, TraverseParms, PathEndMode)
Verse.AI.PathFinder:FindPath(IntVec3, LocalTargetInfo, Pawn, PathEndMode)
Verse.AI.Pawn_PathFollower:GenerateNewPath()
Verse.AI.Pawn_PathFollower:TrySetNewPath()
Verse.AI.Pawn_PathFollower:TryEnterNextPathCell()
Verse.AI.Pawn_PathFollower:PatherTick()
Verse.Pawn:Tick()
Verse.TickList:Tick()
Verse.TickManager:DoSingleTick()
Verse.TickManager:TickManagerUpdate()
Verse.Game:Update()
Verse.Root_Play:Update()


In the meantime I can stop the errors and keep the save going by finding where the items are and making a path, but I would hope this is something that can be stopped from occurring.
Title: Re: [A15] [A16] Better Pathfinding (v1.4 update 12/21)
Post by: Zhentar on January 06, 2017, 02:42:51 PM
The pathfinder is just looking for a path to where it was told to go. It does try to catch errors like that with a reachability check, but it's doing the same check hauling assignment does so they probably both get the same (wrong) answer. You'd very likely get the exact same error with the vanilla pathfinder.

That said, I enjoy investigating & reporting Vanilla bugs occasionally, so if you can share your save & mods folder, I can take a look at it.
Title: Re: [A15] [A16] Better Pathfinding (v1.4 update 12/21)
Post by: Devdisigdu on January 06, 2017, 04:02:58 PM
Given that a lot of my mods are from the Steam workshop, what would be the best way to go about that?

Would copying the workshop mods into the same zip as the non workshop mods and sending you the Mods Config as well work?

Edit: Here, The mods, the save and my config file.
https://www.dropbox.com/s/thtvmgx8m9isnxt/Hauling%20Problems.zip?dl=0
Title: Re: [A15] [A16] Better Pathfinding (v1.4 update 12/21)
Post by: Degraine on January 06, 2017, 05:19:09 PM
I have had an issue trying to remove this mod (the positioning of the menu button was driving me batty): Namely, the menu still appears when the mod has been uninstalled and I've restarted the game. On save files that I never saved with the mod enabled. How can I fix this?

Herp derp, never mind, stupid mod user doesn't know which mod is responsible for what. (It's PathAvoid)
Title: Re: [A15] [A16] Better Pathfinding (v1.4 update 12/21)
Post by: Zhentar on January 07, 2017, 03:37:13 PM
Quote from: terrordrone_nl on December 30, 2016, 01:36:31 PM
Map is too big for screenshots, unless there's a way to zoom out even more.
It's a mountainous Boreal Forest map with size Large.
Onedrive link to save-file: https://1drv.ms/u/s!AnKrUiQqz90DgYh6Ka6Hlj-GHl_o1Q
You'll find my base on the south-west edge of the map, with the bugged alphabeaver near the north-eastern part of the map. Alphabeaver is called "Alphabeaver 2."
You can see the modlist in the debug log I posted earlier, although you shouldn't need any of those mods to load this file.

I had an epiphany yesterday. A tiny little one line tweak, and now Alphabeaver 2 finds a path in just 15,000 nodes... a pretty big step up from over 160,000. It also fixed all the weird pathing I was seeing on sea ice, and improved performance in a lot of common cases too. I've posted an update with the change (and another fix) now.
Title: Re: [A15] [A16] Better Pathfinding (v1.4.1 update 1/7)
Post by: dinokilla7 on January 08, 2017, 09:30:28 AM
I've been playing with your mod for a while, because hell I like the idea of it and it really saves time. But when I opened my game today I noticed a flash of red, green, orange tiles. So I slowed the game down and noticed I could visually see the path calculation of my pawn and I was wondering if theres a way to switch this off?
Title: Re: [A15] [A16] Better Pathfinding (v1.4.1 update 1/7)
Post by: Zhentar on January 08, 2017, 09:49:52 AM
The current version shouldn't do that automatically, so updating should fix it. But it can be disabled/enabled using the Draw Paths option in the Dev Mode view options.
Title: Re: [A15] [A16] Better Pathfinding (v1.4.1 update 1/7)
Post by: System.Linq on January 08, 2017, 10:05:41 AM
I've noticed that my pawns still sometimes take weird paths through open areas, zig-zagging when a straight line would seem to be more efficient. Is there any reason for that?

P.S. Fantastic mod, love it.
Title: Re: [A15] [A16] Better Pathfinding (v1.4.1 update 1/7)
Post by: terrordrone_nl on January 08, 2017, 10:31:00 AM
Quote from: Psychology on January 08, 2017, 10:05:41 AM
I've noticed that my pawns still sometimes take weird paths through open areas, zig-zagging when a straight line would seem to be more efficient. Is there any reason for that?

P.S. Fantastic mod, love it.

This is where, if you're curious, you enable the dev options and turn on "draw Paths". It should show you why the system thinks that path is the best. Remember that for example trees and certain floors reduce movespeed.
Title: Re: [A15] [A16] Better Pathfinding (v1.4.1 update 1/7)
Post by: Zhentar on January 08, 2017, 11:39:44 AM
Quote from: Psychology on January 08, 2017, 10:05:41 AM
I've noticed that my pawns still sometimes take weird paths through open areas, zig-zagging when a straight line would seem to be more efficient. Is there any reason for that?

Yes, there is.


You probably want to know what that reason is? In 1.4, I took a page from Vanilla's pathfinding book and added a weighting to the heuristic. Now, it will accept paths that are about 5% longer than what it estimates is the optimal path. Most of the time, there are at least a few things in the way (like trees or items), and it underestimates by at least a few percent. When it does underestimate, it can spend a ton of time looking for the perfect path, so letting it say 'eh, good enough' can significantly improve performance (I know performance has been fine for most people, but there were some really bad edge cases so I couldn't honestly say I thought it was good enough to be the Vanilla pathfinder). But when there isn't anything in the way, it doesn't underestimate at all (sometimes it even slightly overestimates), in which case 5% allows for a lot of zig zags (I know it was really bad on sea ice and probably ice sheets too)

The 1.4.1 update I posted yesterday addresses the reason why it thought the zig-zaggy paths might be good and tried that before trying to just go straight. That improves performance and fixes most of the zig zags. If you're still seeing funny looking paths on that, post a screenshot and I'll investigate.
Title: Re: [A15] [A16] Better Pathfinding (v1.4.1 update 1/7)
Post by: Rock5 on January 13, 2017, 05:29:46 AM
This looks like an obvious misspathing. The optimum path looks to be under that little hill in the middle. Instead it goes up, after rounding the mountain, instead of searching in a straight line to the target.

Using version 1.4.1



[attachment deleted by admin due to age]
Title: Re: [A15] [A16] Better Pathfinding (v1.4.1 update 1/7)
Post by: mason_water on January 14, 2017, 04:13:48 PM
why would my pawn path like this?

http://prntscr.com/dvodl0

edit: drafting him and having him haul it again has him make a normal path towards it
Title: Re: [A15] [A16] Better Pathfinding (v1.4.1 update 1/7)
Post by: Rock5 on January 14, 2017, 09:15:16 PM
Quote from: mason_water on January 14, 2017, 04:13:48 PM
why would my pawn path like this?

http://prntscr.com/dvodl0 (http://prntscr.com/dvodl0)

edit: drafting him and having him haul it again has him make a normal path towards it

I've noticed it do weird paths like that too.
Title: Re: [A15] [A16] Better Pathfinding (v1.4.1 update 1/7)
Post by: Zhentar on January 14, 2017, 10:07:19 PM
Slight "hooks" near the end of the path are a known weakness of the current version; I've been experimenting with ways to reduce that tendency without sacrificing too much performance. mason_water's example is a pretty extreme case though; are others seeing it behave that poorly?

Quote from: Rock5 on January 13, 2017, 05:29:46 AM
This looks like an obvious misspathing. The optimum path looks to be under that little hill in the middle. Instead it goes up, after rounding the mountain, instead of searching in a straight line to the target.

It does look like going under that hill would be faster, but not by very much; only about 30 ticks if I'm counting right; only going a few tiles further than it needs to. That is well within the quality of path I intend for them to pick.
Title: Re: [A15] [A16] Better Pathfinding (v1.4.1 update 1/7)
Post by: lost_RD on January 15, 2017, 07:59:20 PM
Quote from: Zhentar on January 14, 2017, 10:07:19 PM
It does look like going under that hill would be faster, but not by very much; only about 30 ticks if I'm counting right; only going a few tiles further than it needs to. That is well within the quality of path I intend for them to pick.

I count 13 extra cells travelled for the given path compared to optimal. That seems like more than 30 ticks.
Title: Re: [A15] [A16] Better Pathfinding (v1.4.1 update 1/7)
Post by: Rock5 on January 15, 2017, 08:45:38 PM
I don't mind that it's not the most optimal path if it's close enough but what I don't understand is, shouldn't it look primarily for the closest path in a straight line to the target first? I don't understand why it went up in preference to going straight.
Title: Re: [A15] [A16] Better Pathfinding (v1.4.1 update 1/7)
Post by: lost_RD on January 16, 2017, 06:58:06 AM
It reeks of jump point
Title: Re: [A15] [A16] Better Pathfinding (v1.4.1 update 1/7)
Post by: Zhentar on January 16, 2017, 11:55:03 PM
Quote from: lost_RD on January 15, 2017, 07:59:20 PM
I count 13 extra cells travelled for the given path compared to optimal. That seems like more than 30 ticks.

You must be looking at Mason's screenshot, which is that bad. Rock5's is not.


Quote from: Rock5 on January 15, 2017, 08:45:38 PM
I don't mind that it's not the most optimal path if it's close enough but what I don't understand is, shouldn't it look primarily for the closest path in a straight line to the target first? I don't understand why it went up in preference to going straight.

That's what the Vanilla pathfinder does. If it worked well, none of us would be in this thread now.

My pathfinder uses a heuristic based on RimWorld's region system, which composes groups of passable cells into a larger unit (each region can be up to 12 cells by 12 cells, so 144 cells or less). Estimating the distance between each linked region lets the heuristic account for large obstructions (like walls and mountains), as well as some chokepoints, like doors. Smaller obstructions that don't completely cross a region are effectively invisible to the heuristic, so it doesn't always make the right choices when it encounters them.

Jump Point Search only works on uniform cost grids, so it's useless for RimWorld.
Title: Re: [A15] [A16] Better Pathfinding (v1.4.1 update 1/7)
Post by: faltonico on January 17, 2017, 05:28:39 PM
Please apply ;)
Want to see YOUR mod in RimWorld? (https://ludeon.com/forums/index.php?topic=29505.0)
Title: Re: [A15] [A16] Better Pathfinding (v1.4.1 update 1/7)
Post by: milon on January 22, 2017, 04:43:49 PM
^ ditto

Also, subscribed!
Title: Re: [A15] [A16] Better Pathfinding (v1.4.1 update 1/7)
Post by: EldVarg on January 25, 2017, 07:28:05 AM
Anyone get this to work with MarsX? It looks like no improvements in pathfinding.
Title: Re: [A15] [A16] Better Pathfinding (v1.4.1 update 1/7)
Post by: AnNyeong on January 25, 2017, 03:59:42 PM
https://i.gyazo.com/45479094c0dcee30be8da002e1f89d8d.jpg
I guess he likes to walk?
I mean, this ain't no zig-zag. That's a straight up 10-15 times longer detour for no apparent reason...
Title: Re: [A15] [A16] Better Pathfinding (v1.4.1 update 1/7)
Post by: AnNyeong on January 25, 2017, 04:01:23 PM
Sorry for double post but...
https://i.gyazo.com/17d1496910b7f53a0767e36468a9f9dc.jpg
Again...
https://i.gyazo.com/603d1dd82189edd567e86b8fb3aebed5.jpg
Drafting/undrafting fixes it obviously but... How can I fix that?
Title: Re: [A15] [A16] Better Pathfinding (v1.4.1 update 1/7)
Post by: Zhentar on January 25, 2017, 05:32:48 PM
Do you have path avoid zones set up?

If it's not avoid zones, then probably your region linkages are broken. Save & reload should fix it. If it's happening frequently, then you've either stumbled on an obscure Vanilla bug, or another mod's bug.
Title: Re: [A15] [A16] Better Pathfinding (v1.4.1 update 1/7)
Post by: AnNyeong on January 25, 2017, 07:33:29 PM
Quote from: Zhentar on January 25, 2017, 05:32:48 PM
Do you have path avoid zones set up?

If it's not avoid zones, then probably your region linkages are broken. Save & reload should fix it. If it's happening frequently, then you've either stumbled on an obscure Vanilla bug, or another mod's bug.
https://i.gyazo.com/20ee5505468ff9581bc7472f9beeefff.png

This is my modlist/order
Didn't seem to recreate so far, we'll see.
It seemed to be only with wood and that specific steel skip. Kinda weird.

I don't think I have anything else related to pathing.
Title: Re: [A15] [A16] Better Pathfinding (v1.4.1 update 1/7)
Post by: Jaridan on January 27, 2017, 06:32:33 AM
@Zhentar did the tweak you made a while ago, that got alphabeaver2 to find a path within 15k nodes compared to 160k, get rid of the problem with animal pathing?



Someone posted this on the steam comment section today :
Modlist from the log :
Log uploaded on Friday, January 27, 2017, 1:08:25 AM
Loaded mods:
Core: (no assemblies)
HugsLib[2.3.3]: HugsLib(0.16.0.0)
PhiClient: Newtonsoft.Json(3.5.0.0), websocket-sharp(1.0.2.59611), SocketLibrary(1.0.0.0), PhiData(1.0.0.0), PhiClient(1.0.0.0)
GHXX Tech Advancing: TechAdvancing(1.0.0.0)
Medieval Times: (no assemblies)
Mountain Miner (A16): MountainMiner(1.0.6198.5249)
Efficient Light: (no assemblies)
Feed The Colonists: (no assemblies)
LT-DoorMat: RimWorld-DoorMat(1.0.0.0)
A World Without Hat: AWorldWithoutHat(1.0.6198.19125)
Weapon Tech: (no assemblies)
Trading Spot: Rimworld - TradingSpot(0.0.0.0)
Better Pathfinding: BetterPathfinding(1.0.0.0)
DeadMansClothing: DeadMansClothing(0.16.1.0)
AC-Enhanced Crafting [A16]: AcEnhancedCrafting(1.0.0.0)
Refugee Stats: RefugeeStats(1.0.0.0)
Hand Me That Brick: HandMeThatBrick(1.2.16.0)
JTReplaceWalls: JTReplaceWalls(1.0.0.0)
Rimsenal - Storyteller pack: (no assemblies)
Core Driller: (no assemblies)
Repair Workbench: RepairBench(1.0.0.0)
EdB Prepare Carefully: EdBPrepareCarefully(0.16.1.4)
OSHA Compliance: OshaCompliance(1.0.6207.13087)
Let's Be Honest Here: (no assemblies)
Expanded Prosthetics and Organ Engineering: (no assemblies)
The Mad Rabbits of Caerbannog: Caerbannog(1.0.6198.18118)
Step Away From The Medicine: StepAway(1.0.6216.43174)
I Can Fix It!: ICanFixIt(1.0.6224.40794)
Crafting Hysteresis: CraftingHysteresis(1.0.6207.15385)
JTZoneButtons: JTZoneButtons(1.0.0.0)
Pests: $HugsLibChecker(0.2.0.0), Nandonalt_Pests(1.0.0.0)
Caravan Dogs: (no assemblies)
AC-Enhanced Hauling: AcEnhancedHauling(1.0.0.0)
Animal Tab: BetterAnimalsTab(1.0.0.0)
A Dog Said...: (no assemblies)
Mad Skills - Tiered: MadSkills(0.0.0.0)
Fermenting Cooks: (no assemblies)
Cooks Can Refuel: CooksCanRefuel(2.16.0.0)
TAG Trait: (no assemblies)
More Vanilla Turrets: (no assemblies)
ED-Laser Drill: ED-LaserDrill(1.0.0.0)
Sustainable Drill: (no assemblies)
MineItAll: MineItAll(1.1.0.0)



"i keep getting some sort of issue where animals are trying to path to something but log says they are reaching search limit and everytime it does that my game freezes for a second. ive got the log here https://gist.github.com/7ad3e738740ba2374b5d9ae230c2facd

i can fix the problem temporarily by changing their allowed areas, but it just pops up again with another animal. its getting impossible to play the game."
(lots of trash in the log cause of phiclient mod, starting line for error is 1764)
"Alpaca944947 pathing from (79, 0, 158) to Thing_RawPotatoes1967256 hit search limit of 160000 cells."

edit: just to be on the safe side and because i'm paranoid about this(lol) i reupdated steam to ensure it's on 1.4.1 (which it should've been anyway, but making sure doesn't hurt)
Title: Re: [A15] [A16] Better Pathfinding (v1.4.1 update 1/7)
Post by: Zhentar on January 27, 2017, 12:41:31 PM
The change didn't entirely eliminate the possibility of encountering the error, just should have made it much less likely to actually happen.

Logs don't help for troubleshooting this (if I had it log everything I needed there would be probably several megabytes of text). Save games are ideal, but screenshots (showing the pathing pawn and where they are trying to go) still help quite a bit.
Title: Re: [A15] [A16] Better Pathfinding (v1.4.1 update 1/7)
Post by: Jaridan on January 27, 2017, 05:09:49 PM
Was able to obtain the savefile from said poster.
https://puu.sh/tD0a3/464e396b26.7z
Title: Re: [A15] [A16] Better Pathfinding (v1.4.1 update 1/7)
Post by: Rock5 on January 27, 2017, 05:59:42 PM
This ones really messed up. When I saw Arthur carrying Salt away from the base I thought "where's he going?. Maybe he's going through another door." What I saw was not expected.

Both Arthur and Emily are rescuing colonist and are both going that weird path. Not only do they go all the way back to this side of the wall but they don't even go through the closest door. They loop around and over the middle of the base.

I think this is the last straw. The funny little loops it sometimes does I can deal with but if it does crazy things like this it's time to uninstall this mod. Funny, I seem to remember it used to work better than this. I only seem to have this funny behavior in the latest version of the mod.

[attachment deleted by admin due to age]
Title: Re: [A15] [A16] Better Pathfinding (v1.4.1 update 1/7)
Post by: Rock5 on January 27, 2017, 09:28:08 PM
Time for another test.

With Better Pathfinding.
(https://ludeon.com/forums/index.php?action=dlattach;topic=26563.0;attach=18737)
First half straight to edge of mountain - good. Second half detours to target - bad.

With Better Pathfinding returning.
(https://ludeon.com/forums/index.php?action=dlattach;topic=26563.0;attach=18739)
First part straight to edge of moiuntain - good. Second half detours to target - bad.

With vanilla pathfinding.
(https://ludeon.com/forums/index.php?action=dlattach;topic=26563.0;attach=18741)
First half detours to edge of mountain - bad. Second half straight to target - good.

With vanilla pathfinding returning.
(https://ludeon.com/forums/index.php?action=dlattach;topic=26563.0;attach=18743)
First half straight to edge of mountain - good. Second half straight to target - good.

So overall it looks like vanilla is better, well for this scenario anyway.

[attachment deleted by admin due to age]
Title: Re: [A15] [A16] Better Pathfinding (v1.4.1 update 1/7)
Post by: Zhentar on January 28, 2017, 02:25:09 AM
Could you post your mods list? There's nothing in Vanilla that should ever make it take that crazy long loop.
Title: Re: [A15] [A16] Better Pathfinding (v1.4.1 update 1/7)
Post by: Rock5 on January 28, 2017, 03:07:55 AM
Core
HugsLib
MineItAll
Zhentar's Vanilla Tweaks
Numbers
Medical Tab
JTReplaceWalls
JTZoneButtons
Trading Spot
AC-Enhanced Crafting
Area Unlocker
Blueprints
QualityBuilder
Haulpriority_lite
New Zone Tools
I Can Fix It
RimFridge
Industial Rollers
CaravanSpot
Mod List Backup
Refactored Work Priorities
Step Away From The Medicine
Crate
Fresh stockpile filter
Storage Search
Where is Potato soil
Where is rich soil
JTExport
Refugee Stats
Static Quality Plus
HuntersSpot
Realistic Darkness
ExtendedStorage
Follow Me

Wow I forgot about some of those. Must remember to use them.
Title: Re: [A15] [A16] Better Pathfinding (v1.4.1 update 1/7)
Post by: Rock5 on February 03, 2017, 08:26:38 PM
Ok I've been raking my brain trying to wrap my head around pathfinding for the last couple of days and I've come up with an idea. I don't really have the ability or drive to test it out so I thought I'd mention it here so better experts than me can pick it apart.

The main problem I see with A* is when you have dead end areas and it checks every square in that area before it exits it to continue on. The cause of this is the heuristics generally don't take into account the obstacle. There is also the problem of simitry but I'm not sure if it's an issue with variable weight terrains.

I came across Jump Point Search algorithm which looks like it's super fast compared to A*. The downside being that it assumes a uniform terrain. But I thought to myself, there has to be a way to use it's speed to improve A*. I thought to myself, "Improved heuristics can improve A*. Heuristics ignore terrain weight. JPS ignores terrain weight". So is it possible to use JPS somehow to make a grid of optimal paths quickly then have A*s heuristics use those JPS paths to come to a more accurate heuristic? If so, I would expect A* to pretty much follow the optimal path right off, saving a lot of time. This assumes that calculating the JPS paths would be faster than the time saved.

Then I thought of another variation of this idea. What if we used flood fill, I think it's called. If we can quickly make an array of of flood fill values from the destination (ignoring terrain weight of course) then use those values as the heuristics then again A* should follow the optimum path immediately instead of going in those dead end areas.

What do you think? Is it worth trying? Or am I just talking shit?
Title: Re: [A15] [A16] Better Pathfinding (v1.4.1 update 1/7)
Post by: Celestial on February 04, 2017, 03:35:19 AM
Quote from: Rock5 on February 03, 2017, 08:26:38 PM
Then I thought of another variation of this idea. What if we used flood fill, I think it's called. If we can quickly make an array of of flood fill values from the destination (ignoring terrain weight of course) then use those values as the heuristics then again A* should follow the optimum path immediately instead of going in those dead end areas.

Flood filling would cost even more. The problems with path finding isn't the actual finding, its the calculating distance part. Different algorithms are just methods of determining which cells I should check if I flood fill. How would you limit to what extent of the map I should flood fill? The entire map? or a certain radius?
Title: Re: [A15] [A16] Better Pathfinding (v1.4.1 update 1/7)
Post by: Rock5 on February 04, 2017, 10:33:43 AM
You don't calculate distances with flood fill. You just add 1 as you radiate out from the target. It assumes only horizontal and vertical movement though. To make it accurate it would have to add 1.4 diagonally. This makes things more complicated because the list wont remain in order just radiating out. You would want to avoid sorting but I think if you work out the right way to do it you could keep it in order without having to sort. I've been working on it. Here is my pseudo code. I'm using horizontal/vertical distance as 10 and diagonal as 14 because I assume using ints is better than using floats.

Starting with an open list of nodes, let's call it ol, with x,y and dist value                       
And closed list that is an array for easy reference cl[x,y]=dist                       
Assume ol has function add (int x, int y, int distance)       
               
ol.add (endNode.x, endNode.y, 0)                       
while ol. count != 0                       
    curDist = ol.getFirstItem.dist                   
    ' Do horizontal and vertical neighbors with dist values from curDist to curDist + 4                   
    for each node in ol do                   
        if node.dist <= curDist + 4 then               
            Get horizontal and vertical neighbours that are not on closed list or blocked           
            Add them to open list adding dist as curDist + 10           
        else               
            break           
        end if               
    end for                   
    ' Do diagonal neighbours for curDist only. Remove from open list as you do them.                   
    while ol.getFirstItem.dist = curDist                   
        Get diagonal neighbors that are not on closed list or blocked               
        Add them to open list adding dist as curDist + 14               
        remove first node from open list and add to closed list               
    end while                   
end while   
                   

I don't think there is anything there that is to complex so I'm hoping it wont take long to do the whole map. Then instead of using the Manhattan distance for the heuristics ie. abs(startNode.x-endNode.x) + abs(startNode.z-endNode.z) you can use the value in the closed list cl[endNode.x, endNode.y].

On another note I think I found in the vanilla pathfinding where it uses the Manhattan distance.
this.h = this.heuristicStrength * (Mathf.Abs((int)this.neighX - this.destinationX) + Mathf.Abs((int)this.neighZ - this.destinationZ));
Technically speaking the Manhattan distance assumes only vertical and horizontal movement. It should really be something like
x = abs(startNode.x-endNode.x)
y = abs(startNode.y-endNode.y)
max = Max(x, y)
min = Min (x, y)
heuristic = max - min + (min * 1.4)

It probably could be done more elegantly than that but I wonder what difference just this one change would make.
Title: Re: [A15] [A16] Better Pathfinding (v1.4.1 update 1/7)
Post by: Zhentar on February 05, 2017, 12:50:48 AM
Making the vanilla pathfinder accurate is easy; switch from Manhattan distance to octile distance and remove the weight and you're done. But reducing the heuristic weight directly increases the performance cost.

I spent most of today looking at the pathfinder and figuring out why it was making poor choices in some cases. I figured out a somewhat better way to handle the heuristic weighting, and tie-breaker handling that significantly improved performance and also path quality in some cases.

It should do a fair bit better with your mountain test, but probably still not perfect. Doing better at requires reducing the weight of the heuristic, but that hurts performance when path costs aren't perfectly even with a straight path like that. One thought I've had to address that would be a heuristic weight heuristic, where it estimates how inconsistent terrain costs are and reduces/increases the weight accordingly.
Title: Re: [A15] [A16] Better Pathfinding (v1.4.1 update 1/7)
Post by: Rock5 on February 05, 2017, 04:38:25 AM
That's good to hear. I thought you were still tied up with the Extreme Desert Challenge. :)

Does changing from Manhattan to Octile really make that much of a difference to the performance?

I'm not quite sure what you mean by heuristic weight. Is that what you use to adjust the heuristic to balance the performance and accuracy? If so could you change to Octile while still using the weights?
Title: Re: [A15] [A16] Better Pathfinding (v1.4.2 update 2/7)
Post by: Zhentar on February 07, 2017, 12:50:46 PM
For the vanilla pathfinder, switching to octile without otherwise adjusting the weight has a fairly small impact; mostly it will be slightly better about going around obstacles. My heuristic already uses octile distance.

The weight is indeed what balances performance and accuracy. The heuristic is an estimate of what the best possible path would cost, and the search will continue until it either finds a path that costs that much, or until it's proven that path doesn't exist. Since the heuristic almost always underestimates the actual optimal path cost, the search can spend a lot of extra time looking for alternate paths that aren't there. So when we "weight" the heuristic, we increase the estimate by some amount (I multiply it by between 1.05 and 1.2) and then the search will give up much earlier, but possibly miss a better path in the process.

I've posted an update. It includes an improvement to the heuristic that significantly improves path quality & performance on long diagonal paths, and a few small tweaks that make it better at travelling in straight lines (tie breaking logic, a small rounding change, and a simple check that corrects some inappropriate zig zags). I haven't rigorously tested the performance/optimized yet, but I think performance is on average at least slightly improved. Path quality (on easy paths where the heuristic was accurate) is much better; I still see a few quirks but they are fewer and smaller.
Title: Re: [A16] Better Pathfinding (v1.4.3 update 2/7)
Post by: Zhentar on February 07, 2017, 11:11:44 PM
And another update. I discovered that two of the changes in 1.4.2 (one of them being particularly important) were broken.

Also, I did performance tests and verified that it has improved by a pretty decent margin in most of my test cases.
Title: Re: [A16] Better Pathfinding (v1.4.3 update 2/7)
Post by: dj84722 on February 09, 2017, 08:13:58 PM
The latest two updates for better pathfinding has broken compatibility with Sensor Panels(160% walk speed) from Pravus's Fences and floors  https://ludeon.com/forums/index.php?topic=26964.0

Both colonists and animals keep getting the ran out of cells to process error when trying to path with them, colonists have been stuck and unable to move anywhere even when drafted, my mod order for testing is
    <li>Core</li>
    <li>HugsLib</li>
    <li>ModListBackup</li>
    <li>Better Pathfinding</li>
    <li>PathAvoid</li>
    <li>Fences And Floors</li>

even when on a desert new colony i used god mode to create Sensor Panels around them and placed prefered paths with path avoid and the yellow error comes up straight away even when wandering

Husky11412 pathing from (127, 0, 112) to (129, 0, 117) ran out of cells to process.
Job:GotoWander A=(129, 0, 117)
Faction: PlayerColony

This will be the last message to avoid spam.
Verse.Log:Warning(String)
BetterPathfinding.NewPathFinder:FindPathInner(IntVec3, LocalTargetInfo, TraverseParms, PathEndMode, HeuristicMode)
BetterPathfinding.NewPathFinder:FindPath(IntVec3, LocalTargetInfo, TraverseParms, PathEndMode)
BetterPathfinding.PathFinderDetour:FindPath(PathFinder, IntVec3, LocalTargetInfo, TraverseParms, PathEndMode)
Verse.AI.PathFinder:FindPath(IntVec3, LocalTargetInfo, Pawn, PathEndMode)
Verse.AI.Pawn_PathFollower:GenerateNewPath()
Verse.AI.Pawn_PathFollower:TrySetNewPath()
Verse.AI.Pawn_PathFollower:TryEnterNextPathCell()
Verse.AI.Pawn_PathFollower:PatherTick()
Verse.Pawn:Tick()
Verse.TickList:Tick()
Verse.TickManager:DoSingleTick()
Verse.TickManager:TickManagerUpdate()
Verse.Game:Update()
Verse.Root_Play:Update()

Disabling better pathfinding fixed the problem straight away
Title: Re: [A16] Better Pathfinding (v1.4.3 update 2/7)
Post by: EldVarg on February 10, 2017, 04:16:50 AM
Maybe all new floor types from mods does not work now. Could not play with the clutter mod and its new floors.
Title: Re: [A16] Better Pathfinding (v1.4.3 update 2/7)
Post by: tigg on February 17, 2017, 08:41:07 PM
Got to say, I installed this mod in my game with the new hugslib and had lots of "standing", where I couldn't get my pawns to even do things eg. go to the toilet when they were busting (whole lot of errors to do with poo). This was the only new mod, so it was either this one or the new version of hugslib.
Title: Re: [A16] Better Pathfinding (v1.5 update 2/20)
Post by: Zhentar on February 20, 2017, 06:17:53 PM
New version up! Should all of the errors you were running into. Hopefully without causing new ones.
Title: Re: [A16] Better Pathfinding (v1.5 update 2/20)
Post by: scurvey_cur on February 21, 2017, 02:24:46 AM
i got a bug where my pawns go to build something, they pick up some of the materials and freeze, they just stand there until you tell them to do something else

seems it doesnt change the pathing after picking up something, anyone else got this issue?
Title: Re: [A16] Better Pathfinding (v1.5 update 2/20)
Post by: Tenshi~Akari on February 21, 2017, 08:33:58 AM
I have the same type of problem, one of my pawns would freeze when going to get a certain item or maintain an object, and the game lags horribly.

The error I saw in my output file:

(Filename: C:/buildslave/unity/build/artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 42)

Exception ticking Towa: System.Collections.Generic.KeyNotFoundException: The given key was not present in the dictionary.
  at System.Collections.Generic.Dictionary`2[System.Int32,System.Single].get_Item (Int32 key) [0x00000] in <filename unknown>:0
  at BetterPathfinding.RegionLinkDijkstra+<PreciseRegionLinkDistances>d__37.MoveNext () [0x00000] in <filename unknown>:0
  at BetterPathfinding.RegionLinkDijkstra..ctor (Verse.Map map, IntVec3 rootCell, IEnumerable`1 startingRegions, IntVec3 target, TraverseParms parms, PawnPathCostSettings pathCosts) [0x00000] in <filename unknown>:0
  at BetterPathfinding.RegionPathCostHeuristic.GetPathCostToRegion (Int32 cellIndex) [0x00000] in <filename unknown>:0
  at BetterPathfinding.NewPathFinder.FindPathInner (IntVec3 start, LocalTargetInfo dest, TraverseParms traverseParms, PathEndMode peMode, HeuristicMode mode) [0x00000] in <filename unknown>:0
  at BetterPathfinding.NewPathFinder.FindPath (IntVec3 start, LocalTargetInfo dest, TraverseParms traverseParms, PathEndMode peMode) [0x00000] in <filename unknown>:0
  at BetterPathfinding.PathFinderDetour.FindPath (Verse.AI.PathFinder this, IntVec3 start, LocalTargetInfo dest, TraverseParms traverseParms, PathEndMode peMode) [0x00000] in <filename unknown>:0
  at Verse.AI.PathFinder.FindPath (IntVec3 start, LocalTargetInfo dest, Verse.Pawn pawn, PathEndMode peMode) [0x00000] in <filename unknown>:0
  at Verse.AI.Pawn_PathFollower.GenerateNewPath () [0x00000] in <filename unknown>:0
  at Verse.AI.Pawn_PathFollower.TrySetNewPath () [0x00000] in <filename unknown>:0
  at Verse.AI.Pawn_PathFollower.TryEnterNextPathCell () [0x00000] in <filename unknown>:0
  at Verse.AI.Pawn_PathFollower.PatherTick () [0x00000] in <filename unknown>:0
  at Verse.Pawn.Tick () [0x00000] in <filename unknown>:0
  at Verse.TickList.Tick () [0x00000] in <filename unknown>:0


Basically this same error multiple times.  :(
Title: Re: [A16] Better Pathfinding (v1.5 update 2/20)
Post by: Zxypher on February 21, 2017, 12:15:27 PM
Pawns freezing and spamming the log with indecision errors.

https://gist.github.com/b66edf0286224f39cd59c3a1e156cbcf (https://gist.github.com/b66edf0286224f39cd59c3a1e156cbcf) ~Line 660 when giving a pawn a flick order.
Title: Re: [A16] Better Pathfinding (v1.5 update 2/20)
Post by: 71214n0 on February 21, 2017, 03:15:48 PM
Yes, pawn are freezing for me too
Title: Re: [A16] Better Pathfinding (v1.5 update 2/20)
Post by: Grabarz on February 21, 2017, 04:29:56 PM
Exception ticking Lisa: System.Collections.Generic.KeyNotFoundException: The given key was not present in the dictionary.
  at System.Collections.Generic.Dictionary`2[System.Int32,System.Single].get_Item (Int32 key) [0x00000] in <filename unknown>:0
  at BetterPathfinding.RegionLinkDijkstra+<PreciseRegionLinkDistances>d__37.MoveNext () [0x00000] in <filename unknown>:0
  at BetterPathfinding.RegionLinkDijkstra..ctor (Verse.Map map, IntVec3 rootCell, IEnumerable`1 startingRegions, IntVec3 target, TraverseParms parms, PawnPathCostSettings pathCosts) [0x00000] in <filename unknown>:0
  at BetterPathfinding.RegionPathCostHeuristic.GetPathCostToRegion (Int32 cellIndex) [0x00000] in <filename unknown>:0
  at BetterPathfinding.NewPathFinder.FindPathInner (IntVec3 start, LocalTargetInfo dest, TraverseParms traverseParms, PathEndMode peMode, HeuristicMode mode) [0x00000] in <filename unknown>:0
  at BetterPathfinding.NewPathFinder.FindPath (IntVec3 start, LocalTargetInfo dest, TraverseParms traverseParms, PathEndMode peMode) [0x00000] in <filename unknown>:0
  at BetterPathfinding.PathFinderDetour.FindPath (Verse.AI.PathFinder this, IntVec3 start, LocalTargetInfo dest, TraverseParms traverseParms, PathEndMode peMode) [0x00000] in <filename unknown>:0
  at Verse.AI.PathFinder.FindPath (IntVec3 start, LocalTargetInfo dest, Verse.Pawn pawn, PathEndMode peMode) [0x00000] in <filename unknown>:0
  at Verse.AI.Pawn_PathFollower.GenerateNewPath () [0x00000] in <filename unknown>:0
  at Verse.AI.Pawn_PathFollower.TrySetNewPath () [0x00000] in <filename unknown>:0
  at Verse.AI.Pawn_PathFollower.TryEnterNextPathCell () [0x00000] in <filename unknown>:0
  at Verse.AI.Pawn_PathFollower.PatherTick () [0x00000] in <filename unknown>:0
  at Verse.Pawn.Tick () [0x00000] in <filename unknown>:0
  at Verse.TickList.Tick () [0x00000] in <filename unknown>:0
Verse.Log:Error(String)
Verse.TickList:Tick()
Verse.TickManager:DoSingleTick()
Verse.TickManager:TickManagerUpdate()
Verse.Game:Update()
Verse.Root_Play:Update()



latest update is throwing a lot of errors
Title: Re: [A16] Better Pathfinding (v1.5 update 2/20)
Post by: Dr_Zhivago on February 21, 2017, 07:49:11 PM
Getting the same pawn freezing error since the update

"exception ticking sergei"

https://gist.github.com/HugsLibRecordKeeper/0f7e89af4b3544941e39ccb518a6624a
Title: Re: [A16] Better Pathfinding (v1.5.1 update 2/21)
Post by: Zhentar on February 21, 2017, 09:08:30 PM
I've posted a fix for the errors y'all have been seeing.
Title: Re: [A16] Better Pathfinding (v1.5.1 update 2/21)
Post by: Tenshi~Akari on February 21, 2017, 09:40:30 PM
Thanks, that worked for the pawn issue, but hate to be the bearer of more bad bugs... lag happened again not to far into my save file, not the pawns this time but a wild boar.  :'(

(Filename: C:/buildslave/unity/build/artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 42)

Exception ticking WildBoar457323: System.IndexOutOfRangeException: Array index is out of range.
  at BetterPathfinding.RegionLinkDijkstra+<>c__DisplayClass37_0.<PreciseRegionLinkDistances>b__1 (Int32 x) [0x00000] in <filename unknown>:0
  at Verse.Dijkstra`1[System.Int32].Run (IEnumerable`1 startingNodes, System.Func`2 neighborsGetter, System.Func`3 distanceGetter, System.Collections.Generic.List`1& outDistances) [0x00000] in <filename unknown>:0
  at Verse.Dijkstra`1[System.Int32].Run (IEnumerable`1 startingNodes, System.Func`2 neighborsGetter, System.Func`3 distanceGetter, System.Collections.Generic.Dictionary`2& outDistances) [0x00000] in <filename unknown>:0
  at BetterPathfinding.RegionLinkDijkstra+<PreciseRegionLinkDistances>d__37.MoveNext () [0x00000] in <filename unknown>:0
  at BetterPathfinding.RegionLinkDijkstra..ctor (Verse.Map map, CellRect destination, IEnumerable`1 startingRegions, IntVec3 target, TraverseParms parms, PawnPathCostSettings pathCosts) [0x00000] in <filename unknown>:0
  at BetterPathfinding.RegionPathCostHeuristic.GetPathCostToRegion (Int32 cellIndex) [0x00000] in <filename unknown>:0
  at BetterPathfinding.NewPathFinder.FindPathInner (IntVec3 start, LocalTargetInfo dest, TraverseParms traverseParms, PathEndMode peMode, HeuristicMode mode) [0x00000] in <filename unknown>:0
  at BetterPathfinding.NewPathFinder.FindPath (IntVec3 start, LocalTargetInfo dest, TraverseParms traverseParms, PathEndMode peMode) [0x00000] in <filename unknown>:0
  at BetterPathfinding.PathFinderDetour.FindPath (Verse.AI.PathFinder this, IntVec3 start, LocalTargetInfo dest, TraverseParms traverseParms, PathEndMode peMode) [0x00000] in <filename unknown>:0
  at Verse.AI.PathFinder.FindPath (IntVec3 start, LocalTargetInfo dest, Verse.Pawn pawn, PathEndMode peMode) [0x00000] in <filename unknown>:0
  at Verse.AI.Pawn_PathFollower.GenerateNewPath () [0x00000] in <filename unknown>:0
  at Verse.AI.Pawn_PathFollower.TrySetNewPath () [0x00000] in <filename unknown>:0
  at Verse.AI.Pawn_PathFollower.TryEnterNextPathCell () [0x00000] in <filename unknown>:0
  at Verse.AI.Pawn_PathFollower.PatherTick () [0x00000] in <filename unknown>:0
  at Verse.Pawn.Tick () [0x00000] in <filename unknown>:0
  at Verse.TickList.Tick () [0x00000] in <filename unknown>:0


Edit: Scratch that, I found the boar & downed it, and it stopped, but not too long after I just got even more spam, it's not just the boars, but any wild animal trying to consume something on the other side of the map. Hoping this can get fixed as well.
Title: Re: [A16] Better Pathfinding (v1.5.2 update 2/22)
Post by: Zhentar on February 22, 2017, 09:46:18 AM
Thanks for the quick report, I've posted a fix.
Title: Re: [A16] Better Pathfinding (v1.5.2 update 2/22)
Post by: Tenshi~Akari on February 22, 2017, 10:34:06 AM
The fix is working great this time, thanks a bunch! ;D I find it kind of difficult to not have this mod active, the vanilla pathing is so wonky, so glad you put a lot of effort into this mod.  ;)
Title: Re: [A16] Better Pathfinding (v1.5.2 update 2/22)
Post by: Lurmey on February 22, 2017, 11:18:30 AM
I'm getting the "stuck in place" glitch, my constructor (Seraph) is trying to deliver some components to a solar panel but is stuck still in my warehouse holding said components. In the console, several errors are springing from this mod. Log: https://gist.github.com/81de08ce1df3b615d93b6c5a50fe8f34
Title: Re: [A16] Better Pathfinding (v1.5.2 update 2/22)
Post by: Rock5 on March 25, 2017, 03:14:48 AM
I've spent a couple of weeks building a pathfinding algorithm tester in c#. I've finally got it to the point where both the A* and my modified weighted JPS work as optimally as I can get them. Here is a snapshot of a hand drawn rimworld like map.
(https://ludeon.com/forums/index.php?action=dlattach;topic=26563.0;attach=19501;image)

As you can see, this path took 74ms. With A* the best I could get is about 300ms. That is optimal paths only, no sacrificing accuracy for performance. That is about a quarter of the time. I'm quite happy with that.

I'll post it soon, somewhere, I'm not sure where yet. Maybe I'll post a copy here for some feedback. I designed it as best I could to make it easy for anyone to add their own algorithm to test. I hope I succeeded.

So my question to you Zhentar, while doing your work, did you even pull any map data for testing purposes or do you know how I might pull data about the a map weights so I can try a real map in my program?

[attachment deleted by admin due to age]
Title: Re: [A16] Better Pathfinding (v1.5.2 update 2/22)
Post by: Kassidoo on April 16, 2017, 06:54:26 AM
Hi
I (and others) have had some issues with guests/trade caravans pawns that dig through our bases. We discussed it in this reddit thread, and someone mentioned that this mod might be the culprint?
https://www.reddit.com/r/RimWorld/comments/65k385/a_guest_randomly_dug_through_my_house_the_red/
Title: Re: [A16] Better Pathfinding (v1.5.2 update 2/22)
Post by: mathwizi2005 on April 28, 2017, 06:12:54 PM
Ok I think I found an issue. Feels more like a mod compatibility problem since....I played a game thru with no issues....then I add a few more mods and this happens.

Lets lay out the problems. Pawn randomly freezes in place and frame rate plummets significantly. Error is as follows repeating every tick or so

Exception ticking Toni: System.NullReferenceException: Object reference not set to an instance of an object
  at BetterPathfinding.RegionPathCostHeuristic.GetPathCostToRegion (Int32 cellIndex) [0x00000] in <filename unknown>:0
  at BetterPathfinding.NewPathFinder.FindPathInner (IntVec3 start, LocalTargetInfo dest, TraverseParms traverseParms, PathEndMode peMode, HeuristicMode mode) [0x00000] in <filename unknown>:0
  at BetterPathfinding.NewPathFinder.FindPath (IntVec3 start, LocalTargetInfo dest, TraverseParms traverseParms, PathEndMode peMode) [0x00000] in <filename unknown>:0
  at BetterPathfinding.PathFinderDetour.FindPath (Verse.AI.PathFinder this, IntVec3 start, LocalTargetInfo dest, TraverseParms traverseParms, PathEndMode peMode) [0x00000] in <filename unknown>:0
  at Verse.AI.PathFinder.FindPath (IntVec3 start, LocalTargetInfo dest, Verse.Pawn pawn, PathEndMode peMode) [0x00000] in <filename unknown>:0
  at Verse.AI.Pawn_PathFollower.GenerateNewPath () [0x00000] in <filename unknown>:0
  at Verse.AI.Pawn_PathFollower.TrySetNewPath () [0x00000] in <filename unknown>:0
  at Verse.AI.Pawn_PathFollower.TryEnterNextPathCell () [0x00000] in <filename unknown>:0
  at Verse.AI.Pawn_PathFollower.PatherTick () [0x00000] in <filename unknown>:0
  at Verse.Pawn.Tick () [0x00000] in <filename unknown>:0
  at Verse.TickList.Tick () [0x00000] in <filename unknown>:0
Verse.Log:Error(String)
Verse.TickList:Tick()
TickMultiThread.SpecialInjector_TickMultiThreadDetour3:_DoSingleTick(TickManager)
Verse.TickManager:TickManagerUpdate()
Verse.Game:Update()
Verse.Root_Play:Update()


Then I find it trying to access a cell that doesn't exist to us yet. (undiscovered)

Couldn't find any cell in region Region(id=1710, mapIndex=0, center=(114, 0, 126), links=0, cells=99)
Verse.Log:Error(String)
Verse.Region:get_AnyCell()
Verse.Region:get_RandomCell()
BetterPathfinding.RegionLinkDijkstra:RegionMedianPathCost(Region)
BetterPathfinding.RegionPathCostHeuristic:GetPathCostToRegion(Int32)
BetterPathfinding.NewPathFinder:FindPathInner(IntVec3, LocalTargetInfo, TraverseParms, PathEndMode, HeuristicMode)
BetterPathfinding.NewPathFinder:FindPath(IntVec3, LocalTargetInfo, TraverseParms, PathEndMode)
BetterPathfinding.PathFinderDetour:FindPath(PathFinder, IntVec3, LocalTargetInfo, TraverseParms, PathEndMode)
Verse.AI.PathFinder:FindPath(IntVec3, LocalTargetInfo, Pawn, PathEndMode)
Verse.AI.Pawn_PathFollower:GenerateNewPath()
Verse.AI.Pawn_PathFollower:TrySetNewPath()
Verse.AI.Pawn_PathFollower:TryEnterNextPathCell()
Verse.AI.Pawn_PathFollower:PatherTick()
Verse.Pawn:Tick()
Verse.TickList:Tick()
TickMultiThread.SpecialInjector_TickMultiThreadDetour3:_DoSingleTick(TickManager)
Verse.TickManager:TickManagerUpdate()
Verse.Game:Update()
Verse.Root_Play:Update()


Then I start looking at Yellow alerts.

Pathfinding destination not in region, must fall back to vanilla!
Verse.Log:Warning(String)
BetterPathfinding.NewPathFinder:FindPathInner(IntVec3, LocalTargetInfo, TraverseParms, PathEndMode, HeuristicMode)
BetterPathfinding.NewPathFinder:FindPath(IntVec3, LocalTargetInfo, TraverseParms, PathEndMode)
BetterPathfinding.PathFinderDetour:FindPath(PathFinder, IntVec3, LocalTargetInfo, TraverseParms, PathEndMode)
Verse.AI.PathFinder:FindPath(IntVec3, LocalTargetInfo, Pawn, PathEndMode)
Verse.AI.Pawn_PathFollower:GenerateNewPath()
Verse.AI.Pawn_PathFollower:TrySetNewPath()
Verse.AI.Pawn_PathFollower:TryEnterNextPathCell()
Verse.AI.Pawn_PathFollower:PatherTick()
Verse.Pawn:Tick()
Verse.TickList:Tick()
TickMultiThread.SpecialInjector_TickMultiThreadDetour3:_DoSingleTick(TickManager)
Verse.TickManager:TickManagerUpdate()
Verse.Game:Update()
Verse.Root_Play:Update()


And then I find what the game is trying to desperately to haul when I don't even know it exists yet.

Toni pathing from (100, 0, 106) to Thing_PsychicAnimalPulser25718 ran out of cells to process.
Job:HaulToCell A=Thing_PsychicAnimalPulser25718 B=(111, 0, 104)
Faction: PlayerColony
Verse.Log:Warning(String)
BetterPathfinding.NewPathFinder:FindPathInner(IntVec3, LocalTargetInfo, TraverseParms, PathEndMode, HeuristicMode)
BetterPathfinding.NewPathFinder:FindPath(IntVec3, LocalTargetInfo, TraverseParms, PathEndMode)
BetterPathfinding.PathFinderDetour:FindPath(PathFinder, IntVec3, LocalTargetInfo, TraverseParms, PathEndMode)
Verse.AI.PathFinder:FindPath(IntVec3, LocalTargetInfo, Pawn, PathEndMode)
Verse.AI.Pawn_PathFollower:GenerateNewPath()
Verse.AI.Pawn_PathFollower:TrySetNewPath()
Verse.AI.Pawn_PathFollower:TryEnterNextPathCell()
Verse.AI.Pawn_PathFollower:PatherTick()
Verse.Pawn:Tick()
Verse.TickList:Tick()
TickMultiThread.SpecialInjector_TickMultiThreadDetour3:_DoSingleTick(TickManager)
Verse.TickManager:TickManagerUpdate()
Verse.Game:Update()
Verse.Root_Play:Update()


Mods are as follows in exact mod load order (most are steam workshop items):
Core
WorldPawnGC
ZhentarFix (1.5 alpha btw)
ZhentarTweaks
Make War Not Love
IdleFix
Manhunter Fix
RotTickFix
TickMultiThread
Better Pathfinding
Expanded Prosthetics and Organ Engineering
Glitter Tech (No Surgery)
Numbers
HugsLib
OHU-Dropships-1.0
Tilled Soil
RePower
QualityBuilder
ED-OmniGel
Storage Search A16
More Trade Ships
Miscellaneous 'CORE'
Misc. MapGenerator
Misc. Training
Misc. Robots
ED-Laser Drill
Xeva's Rimhair
Colony Manager
Rimsenal - Rimhair
ArmourRepair
Rimsenal - Storyteller pack
RT Quantum Storage
RT Solar Flare Shield
RT's Weapons Pack
Prepare Carefully
Repair Workbench
Hardworking Animals
Look At Me, I'm The Worker Now
NoMoreLazyPawns
Hand Me That Brick
Prisoner Harvesting
Medical Tab
WorkTab
Step Away From The Medicine
Silly Builder, Surgery is for Doctors
Silent Doors
I Can Fix It!
Craftable Robots - base robots
Trading Spot A16
Defensive Positions
Crafting Hysteresis
Refugee Stats
CaravanSpot
A Dog Said...
Industrialisation
Wildlife Tab
P-Music
Animal Tab
MineItAll
PetMute
Feed The Colonists
Hardcore Storytellers
Miniaturisation
Bulk Medicine Production
Achtung!
Map Reroll
Blueprints
Less Rebuff
Mad Skills - Tiered


Temporarily disabled the mod, also added source output log in rar (was almost a bloody meg in size)
And as a bonus, the save I'm getting the issue on.

That being said, this look like two completely different errors happening, as its trying to grab something from Ancient Danger generation that it can't access but this other one happens when it fails to find a path to a cell the pawn is literally right next to. And this doesn't need to happen to a colonist, it occurs on any pawn on the map.

off topic, wth is the 'spoiler' syntax, nothing I type in seems to be accepted and I wanted to avoid a long ass post

[attachment deleted by admin due to age]
Title: Re: [A16] Better Pathfinding (v1.5.2 update 2/22)
Post by: faltonico on April 28, 2017, 07:51:34 PM
Quote from: mathwizi2005 on April 28, 2017, 06:12:54 PM
...TickMultiThread

What is that? o.O
Title: Re: [A16] Better Pathfinding (v1.5.2 update 2/22)
Post by: mathwizi2005 on April 28, 2017, 08:38:13 PM
A mod someone (don't know who) made that forces plant ticks into another thread, specifically every plant gets its own thread. Sadly, its kinda buggy as plants tend to.....get frozen at 5% so I don't recommend yet.
Title: Re: [A16] Better Pathfinding (v1.5.2 update 2/22)
Post by: faltonico on April 28, 2017, 09:12:06 PM
Quote from: mathwizi2005 on April 28, 2017, 08:38:13 PM
A mod someone (don't know who) made that forces plant ticks into another thread, specifically every plant gets its own thread. Sadly, its kinda buggy as plants tend to.....get frozen at 5% so I don't recommend yet.
I wound't mind testing it *drools*
Title: Re: [A16] Better Pathfinding (v1.5.2 update 2/22)
Post by: milon on April 30, 2017, 06:52:12 AM
Quote from: mathwizi2005 on April 28, 2017, 06:12:54 PM
off topic, wth is the 'spoiler' syntax, nothing I type in seems to be accepted and I wanted to avoid a long ass post

We don't have spoiler tags here :(
Title: Re: [A16] Better Pathfinding (v1.5.2 update 2/22)
Post by: milon on May 01, 2017, 09:47:39 AM
sheidula's post was split from here into its own thread for better assistance:
https://ludeon.com/forums/index.php?topic=32045.0
Title: Re: [A16] Better Pathfinding (v1.5.2 update 2/22)
Post by: Zhentar on May 01, 2017, 02:28:57 PM
Quote from: Rock5 on March 25, 2017, 03:14:48 AM
I've spent a couple of weeks building a pathfinding algorithm tester in c#. I've finally got it to the point where both the A* and my modified weighted JPS work as optimally as I can get them. Here is a snapshot of a hand drawn rimworld like map.
(https://ludeon.com/forums/index.php?action=dlattach;topic=26563.0;attach=19501;image)

As you can see, this path took 74ms. With A* the best I could get is about 300ms. That is optimal paths only, no sacrificing accuracy for performance. That is about a quarter of the time. I'm quite happy with that.

I'll post it soon, somewhere, I'm not sure where yet. Maybe I'll post a copy here for some feedback. I designed it as best I could to make it easy for anyone to add their own algorithm to test. I hope I succeeded.

So my question to you Zhentar, while doing your work, did you even pull any map data for testing purposes or do you know how I might pull data about the a map weights so I can try a real map in my program?

A bit late on this, but you can check out what I did in my github repository here (including half a dozen of my test cases): https://github.com/Zhentar/BetterPathfinding/tree/master/OfflineTester


Quote from: mathwizi2005 on April 28, 2017, 06:12:54 PM
Ok I think I found an issue. Feels more like a mod compatibility problem since....I played a game thru with no issues....then I add a few more mods and this happens.

Lets lay out the problems. Pawn randomly freezes in place and frame rate plummets significantly. Error is as follows repeating every tick or so

Something is messed up about the room Toni is in, and it's resulting in a corrupt region grid. Better Pathfinding heavily depends upon the region grid, so it tends to fail quite visibly when there are problems with it. Other parts of the game that depend upon it tend to have much more subtle effects. The region grid corruption can't be caused by Better Pathfinding, so it's most likely a result of one of the other mods (although I know there is at least one bug in the region generation algorithm in A16, so it's not impossible that it's a Vanilla issue).
Title: Re: [A16] Better Pathfinding (v1.5.2 update 2/22)
Post by: mathwizi2005 on May 02, 2017, 05:36:19 PM
Apparently the Tick Multithread mod I was experimenting with was causing the issue. The plan was to put PLANTS onto their own thread per tick but it seems it expanded beyond just plants as that one cell Toni was trying to get to was literally right next to the pawn with nothing on the tile, literally NOTHING. I have since removed the mod and the problems disappeared overnight.
Title: Re: [A16] Better Pathfinding (v1.5.2 update 2/22)
Post by: TOG II on May 06, 2017, 04:57:29 PM
I suggest you post your mod [Here] (https://ludeon.com/forums/index.php?topic=27962.0) for a possible official integration.
Title: Re: [A16] Better Pathfinding (v1.5.2 update 2/22)
Post by: Zhentar on May 06, 2017, 10:19:49 PM
There's no need; it's already included in A17.
Title: Re: [A16] Better Pathfinding (v1.5.2 update 2/22)
Post by: milon on May 07, 2017, 04:20:07 PM
Quote from: TOG II on May 06, 2017, 04:57:29 PM
I suggest you post your mod [Here] (https://ludeon.com/forums/index.php?topic=27962.0) for a possible official integration.

FYI, that's the mods announcement thread, used to advertise the existence of a mod. I think you were meaning the mod nomination thread here: https://ludeon.com/forums/index.php?topic=29505.0

Quote from: Zhentar on May 06, 2017, 10:19:49 PM
There's no need; it's already included in A17.

Woo hoo, that's awesome Zhentar!
Title: Re: [A16] Better Pathfinding (v1.5.2 update 2/22)
Post by: ultra4 on May 28, 2017, 02:16:07 PM
That is great. On one hand no need for your mod anymore, but that means you deserve a whole bunch of thanks, you made the game a lot better
Title: Re: [A16] Better Pathfinding (v1.5.2 update 2/22)
Post by: stigma on June 27, 2017, 06:37:46 PM
Quote from: Zhentar on May 06, 2017, 10:19:49 PM
There's no need; it's already included in A17.

That is very cool to hear (congratulations!)

I think it would be a very good idea to put a big red notice about this in the first post of this thread though. It would save a lot of time and confusion for people.

-Stigma
Title: Re: [A16] Better Pathfinding (v1.5.2 update 2/22)
Post by: Canute on June 28, 2017, 02:43:11 AM
Quote from: Zhentar on May 06, 2017, 10:19:49 PM
There's no need; it's already included in A17.
Maybe overthink your choise.
Playing on the rainforest mod, my Builder build roads through the jungle, and once he is want to break, he move straight through the jungle instead to use his own builld path.

Maybe not an issue about pathfinding, but caravan rarely exit the map through the selected direction you select at the option. I set south, because the base is at the south, south is a road closeby, and the pawns move 1 day to the north through the jungle to exit.
Title: Re: [A16] Better Pathfinding (v1.5.2 update 2/22)
Post by: wwWraith on June 28, 2017, 02:57:03 AM
I think this is related: https://ludeon.com/forums/index.php?topic=33953.0
Title: Re: [A16] Better Pathfinding (v1.5.2 update 2/22)
Post by: Canute on June 28, 2017, 04:18:17 AM
Yep i know, thats why want a revival of this mod ! :-)
Title: Re: [A16] Better Pathfinding (v1.5.2 update 2/22)
Post by: zyklame on June 29, 2017, 02:02:16 AM
With these heavy bug in the vanilla path finding of A17 a revival of these mod would be very much appreciated.
Title: Re: [A16] Better Pathfinding (v1.5.2 update 2/22)
Post by: Mosart on July 02, 2017, 10:07:00 AM
Just want to say Thank you for this mod. It's really nice that it is included in a17 now
Title: Re: [A16] Better Pathfinding (v1.5.2 update 2/22)
Post by: faltonico on July 02, 2017, 01:56:56 PM
Quote from: Zhentar on May 06, 2017, 10:19:49 PM
There's no need; it's already included in A17.
But only a partial implementation?:

"Colonist taking much slower paths for no known reason." (https://ludeon.com/forums/index.php?topic=33953.msg345999#msg345999)
Title: Re: [A16] Better Pathfinding (v1.5.2 update 2/22)
Post by: rambo on July 04, 2017, 09:09:21 AM
is there an a17 version?
Title: Re: [A16] Better Pathfinding (v1.5.2 update 2/22)
Post by: rightomate on July 15, 2017, 03:02:14 AM
The pathfinding in A17 is still terrible, my pawns still choose to walk the long way through a marsh even though i have built a flagstone path right next to it on a more direct route. dunno how hard it is to work out the pathfinding but why would the pawns choose 36% walk rate over a longer distance rather than 100% over a shorter distance. doesnt make sense. :-\
Title: Re: [A16] Better Pathfinding (v1.5.2 update 2/22)
Post by: rightomate on July 15, 2017, 03:19:59 AM
Here is an example of how good it is..

Bit hard to see as i had to minimize the screenshot a bit to attach but you get the idea

[attachment deleted by admin due to age]
Title: Re: [A16] Better Pathfinding (v1.5.2 update 2/22)
Post by: Anvil_Pants on July 15, 2017, 10:23:53 AM
A17 pathing is broken on long paths, basically always. It is known. (https://ludeon.com/forums/index.php?topic=33027.0)
Title: Re: [A16] Better Pathfinding (v1.5.2 update 2/22)
Post by: cedec0 on July 24, 2017, 02:51:24 AM
The most frustrating part of Rimworld is that pathing ISN'T broken.  Send a drafted colonist somewhere and he will take the fastest route.  so the game IS capable of finding the best path.

It is UNDRAFTED pathfinding that is completely broken.  (on average, about 2 times slower than drafted pathing, for me at least). 

IS THERE A WAY TO FORCE THE USE OF DRAFTED PATHING FOR EVERYTHING?  Performance isn't an issue for me (extremely powerful computer, 5 colonist, playing mainly on the slowest speed setting).
Title: Re: [A16] Better Pathfinding (v1.5.2 update 2/22)
Post by: Anvil_Pants on July 28, 2017, 11:27:52 AM
Quote from: cedec0 on July 24, 2017, 02:51:24 AM
The most frustrating part of Rimworld is that pathing ISN'T broken.  Send a drafted colonist somewhere and he will take the fastest route.  so the game IS capable of finding the best path.

From my memory (a few weeks old), drafted path finding will happily send the pawn across costly terrain. "Costly" in the sense of how pathing is calculated, with each tile being precalculated for the sum of its movement cost and the path being made across the least costly tiles. E.g., drafted pawns will move linearly across a field of stone chunks, while undrafted pawns will walk around it.

Taking that as true, it says nothing for how broken or not broken either method is. They're different solutions to different needs. Drafted pawn movement is coded to respond immediately to player input. Undrafted pawn movement is responding to AI input. Drafted pawn behavior presumes player micromanagement. AI pawn behavior does not.

We say that long paths are more broken than short paths because it's been apparently shown that the current code begins failing at correctly observing tile movement cost when the destination is far away. I haven't seen code to prove that, though.

Making AI pathing behave like drafted pathing would be simple. Just ignore tile movement cost. Doing that, however, would significantly change (and probably harm) all gameplay mechanics that are contingent to movement costs. Kill boxes would become even more powerful, and non-combat micromanagement would become more necessary.
Title: Re: [A16] Better Pathfinding (v1.5.2 update 2/22)
Post by: lude on November 12, 2017, 07:08:58 AM
It's also drafted behavior, it's just not as evident, just go start an ice sea sheet map 400x400 and try to hunt something on the edge, it'll be a frustrating experience, even if drafted and sent manually the path calculated will not be diagonal but taking a turn every 8 blocks or so and then straight, i've also noticed a few other pathfinding issues dealing with stockpile zones, construction, awareness of reachable items in certain situations and i noticed that in busy games with long paths it occasionally happens that pawns will just stand still and try to get a new path very often without actually trying to follow through. A pity I need to raze the whole jungle just so I can walk better.
tl;dr
start ice sea 400x400 sent from a to b drafted will do the same pathing as non drafted over 50+ or even less

A pity the pathfinding can kill you on harder difficulties, lots of odd wtf moments. Good that there's debug eh cheating tools.
Title: Re: [A16] Better Pathfinding (v1.5.2 update 2/22)
Post by: Nightinggale on November 12, 2017, 09:18:28 AM
We all know A17 has severely broken pathfinding (optimization gone wrong) and that A18 has better pathfinding. Since A18 is out as unstable already, reviving this thread is a bit pointless.
Title: Re: [A16] Better Pathfinding (v1.5.2 update 2/22)
Post by: RemingtonRyder on November 12, 2017, 12:52:54 PM
Actually, the pathfinding in A18 is still a bit wonky at long distance.
Title: Re: [A16] Better Pathfinding (v1.5.2 update 2/22)
Post by: droidfreak36 on November 26, 2017, 03:38:10 AM
The pathfinding seems completely unchanged for long paths. Within a few minutes of jumping into a game, I caught a pawn doing one of those awkward zig-zags they always used to do, and willfully walk over sandbags while doing it. Still very much broken. I'd appreciate an update of this mod because bad pathing makes my brain hurt. I could try to fake it with PathAvoid, but it just wouldn't be the same.
Title: Re: [A16] Better Pathfinding (v1.5.2 update 2/22)
Post by: Alenerel on December 03, 2017, 06:20:28 PM
What happened to zhentar? Is he ded?
Title: Re: [A16] Better Pathfinding (v1.5.2 update 2/22)
Post by: ProfZelonka on December 03, 2017, 11:06:36 PM
Need this in B18! :o
Title: Re: [A16] Better Pathfinding (v1.5.2 update 2/22)
Post by: VeeCee on December 03, 2017, 11:37:26 PM
Yep, I really do miss this mod. Watching my pawns run through trees and take paths through water instead of walking on the land next to it gets a bit frustrating. I'd give a left arm for this in B18... not my left arm, granted. Someone else's... there are plenty of arms out there to give.  ;D
Title: Re: [A16] Better Pathfinding (v1.5.2 update 2/22)
Post by: Mst on December 04, 2017, 06:42:06 PM
A16. So no one took it up since? Haven't played myself after a16, can't wait to get back to the rim.
Does anyone know any substitute for this mod or unofficial update?
Title: Re: [A16] Better Pathfinding (v1.5.2 update 2/22)
Post by: SpawnTD on December 05, 2017, 04:05:23 PM
I dont understand, why the core has such a bad pathfinding.

Title: Re: [A16] Better Pathfinding (v1.5.2 update 2/22)
Post by: Nightinggale on December 05, 2017, 04:09:50 PM
Quote from: SpawnTD on December 05, 2017, 04:05:23 PM
I dont understand, why the core has such a bad pathfinding.
Great pathfinding -> high CPU load and low frame rate
Poor pathfinding -> reduced CPU load and higher framerate

Vanilla has attempted to increase performance in pathfinding, but broke it in A17. They claim to have fixed it in A18 (now B18) and while it's better, when it comes to long distance travel, it's still worse than this patch.

The real solution would be to get pathfinding done right, order the route and then let another thread plan it. That way even though the CPU load itself is not lowered, it is spread across multiple CPU cores.
Title: Re: [A16] Better Pathfinding (v1.5.2 update 2/22)
Post by: ProfZelonka on November 08, 2019, 12:55:18 PM
Anyone by chance want a stab at this for 1.0?

It's quite surprising how bad the pathfinding is for core. Compare the path finding of classic games like Command & Conquer, apparently on Tiberian Sun they ran into huge pathfinding issues but were able to come up with a solution and it really made the series since.
Title: Re: [A16] Better Pathfinding (v1.5.2 update 2/22) Can someone update this to 1.1
Post by: SAG on March 15, 2020, 06:18:21 AM
Can someone update this to 1.1 royalty?
Title: Re: [A16] Better Pathfinding (v1.5.2 update 2/22)
Post by: gendalf on October 07, 2020, 02:16:47 PM
is there an alternative for a recent game version or is this no longer necessary?