[A16] Better Pathfinding (v1.5.2 update 2/22)

Started by Zhentar, October 02, 2016, 07:43:01 PM

Previous topic - Next topic

Zhentar

New version up! Should all of the errors you were running into. Hopefully without causing new ones.

scurvey_cur

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?

Tenshi~Akari

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.  :(

Zxypher

Pawns freezing and spamming the log with indecision errors.

https://gist.github.com/b66edf0286224f39cd59c3a1e156cbcf ~Line 660 when giving a pawn a flick order.

71214n0


Grabarz

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

Dr_Zhivago

#216
Getting the same pawn freezing error since the update

"exception ticking sergei"

https://gist.github.com/HugsLibRecordKeeper/0f7e89af4b3544941e39ccb518a6624a

Zhentar

I've posted a fix for the errors y'all have been seeing.

Tenshi~Akari

#218
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.

Zhentar

Thanks for the quick report, I've posted a fix.

Tenshi~Akari

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.  ;)

Lurmey

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

Rock5

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.


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]
Rock5 [B18] Mods
- Butchers Can Count Meat
- Sun Lamp Planner
- JTZoneButtons
- RimSearch
- JTExport

Kassidoo

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/

mathwizi2005

#224
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]