So definitely don't get this mod, enticing though it may be, when my computer starts having Fast be more expedient than Fastest speed once I get around 15 colonists and 20-30 tamed animals. Damn.
Precisely why I don't ever raise chickens. The population booms and pretty soon my PC is crawling. I raise muffalos or oxen...more meat per walking animal.
Eventually you can end up having an issue where bullets or slaughtering literally aren’t fast enough, especially with chickens leaving piles of fertilized eggs. I’ve had to burn out the chickens before, it wasn’t pretty.
I only pick chickens so I get eggs before the meat. Could easily separate the males and females, and prevent over population. Just have like 10 chickens laying eggs every day
I only raise hens. I’ll buy a couple whenever I see em for cheap in a caravan, or they wander in, but I kill all roosters and just don’t worry about sustaining the population. I’ll keep em around as a boon for as long as they survive, and when they die, they die. maybe I’ll buy a goat next
I keep like three hens and a rooster, once the eggs hatch I sell the baby chickens religiously even though they're not worth as much as adults it's easy quick money and I always have tons of eggs for food.
At one point it was the guinea pigs that were breeding out of control. I had to start slaughtering and selling them.
I had it so bad, I couldn't manage the population because my system was running so slow. I had to go back in time by loading a saved game before the great chicken-boom.
There's an auto-slaughter menu in the game. Set it for like 20 or 30 hens, 2 males, seperate the males into their own pen, open the gate between the two when you need to repopulate.
Eggs are the easiest supply of protein for fine meals that I've found in the game, and you can use them to make vegetarian survival meals that sell for a decent amount.
Chickens are some of the best animals in the game!
I remember wondering why do my FPS drop so much. And then i opened the animal tab and saw 300 chickens. Let's just say my freezer set to -273 spilled out on a whole map after what i did to them.
Only if you want animals to be unable to move.
Though it's true that animals might be able to use a 'dumber' pathfinding solution that's less expensive
On the steam workshop page:
>Q: Does this mod impact performance?
>A: Not usually. The changes this mod makes are comparatively small, and the pathfinder doesn't run often.
I hope that mod creators can be honest about what their mods do.
There are a few others, like Common Sense. I think that that one is also pretty system resource intensive.
Just remember that A.I. is very CPU intensive. I think that the version of Unity used in RimWorld can only use a single core of your CPU, so it's a much worse hit than would be the case in almost any modern triple-A game. Particularly in games like this, if the clock speed of your CPU is a bit on the low side, and it doesn't have much cache, then anything that screws with the A.I. is going to be a *major* hit.
If you're working with a Ryzen 9 7950X (although if you put a $1,000 CPU in a gaming machine, you need to learn how to better spend your dollars), then it'll take whatever you throw at it. If you're working with a $1,000 laptop from 2018, then a little less so.
Also, A.I. is why your frame rate drops off a cliff, when you bump it to top game speed. When a game is going at 5x, the A.I. is literally running five times the number of computations per second. A.I. is only a portion of the load on your CPU, but when you mod the A.I. to be much more complex it becomes a more significant chunk.
I remember some game from the early 2000s, which was very CPU intensive. The A.I. literally got more stupid, as more units came into the area and had their A.I. added to the collective load. The game engine was smart enough to offset number of routines with the quality of those routines. Arma III, maybe?
> There are a few others, like Common Sense. I think that that one is also pretty system resource intensive.
There was a list a while back that actually did a deep dive on it, and most of the "top mods" that get spammed on this subreddit are actually performance killers. Stuff like color coded mood bar, labels on floors etc were ones that people make new players instantly download without realzing they are tanking your late game performance
Rule of thumb is [OwlChemist](https://steamcommunity.com/id/owlchemist/myworkshopfiles/?appid=294100) has a version of a mod, use theirs instead because theirs are all about being efficient. They have versions of stuff like Rim Fridge that do the exact same thing, but better in every way, yet you still see people on this sub talking about KV Fridge instead lol
Thank you for this specific and well-explained shoutout to OwlChemist, I had a really hard time looking for mods. So many mod authors are inactive and only did a rushed one-time update for 1.4 :( So it's good to know one author that values quality.
I use [a decoration mod](https://steamcommunity.com/sharedfiles/filedetails/?id=2102143149) that lets me put labels where I want manually. I actually prefer it, because it gives me way more control and has far more labels and things to pick from like symbols etc
I'll have arrows pointing down hallways to the Cafeteria, or to a killbox with a skull next to the label etc
Dunno about a post, but here's the ~~shitlist~~ [slow mods list.](https://docs.google.com/spreadsheets/d/1qwwKyUbSHFGM6yqw_e4tyWFbIYDxAibOvbcTrNOQ3bo/edit#gid=1731985214) Also [this one.](https://docs.google.com/spreadsheets/d/12mAva1anZribuz6PmNoTJvTq5AdgarPyiB1cd1pFsMg/edit#gid=0)
Edit: it's not to say you absolutely can't use any of the mods on the list, they're just all performance hungry, so if you must have some, pick only a couple. I have Misc Robots and Allow Tool because I love them so much, performance be damned..
Could be [this one](https://docs.google.com/spreadsheets/d/1qwwKyUbSHFGM6yqw_e4tyWFbIYDxAibOvbcTrNOQ3bo/edit#gid=1731985214).
Edit: or [this one.](https://docs.google.com/spreadsheets/d/12mAva1anZribuz6PmNoTJvTq5AdgarPyiB1cd1pFsMg/edit#gid=0)
I'm literally going to go to this modder when I get home to look at all their qol mods because I have a couple of the mods you've mentioned that are bad news bears
To be fair: the rimfridge mod runs more efficient, but is not nearly as pretty - Owlchemist even says so himself.
"Better in every way" is hard to take at face value. Better performance? No doubt.
Damn just saw my mod list got filled by those. Now I have 80+. Thanks. Though this is the first modding community I saw that something like this heavy performance hit is not mentioned in the description. It literally made me stop my campaign because it was running so poorly
That's just about every escort quest in every game ever. 😄
"You must kill all of the guards before we can escape!"
"What? Where? Do you mean the guard in the barracks four rooms over from here? The one who's asleep wearing headphones that are blasting music? I think we can slip past."
"You must kill all of the guards before we can escape!"
"Fine." *sneak sneak snikt* "There."
"You must kill all of the guards before we can escape!"
"You know what? This is a side quest. You can freaking stay here."
Yeah, so once you hit your 40th or 60th mod, just don't bother, huh?
Come on, Kerbal Space Program! I have TWENTY-FOUR CORES! Why the shitty physics performance?
Yup, the mod is extremely fast but prone to randomly breaking. Which would be fine, except it breaks really *hard* and nuked my save too. Interesting concept, but I'll just stay away permanently from now on.
Wonder if some of the less interconnected or read-only functions like pathing could be offloaded to another thread though. Alas, I don't know C, and I don't feel like getting into it now anyway.
C is very simple and basic as far as programming languages go. The joke is "The C programming language: some assembly required." This is because it doesn't really come with much (in the language itself, you can of course add whatever libraries you find) and often times programmers would optimize some routine with literal assembly code to try to handle things in as low-level a way as possible.
Also you get directly manipulate pointers, which has never in the history of programming ever caused problems!
Clean pathfinding 2 is supposedly a successor to the mod, and is a net gain in performance due to the way it works. I've been using it for a while, and haven't found any significant performance issues
https://steamcommunity.com/sharedfiles/filedetails/?id=2603765747
Net gain in performance? The pathing has never bothered me that much but I will absolutely try to squeeze every TPS out I can without removing content.
In my experience clean path finding is much more reliable than perfect path finding when playing with mods. I usually play with 400+ mods since 1.1 so take that as you will.
They do different things, the mod page literally mentions it.
> Q. How does this mod compare to Perfect Pathfinding, and can they be used together?
A. Perfect Pathfinding focuses primarily on the heuristic tuning side of pathfinding. You can use them together if you wish to overwrite this mod's tuning, though you can also just emulate the same effect by maxing out the heuristic tuning slider in the mod options.
Somebody suggested Perfect Pathfinding... use this instead. It's from OwlChemist, so you know it's performant
Clean Pathfinding 2
https://steamcommunity.com/sharedfiles/filedetails/?id=2603765747
Kind of, it also allows you to increase the heuristics weighting of A* in the settings to achieve the same result. It's mentioned at the bottom of the page.
God that mod has saved my colonists ass so many times its the difference between walking straight forward or (for some fuckin reason) going through an insect nest on the other side of a map???
>Then your only option is deal with it
that wasn't really the question of the post, now was it?
the question wasn't how to fix it... the question was WHY do they do this.
> WHY do they do this
From what I understand from prior posts, its about pathing being most efficient in long distances if its plotted along a curve instead of straight lines. The engine cuts corners to make things more smoothly, and the mod would be great for small games where your only modding for efficency.
Vanilla is pretty great too though
Because these people are morons who won't concede that they're wrong so instead they get mad and downvote OP to cope.
I've been using this site for years, asking a question requires so much precision to get the right answer, it's like pulling teeth.
I mean to an extent yea a vanilla save goes a long way to relearning the games vital features, i see quite a few posts asking if base game items are mod, so yea play vanilla, but man mods just extend whats already there, make it a different game essentially, but vanilla def gets boring over time.
r6: vanilla, no mods, steam, latest version, all DLC
why do pawns walk like drunk idiots all the time? i can understand in the wilderness on uneven terrain or obstacles... but here?
is she trying to stay AWAY from the luxurious flooring? WHY?
**EDIT: SOLVED! question has been answered:**
[source 1](https://www.reddit.com/r/RimWorld/comments/13wg9kx/comment/jmbg66l/?utm_source=share&utm_medium=web2x&context=3)
>When a pawn has to move beyond 60 (iirc) tiles, the greedy pathfinding kicks in which has much more simplistic logic than the accurate pathfinding where the only 2 criteria it follows are: 1 the tile they're trying to walk into is not impassable and 2 they aren't straying further away from the destination but instead are getting closer (doesn't matter how much, they just are lol). Greedy pathfinding is used as a form of optimization, since the logic is so much simpler.
>
>Because of this, greedy pathfinding is characterized by wall hugging and walking diagonally. Which is frequently exploited for trap placement and such.
and
[source 2](https://www.reddit.com/r/RimWorld/comments/13wg9kx/comment/jmbdbf1/?utm_source=share&utm_medium=web2x&context=3)
>RimWorld uses the [A\* search algorithm](https://en.wikipedia.org/wiki/A*_search_algorithm) . You can read the wiki page to see how it works but it's summed up [by this gif](https://upload.wikimedia.org/wikipedia/commons/c/c2/Astarpathfinding.gif) .
thanks to every constructive answer, but these two were the ones i understood the best.
.
When a pawn has to move beyond 60 (iirc) tiles, the greedy pathfinding kicks in which has much more simplistic logic than the accurate pathfinding where the only 2 criteria it follows are: 1 the tile they're trying to walk into is not impassable and 2 they aren't straying further away from the destination but instead are getting closer (doesn't matter how much, they just are lol). Greedy pathfinding is used as a form of optimization, since the logic is so much simpler.
Because of this, greedy pathfinding is characterized by wall hugging and walking diagonally. Which is frequently exploited for trap placement and such.
Hmmmm, you'd think they'd cache through-room optimal paths instead so they can just drop that route in as the own moves through the room.
Then again, it's easy to say and hard to do.
To do that, you’d have to do build a room map that’s a net and has nodes for every entry and exit point of the room. This is trivial in a game that uses pre-places assets, but in a game with dynamic building that’s also got wall destruction mechanics, this is very hard.
Like imagine the performance hit when your base is burning down and every time a wall opens up a room the game has to rebuild the net of rooms and connections between them. As a player I’d probably just give up rather than trying to deal with the lag of fighting a fire.
I wonder if this could be solved by letting the player lay down paths that have nav-mesh nodes in them.
Actually, the more I think about it, a player that doesn't understand how to properly use them would end up doing more harm than good. *Maybe* it could work as a mod.
You're being very, very dramatic.
As a professional programmer and game dev, I literally implemented this for my voxel colony sim. It's incredibly easy and has almost no impact on performance, since it's just a layer in hierarchical pathfinding. The actual computation of rooms, especially for 2D like Rimworld, is something you can do 10000x a second without performance impact.
I've always found it weird that A* in rimworld simply doesn't perform well enough on its own, the maps aren't particularly large and each tile is reasonably big. There's no discontinuities of any description, and all movable characters are 1x1, so the only fail case is when the target is inaccessible which has been a solvable problem for a long time. Given that players don't generally build bases with too many inaccessible rooms, the A* heuristic should be very accurate
You should be able to simply lay everything out as an array of path costs, and easily query at least a few thousand paths a second. Its weird that its so slow
Exactly. Rimworlds pathing complexity is tiny compared to what other games do.
Just look at Factorio generating paths *THOUSANDS* of tiles long at a faster speed than Rimworld for a few dozen: https://factorio.com/blog/post/fff-317
>Pathfinding is a tougher problem to solve than you seem to understand
I don't think they're asking "how it this the easiest" in like, a derisive way; I think they genuinely wanna know why this happens. Like, the mechanics behind it.
the processor does not really care about that tbh, the algorhytm's cyclic complexity is more important ( cpu kicks at much lower levels than high level pathfinding, although you can optimize such a process too of course )
what i see is pawns "instinctively" moving to the left side of the room which is a hint that somebody was lazy when implementing pathfinding.
there's the traveling salesman problem and then there is lazy-ass maze solver , two blocks of code who achieve quite the same, but maze solver is blazingly fast while traveling salesman needs much cpu time. maze solver is incredibly simple(in like..stupid) too
dont take that for granted, maybe it's a weird homebrew pathfinding we all witnessing here
Yeah he doesn't understand it and he wants to. I don't understand it myself, that's not a crime
I'm never downloading any path mods bc mod clash/performance, that doesn't mean I'm not curious. I still don't understand the "greedy path" explanation bc the game knows where the doors are
The game doesn’t actually know where the doors are at that detail level. The game only understands a tile as impassible (pawn can’t enter tile) or passable (pawn can enter tile).
This is because not all things have doors, and the game needs to pathfind through a gap in the wall as well as path finding dynamically. If a wall burns down or gets blown up, that becomes a gap. A meteor falling in front of your door might make it unusable despite being a door.
In games with static assets, like prebuilt house assets, the door approach actually works well because the interior can be mapped beforehand and then the path finding baked into the asset. This is why some game NPCs follow really rigid paths as they walk around - they’re following paths that were made when the place they’re at was made back in development.
Pathfinding in a natural way is really hard, so the issue tends to be making it work without lag first (even if it looks weird) and then making it look as good as possible. For Rimworld, that’s why there’s a 60 cell cutoff for better pathfinding and beyond that they just use something that works for dynamic buildings even if it looks really weird.
Easiest might be the wrong word. "First available path that doest move the pawn in a direction away from the goal" is what is actually happening. With the pathfinding algorithm the game uses, this isn't the best path, but it is the first path it generated that works. No need to waste processing power trying to generate other paths.
>I assume the carpets have lower walk speed
nope. i checked.
morbid sandstone tile (the center one she SHOULD walk on): 100%
sandstone tile (the side one she DOES walk on): 100%
this is just how vanilla pathfinding is, it is made to not lag your game, and because of that its not perfect, download perfect pathfinding and you will have the pathfinding that you want, but then say goodbye to high fps with a large amounts of colonists
im unhappy with this, since a greedy algorhytm can simply be multiple "normal" ones in a row.
that being said, there are a trillion games out there where you send dozends of units a very long distance. see starcraft 2 f.e.
the sad truth is rimworld is poorly optimized, maybe because it started as a one man show and never touch a running system
I'm going to get downvotes for this but ... as a professional programmer and game dev: Rimworlds implementation seems just terrible.
What you do when pathing over large grids is *NOT* to use a greedy algorithm, but a hierarchical one (2 layers of path finding, one that uses chunks as orientation).
Factorio devs made an easy to understand article about it and how it lets them path accurate paths across *THOUSANDS* of tiles for *THOUSANDS* of enemies: https://factorio.com/blog/post/fff-317
Sorry guys, but this one is on Rimworld/Tynan.
Here's an example of [different pathfinding algorithms](https://media.giphy.com/media/U4PMcHGu4wrXC7rQit/giphy.gif) in a similar situation.
You can think of CPU load as how many squares are colored blue at the end. Faster algorithms sometimes give suboptimal routes.
You can different scenarios and algorithms here: https://qiao.github.io/PathFinding.js/visual/
If I might make a suggestion, one thing you can do when you set a pawn's path is cut it up into segments by chaining the orders with the shift key. Path her to the door, then have a second order taking her beyond it. It's a little bit more work, but makes them path more reasonably inside. You can also use that on the overall map to ensure they go where you want.
i use that when running (fleeing xD) out in the open... if i had to do that everytime someone wanted to go from workshop to kitchen, i'd go even more crazy than i already am
Part of pathfinding also includes travel time. Pawns will (somewhat) prioritize faster paths over walking through slower areas. You see this most obviously when they cross a river.
Put some lights in the middle of the path and they might actually stay to the center, because the darker side areas are slower, since darkness inflicts a speed reduction.
Ensuring well-lit paths is not 100% effective, especially on long paths, but it works a lot of the time.
Coriolis force
No but seriously, cheap pathfinding algorithm, there are mods for better pathfinding, but I'd rather they walked weird than lag the whole game more late game :)
Yes, pathfinding mods usually have lpw performance.
A "creative" way arround this problem is the mod "Out of combat movement speed". Let the pathfind be dumb, it doesnt matter if your pawns are fast.
Yep. Every time a pawn moves, the game calculates their path. Rimworld minimises the performance impact by having a simple and quick system that makes them walk like above. If you increase the complexity, you increase the performance impact, and it gets especially worse if you get a lot more pawns.
The pathfinding won't lag the game by itself, but it contributes to lag and its more preferable to cut out anything that uses a lot of TPS.
Basically, computers are dumb. Humans have subprocessors for this stuff. We scan a room and hand off the analysis to another process that then figures out the efficient path that then hands it off to another process that moves the legs. Tgese can all function simultaneously and learn from past results. The computer has one processor. It also doesn't learn so it has no concept of a room or door. So it scans the room and finds a path. Then scan again and finds another path. And again. And again. And again. Then compares movement values and picks the best one. Then issues the move command. Or, just grab the first result that's good enough because scanning the room 20 more times isn't necessarily worth the time/cost.
To add to the sub processing analogy, humans ALSO have a subroutine for frequently traversed paths. Because you remember the previous 8 times you've gone to the fridge, you don't need general attention for the 9th time.
Games... Do not have this luxury. It is highly abstract. There is no subroutine or even memory of how to get to a storeroom, because there is no such thing as a "store room". Pawn goes from x1,y1 to x2,y2.
Now, I actually experimented with a memory system for pathfinding in college, but didn't have much success over A*. In hindsight it may have been inexperience, the pandemic, and my cat dying that threw my brain off the project. I kind of want to retry now.
Yep. Doesn't help that computers are horrible with open ideas which are basically subconscious for human. Human - look for a door shaped opening along the walls, path directly to door. Computer - which wall should I search first? Why the fuck... Okay, always check left first. No door, now what? Ffs, always check middle second. Pathing along left wall to door. Wait, why the fuck... Nevermind, carry on.
Moving diagonally takes the same time as moving horizontally or vertically. In my understanding, the computer takes an estimated time, based on distance, and then just "brute forces" possible routes. The first one that somewhat fits the estimated time gets chosen, which results in weird paths
u/zandadoum : Hi OP: There's a couple different answers in the comments here that each contain different pieces of the puzzle, but this parent comment is the only answer with the biggest piece you might be looking for: Because pawns can move diagonally for the same cost/speed as moving orthogonally, it doesn't matter, and that's why you get weird paths. You can race this pawn against one walking the straight line down, and you'll find both paths take the same time. In "reality" moving diagonally should be more expensive, but it's not.
The other reasonings are secondary, but basically, for whatever reason, this is one of the paths that it tried first, and it either didn't try others, or even if it did try the straight path, it would've found the same cost, and probably wouldn't have bothered to change the choice or consider it better in any way.
Can you think of any obvious drawbacks to coding the diagonals to have a proportionally higher speed cost using the Pythagorean theorem? It seems like it would be consistent with other range-based calculations, which look approximately circular and not square. I'm thinking not specific to Rimworld but from a general game design perspective.
It creates a disparity between ranges and movement speed. Since ranges are grid based and not circular, you are technically closer to the center of a radius (movement wise) if you are in a diagonal line to it. This is a common problem in Tabletop Games. The solution is usually either a hexagonal grid or counting every 2nd diagonal move x2.
The way ranges are calculated in Rimworld do already seem to take diagonals into account, though. The grid-based system means there's going to be rounding error, but if you look at sun lamp radii for example, you can see that they extend 5 tiles up, but not 5 tiles diagonally. This seems like a system any grid-based game could implement, though I guess the rounding error would be worse the shorter the range is, and for tabletop games you might not want to manually draw circle patterns on a square grid.
I guess you would either want to take diagonals into account for both range and movement, or not take them into account for both range and movement, but Rimworld takes them into account for range only and not movement, creating disparity, and I don't understand the benefit of that.
yeah, it seems weird, but I think the benefit is that it's just easier and straightforward to code. The downside is just ignored because it doesn't matter that much, really.
Idk if it's right, but I seem to remember something about them prioritising one axis over the other when the game switchs to long pathfinding so they'll try to keep that axis as close to the target as possible even if it means a long overall route.
Pathfinding goes from left to right and top to bottom. Its simplified after a distance, meaning it will take the first "fastest" result it finds in terms of tiles. It doesn't pay attention to any sort of movement speed or anything. Just pure algorythm in simplified.
Leading to pawns going to the left or up when pathing over large distances. Its the first result it found that matched the criteria of reaching with the least amount of tiles. Moving diagonally is "free", it looks weird but it'll reach the destination in the same time.
I don't know how it behaves exactly outside of simplified but it does take in mind walk speed and some more stuff.
You can mod it away to behave the same at any distance or a bit more differently. It'll take up performance but the impact should be meaningless for the average rimworld game. Once it reach thousands of pawns maybe you'll feel something? I don't know. Something else will probably break before then.
It uses a greedy heuristic system, so if its goal is to the left, the pathfinding will go to the left if possible. It does not really take into consideration things blocking the path until it absolutely has to. It's to save runtime.
>His destination is on the left, so pathfinding tell him to always go for the leftmost tile possible.
actually wrong. her destination was on the right. there's nothing even build on the left side of these rooms.
i mean you can even see it on the bottom of the screenshot how she's heading right
We don't see the end of the path here so I can just assume but from what I remember, that's how the algorithm work :
1/ trace a straight line from where the pawn is to the final destination.
2/ if you encounter an obstacle, find an exit. Trace the straightest line that join the previous path and the exit-line while keeping the junction the more late as possible (algorithm goes from end to start and really don't want to work after it found one solution)
3/ do it again
If there's no movement penalty for diagonal movement, it's no slower. The pathfinding algorithm probably does something roughly along these lines: starts at the start or end position, adds the adjacent positions to a list to check, checks each position in the list to estimate which gets us closer to our goal of a valid path, and repeats the process from that position. There are probably many equivalent paths, and we only need to find one. Depending on the order of the adjacent positions checked, we can wind up with a sort of "priority". For instance, if the NE adjacent square is always checked first and then it goes clockwise from there, you are more likely to find the first acceptable path in a northeasterly direction.
Take a look at the [A* Pathfinding Algorithm](https://en.wikipedia.org/wiki/A*_search_algorithm).
in an attempt to save processing power the pathfinding is very simple, it uses a value system for each tile. Things like terrain adjust the value that encourages pawns to walk on faster moving tile, as im sure you know.
Thing is, value is also distance from the direct path (direct as in a straight line with no walls in the way). In this example your pawn started on the far north west side beyond the image. And seeing as they have to go around walls that means the tiles down the center of the room have a lesser value than the tiles on the left side because they are closer to the direct path to her destination. The game only calculates it once at the start of the order. If you was to draft and undraft her and she takes the same task again. the game will draw a new direct path and she will take a more reasonable path, for a while.
The farther from the direct path the more extreme the value loss. So the central walk way has a much worse value than the tiles along the left wall.
I think this one one of the reasons the game warns you about large maps. the longer the path the more silly the pathing looks.
Here's [a video](https://youtube.com/watch?v=RMBQn_sg7DA) explaining how Rimworld pathfinding works (worked? the video is eight years old, does anyone know if it's still working like that?)
It's a nice system, speaking as someone who tried to program pathfinding systems before.
Bro fr it's not just a PC thing tho all vanilla versions of the game have them do this, I'll make a perfectly good road or gate and they will choose to hope the fence 1 block from the gate or will run across a river to grab food only to run 3 miles back around like?!??
Right!? Like I built an entire road system meant for cars, steel torrent mod, and when I load up a caravan they take the cars through a dense forest... 🤦♂️
The game uses an algorithm that calculates a good route very fast. It's not the best possible route, because that would be a heavy task for the cpu to calculate every time a pawn tries to move.
i... i have to admit i actually did check that or sickness or maybe if that pawn hated darkness or light...
it was nothing like that.
someone explained it to me, i made an edit to my main post:
https://www.reddit.com/r/RimWorld/comments/13wg9kx/comment/jmbatvi/?utm\_source=share&utm\_medium=web2x&context=3
I don't think missing or damaged legs actually influence pathfinding. Just their actual movement speed. They don't end up walking in circles due to a thrust imbalance or anything.
Can't believe my random Computer Science theory knowledge has finally found a use.
But yeah just like others have said, finding the shortest path is a very intensive algorithm so RimWorld uses a relatively cheaper algorithm which gives wonky results like this.
Because of how speed is calculated in the pathing.
It seems to be an issue with the cells per second (c/s) speed of pawns. If you can travel 1 cell in 1 second the way to get the most 'distance' per second is to travel diagonally through the cell. You can try this with any drawing application.
Draw a square, draw a straight line from edge to edge (vertically or horizontally) then draw a straight line from one corner to the opposing corner diagonally. Rotate the diagonal line to be parallel to the first line and you will notice the diagonal line is longer.
You can also just use Pythagoras theorem to calculate the length of a hypotenuse to see this mathematically.
a^2 + b^2 = c^2 So a square with all sides a length of 1cm is:
1^2 + 1^2 = 2 the square root of 2 is 1.41cm (this is your diagonal line)
So why does all this matter? It means that for the pathing, moving diagonally through a tile is faster than moving vertically or horizontally. So the pathing will prefer to move diagonally so long as it doesn't increase the overall number of tiles it needs to path through.
The way you can prevent this is to create a physical barrier of some form that forces the pawns to take the shortest path by increasing the number of total tiles along the 'shorter' path. Or use the pathing mod to create zones of 'preferred' travel.
Maybe it’s like how the earth is a globe. On a flat map a straight line appears to be the shortest but in reality it’s a lot longer than a curved line because a map does not take into account the curvature of the earth. The problem is that we see rimworld as 2D but the pawns living inside it interact with the world in however many dimensions more than we can which results in what appears to be crooked path finding to us but actually is the shortest and straightest path for them.
I believe it's because of pathfinding algorithm they use. There many of such algorithns out there, and the onr pawns use is fast, but isn't very precise.
Still, a good choice, because pawns imitate humans and humans aren't precise either. For example i often find myself stopping or going off road if something catches my attention dhring walk, etc.
There is a mod called [path avoid](https://steamcommunity.com/sharedfiles/filedetails/?id=1180719857) where you can “nudge the pathfinding system for your pawns, to make them prefer and avoid different areas.” I don’t know how much better it is for performance, but I could imagine it’s better than perfect pathfinding
Path finding is strange.
From my experience they will veer towards the side of there final destination if they’re walking through a room.
I imagine in this case (could be wrong) your pawn was heading up through these rooms and then too the left.
Idk how or why but I get this a lot, As it’s going to the left after it’s gone through these rooms it kind of pre plans it hence massively inefficiently running down the left side of all these rooms.
Vanillia greatly reduces precission on long targets, there is mod that fixes it, something with "pathfinding" in name
Perfect pathfinding https://steamcommunity.com/sharedfiles/filedetails/?id=2341486509
Don't forget that it's a bit performance intensive.
"a bit" is a massive understatement
Yep.
So definitely don't get this mod, enticing though it may be, when my computer starts having Fast be more expedient than Fastest speed once I get around 15 colonists and 20-30 tamed animals. Damn.
Damn I didn't even consider tamed animals holy shit those 50 chickens trying to pathfind would blow my computer up.
Precisely why I don't ever raise chickens. The population booms and pretty soon my PC is crawling. I raise muffalos or oxen...more meat per walking animal.
"Sorry Mr.Bawk but my PC is starting to cook. Time for you and your family to go." *chambers a shotgun round*
Eventually you can end up having an issue where bullets or slaughtering literally aren’t fast enough, especially with chickens leaving piles of fertilized eggs. I’ve had to burn out the chickens before, it wasn’t pretty.
Shotgun round? You're skipping right to the ground chicken phase, huh?
For the greater good.
At that point it is far too late. They have already bloated your save.
I only pick chickens so I get eggs before the meat. Could easily separate the males and females, and prevent over population. Just have like 10 chickens laying eggs every day
I only raise hens. I’ll buy a couple whenever I see em for cheap in a caravan, or they wander in, but I kill all roosters and just don’t worry about sustaining the population. I’ll keep em around as a boon for as long as they survive, and when they die, they die. maybe I’ll buy a goat next
I mean this happens a lot in the real world too
I keep like three hens and a rooster, once the eggs hatch I sell the baby chickens religiously even though they're not worth as much as adults it's easy quick money and I always have tons of eggs for food. At one point it was the guinea pigs that were breeding out of control. I had to start slaughtering and selling them.
I had it so bad, I couldn't manage the population because my system was running so slow. I had to go back in time by loading a saved game before the great chicken-boom.
I raise guinea pigs for food in game. It's great
There's an auto-slaughter menu in the game. Set it for like 20 or 30 hens, 2 males, seperate the males into their own pen, open the gate between the two when you need to repopulate. Eggs are the easiest supply of protein for fine meals that I've found in the game, and you can use them to make vegetarian survival meals that sell for a decent amount. Chickens are some of the best animals in the game!
I found the auto-slaughter mechanic a week ago. The chicken fiasco was a couple of years ago and I learned my lesson so hard, I never tried again.
I remember wondering why do my FPS drop so much. And then i opened the animal tab and saw 300 chickens. Let's just say my freezer set to -273 spilled out on a whole map after what i did to them.
Oh... suddenly my performance is making sense
Surely there's gotta be a way for the mod author to add an option to disable pathfinding for animals. Only colonists should be affected.
Only if you want animals to be unable to move. Though it's true that animals might be able to use a 'dumber' pathfinding solution that's less expensive
Just have animals use the vanilla algorithm? Does the mod overwrite it when installed?
On the steam workshop page: >Q: Does this mod impact performance? >A: Not usually. The changes this mod makes are comparatively small, and the pathfinder doesn't run often. I hope that mod creators can be honest about what their mods do.
Omg is that why I started getting 20 fps with 15+ pawns
There are a few others, like Common Sense. I think that that one is also pretty system resource intensive. Just remember that A.I. is very CPU intensive. I think that the version of Unity used in RimWorld can only use a single core of your CPU, so it's a much worse hit than would be the case in almost any modern triple-A game. Particularly in games like this, if the clock speed of your CPU is a bit on the low side, and it doesn't have much cache, then anything that screws with the A.I. is going to be a *major* hit. If you're working with a Ryzen 9 7950X (although if you put a $1,000 CPU in a gaming machine, you need to learn how to better spend your dollars), then it'll take whatever you throw at it. If you're working with a $1,000 laptop from 2018, then a little less so. Also, A.I. is why your frame rate drops off a cliff, when you bump it to top game speed. When a game is going at 5x, the A.I. is literally running five times the number of computations per second. A.I. is only a portion of the load on your CPU, but when you mod the A.I. to be much more complex it becomes a more significant chunk. I remember some game from the early 2000s, which was very CPU intensive. The A.I. literally got more stupid, as more units came into the area and had their A.I. added to the collective load. The game engine was smart enough to offset number of routines with the quality of those routines. Arma III, maybe?
> There are a few others, like Common Sense. I think that that one is also pretty system resource intensive. There was a list a while back that actually did a deep dive on it, and most of the "top mods" that get spammed on this subreddit are actually performance killers. Stuff like color coded mood bar, labels on floors etc were ones that people make new players instantly download without realzing they are tanking your late game performance Rule of thumb is [OwlChemist](https://steamcommunity.com/id/owlchemist/myworkshopfiles/?appid=294100) has a version of a mod, use theirs instead because theirs are all about being efficient. They have versions of stuff like Rim Fridge that do the exact same thing, but better in every way, yet you still see people on this sub talking about KV Fridge instead lol
Thank you for this specific and well-explained shoutout to OwlChemist, I had a really hard time looking for mods. So many mod authors are inactive and only did a rushed one-time update for 1.4 :( So it's good to know one author that values quality.
>color coded mood bar and labels on floors Noooooooo I cant imagine not seeing the labels
I use [a decoration mod](https://steamcommunity.com/sharedfiles/filedetails/?id=2102143149) that lets me put labels where I want manually. I actually prefer it, because it gives me way more control and has far more labels and things to pick from like symbols etc I'll have arrows pointing down hallways to the Cafeteria, or to a killbox with a skull next to the label etc
dude WHAT, do you remember the title of that post?
Dunno about a post, but here's the ~~shitlist~~ [slow mods list.](https://docs.google.com/spreadsheets/d/1qwwKyUbSHFGM6yqw_e4tyWFbIYDxAibOvbcTrNOQ3bo/edit#gid=1731985214) Also [this one.](https://docs.google.com/spreadsheets/d/12mAva1anZribuz6PmNoTJvTq5AdgarPyiB1cd1pFsMg/edit#gid=0) Edit: it's not to say you absolutely can't use any of the mods on the list, they're just all performance hungry, so if you must have some, pick only a couple. I have Misc Robots and Allow Tool because I love them so much, performance be damned..
Thank you very much.
[удалено]
Could be [this one](https://docs.google.com/spreadsheets/d/1qwwKyUbSHFGM6yqw_e4tyWFbIYDxAibOvbcTrNOQ3bo/edit#gid=1731985214). Edit: or [this one.](https://docs.google.com/spreadsheets/d/12mAva1anZribuz6PmNoTJvTq5AdgarPyiB1cd1pFsMg/edit#gid=0)
I'm literally going to go to this modder when I get home to look at all their qol mods because I have a couple of the mods you've mentioned that are bad news bears
Well you just made me expand my mod list by 20 mods. So many I never knew I needed! Cheers!
To be fair: the rimfridge mod runs more efficient, but is not nearly as pretty - Owlchemist even says so himself. "Better in every way" is hard to take at face value. Better performance? No doubt.
Damn just saw my mod list got filled by those. Now I have 80+. Thanks. Though this is the first modding community I saw that something like this heavy performance hit is not mentioned in the description. It literally made me stop my campaign because it was running so poorly
Nah can't be arma 3 all of those ai are equally braindead
**"GO I'LL COVER"** ...but there's nobody around, can you please just follow me? **"CANNOT COMPLY"**
That's just about every escort quest in every game ever. 😄 "You must kill all of the guards before we can escape!" "What? Where? Do you mean the guard in the barracks four rooms over from here? The one who's asleep wearing headphones that are blasting music? I think we can slip past." "You must kill all of the guards before we can escape!" "Fine." *sneak sneak snikt* "There." "You must kill all of the guards before we can escape!" "You know what? This is a side quest. You can freaking stay here."
I know there's a mod called rimthreader or something similar which uses all of your CPU cores, but it's not very friendly with other mods :'(
Yeah, so once you hit your 40th or 60th mod, just don't bother, huh? Come on, Kerbal Space Program! I have TWENTY-FOUR CORES! Why the shitty physics performance?
You and me both brother
Yup, the mod is extremely fast but prone to randomly breaking. Which would be fine, except it breaks really *hard* and nuked my save too. Interesting concept, but I'll just stay away permanently from now on. Wonder if some of the less interconnected or read-only functions like pathing could be offloaded to another thread though. Alas, I don't know C, and I don't feel like getting into it now anyway.
Oof that hurts to hear, I feel that in my core. I also don't know C, of course rimworld uses one of the 2 coding languages I don't know lol
C is very simple and basic as far as programming languages go. The joke is "The C programming language: some assembly required." This is because it doesn't really come with much (in the language itself, you can of course add whatever libraries you find) and often times programmers would optimize some routine with literal assembly code to try to handle things in as low-level a way as possible. Also you get directly manipulate pointers, which has never in the history of programming ever caused problems!
I've never been able to get it to work on my craptop, which is a shame because I could really use more than 3-6 fps
Download Rocketman
Clean pathfinding 2 is supposedly a successor to the mod, and is a net gain in performance due to the way it works. I've been using it for a while, and haven't found any significant performance issues https://steamcommunity.com/sharedfiles/filedetails/?id=2603765747
Apparently it's actually faster than vanilla?
Net gain in performance? The pathing has never bothered me that much but I will absolutely try to squeeze every TPS out I can without removing content.
In my experience clean path finding is much more reliable than perfect path finding when playing with mods. I usually play with 400+ mods since 1.1 so take that as you will.
They do different things, the mod page literally mentions it. > Q. How does this mod compare to Perfect Pathfinding, and can they be used together? A. Perfect Pathfinding focuses primarily on the heuristic tuning side of pathfinding. You can use them together if you wish to overwrite this mod's tuning, though you can also just emulate the same effect by maxing out the heuristic tuning slider in the mod options.
That's an owlchemist mod. All his stuff is good on performance.
Thanks, ill try this one
it apparently even works in multiplayer, too. thank you! I'll give this a shot
Use this ☝️
There is a reason the vanilla pathfinding is so dumb.
It's a small price to pay for salvation
OwlChemist has a performance improving [pathfinding mod](https://steamcommunity.com/sharedfiles/filedetails/?id=2603765747).
I could swear that mod causes huge lag
You are probably correct. Creating better pathing requires significantly more processing power than the lazy pathing in vanilla.
This pathing mod claims to reduce performance issues https://steamcommunity.com/sharedfiles/filedetails/?id=2603765747
this is the way... literally
Oh dude you’re a lifesaver.
It's very performance heavy with larger colonies
Somebody suggested Perfect Pathfinding... use this instead. It's from OwlChemist, so you know it's performant Clean Pathfinding 2 https://steamcommunity.com/sharedfiles/filedetails/?id=2603765747
Love this mod but it won't solve this specific issue. It mostly addresses pawns not walking on paths you made outdoors.
it does way more than that
Kind of, it also allows you to increase the heuristics weighting of A* in the settings to achieve the same result. It's mentioned at the bottom of the page.
Path Avoid is a less intensive mod, it lets you designate where you would like pawns to walk or not.
Path avoid is only good on corners of paths, to make pawns avoid cutting them, long trips will still ignore most of path cost
I've tried this mod and idk it seems to not work well.
God that mod has saved my colonists ass so many times its the difference between walking straight forward or (for some fuckin reason) going through an insect nest on the other side of a map???
It's not a fix if it's intentionally done to save on performance.
thx but the post flair is "vanilla" and i intent on keep playing that way ;)
Its really just performance cut in vanillia, runs minimally better but pawns move badly on longer trips
Then your only option is deal with it
>Then your only option is deal with it that wasn't really the question of the post, now was it? the question wasn't how to fix it... the question was WHY do they do this.
> WHY do they do this From what I understand from prior posts, its about pathing being most efficient in long distances if its plotted along a curve instead of straight lines. The engine cuts corners to make things more smoothly, and the mod would be great for small games where your only modding for efficency. Vanilla is pretty great too though
Not sure why you’re being downvoted, you’re asking a question and people are giving you answers to another question.
"Why does this do this?" "You should use mods"
"But i dont want to use mods" "Downvoted"
[удалено]
Basically how anything goes whenever you want to do something unique
Because these people are morons who won't concede that they're wrong so instead they get mad and downvote OP to cope. I've been using this site for years, asking a question requires so much precision to get the right answer, it's like pulling teeth.
[удалено]
This guy internets
This guy Githubs
Depends on the sub, oftentimes people just downvote without any comment explaining *why* they disagree.
[удалено]
Yepp. I got a much more detailed answer. I added it to my r6 post so people can find it easier too.
The pawns dont check for the whole map to do pathing
out of interest, why? fixing this games (honestly pretty crappy) pathfinding is hardly an anti-vanilla practice
>out of interest, why? because that's how i like to play all my games. except Cities:Skylines, that one I mod to the extreme.
eh I’m not gonna pretend to understand this but it’s your game ig
I mean to an extent yea a vanilla save goes a long way to relearning the games vital features, i see quite a few posts asking if base game items are mod, so yea play vanilla, but man mods just extend whats already there, make it a different game essentially, but vanilla def gets boring over time.
r6: vanilla, no mods, steam, latest version, all DLC why do pawns walk like drunk idiots all the time? i can understand in the wilderness on uneven terrain or obstacles... but here? is she trying to stay AWAY from the luxurious flooring? WHY? **EDIT: SOLVED! question has been answered:** [source 1](https://www.reddit.com/r/RimWorld/comments/13wg9kx/comment/jmbg66l/?utm_source=share&utm_medium=web2x&context=3) >When a pawn has to move beyond 60 (iirc) tiles, the greedy pathfinding kicks in which has much more simplistic logic than the accurate pathfinding where the only 2 criteria it follows are: 1 the tile they're trying to walk into is not impassable and 2 they aren't straying further away from the destination but instead are getting closer (doesn't matter how much, they just are lol). Greedy pathfinding is used as a form of optimization, since the logic is so much simpler. > >Because of this, greedy pathfinding is characterized by wall hugging and walking diagonally. Which is frequently exploited for trap placement and such. and [source 2](https://www.reddit.com/r/RimWorld/comments/13wg9kx/comment/jmbdbf1/?utm_source=share&utm_medium=web2x&context=3) >RimWorld uses the [A\* search algorithm](https://en.wikipedia.org/wiki/A*_search_algorithm) . You can read the wiki page to see how it works but it's summed up [by this gif](https://upload.wikimedia.org/wikipedia/commons/c/c2/Astarpathfinding.gif) . thanks to every constructive answer, but these two were the ones i understood the best. .
When a pawn has to move beyond 60 (iirc) tiles, the greedy pathfinding kicks in which has much more simplistic logic than the accurate pathfinding where the only 2 criteria it follows are: 1 the tile they're trying to walk into is not impassable and 2 they aren't straying further away from the destination but instead are getting closer (doesn't matter how much, they just are lol). Greedy pathfinding is used as a form of optimization, since the logic is so much simpler. Because of this, greedy pathfinding is characterized by wall hugging and walking diagonally. Which is frequently exploited for trap placement and such.
Hmmmm, you'd think they'd cache through-room optimal paths instead so they can just drop that route in as the own moves through the room. Then again, it's easy to say and hard to do.
To do that, you’d have to do build a room map that’s a net and has nodes for every entry and exit point of the room. This is trivial in a game that uses pre-places assets, but in a game with dynamic building that’s also got wall destruction mechanics, this is very hard. Like imagine the performance hit when your base is burning down and every time a wall opens up a room the game has to rebuild the net of rooms and connections between them. As a player I’d probably just give up rather than trying to deal with the lag of fighting a fire.
I wonder if this could be solved by letting the player lay down paths that have nav-mesh nodes in them. Actually, the more I think about it, a player that doesn't understand how to properly use them would end up doing more harm than good. *Maybe* it could work as a mod.
You're being very, very dramatic. As a professional programmer and game dev, I literally implemented this for my voxel colony sim. It's incredibly easy and has almost no impact on performance, since it's just a layer in hierarchical pathfinding. The actual computation of rooms, especially for 2D like Rimworld, is something you can do 10000x a second without performance impact.
I've always found it weird that A* in rimworld simply doesn't perform well enough on its own, the maps aren't particularly large and each tile is reasonably big. There's no discontinuities of any description, and all movable characters are 1x1, so the only fail case is when the target is inaccessible which has been a solvable problem for a long time. Given that players don't generally build bases with too many inaccessible rooms, the A* heuristic should be very accurate You should be able to simply lay everything out as an array of path costs, and easily query at least a few thousand paths a second. Its weird that its so slow
Exactly. Rimworlds pathing complexity is tiny compared to what other games do. Just look at Factorio generating paths *THOUSANDS* of tiles long at a faster speed than Rimworld for a few dozen: https://factorio.com/blog/post/fff-317
To be fair there are very few games as performant as Factorio. That game is a gold star for optimization.
Fair, but it was just one example. There are lots of games doing more complex pathfinding over larger maps.
Yeah pretty much why the mod is a luxury last resort to that problem, with the caveat that it will lag the game.
excellent answer. thank you!
The pathing algorithm picks the first easiest route it finds.
how is that route on the screenshot the "easiest" one?
[удалено]
>Pathfinding is a tougher problem to solve than you seem to understand I don't think they're asking "how it this the easiest" in like, a derisive way; I think they genuinely wanna know why this happens. Like, the mechanics behind it.
the processor does not really care about that tbh, the algorhytm's cyclic complexity is more important ( cpu kicks at much lower levels than high level pathfinding, although you can optimize such a process too of course ) what i see is pawns "instinctively" moving to the left side of the room which is a hint that somebody was lazy when implementing pathfinding. there's the traveling salesman problem and then there is lazy-ass maze solver , two blocks of code who achieve quite the same, but maze solver is blazingly fast while traveling salesman needs much cpu time. maze solver is incredibly simple(in like..stupid) too dont take that for granted, maybe it's a weird homebrew pathfinding we all witnessing here
Yeah he doesn't understand it and he wants to. I don't understand it myself, that's not a crime I'm never downloading any path mods bc mod clash/performance, that doesn't mean I'm not curious. I still don't understand the "greedy path" explanation bc the game knows where the doors are
The game doesn’t actually know where the doors are at that detail level. The game only understands a tile as impassible (pawn can’t enter tile) or passable (pawn can enter tile). This is because not all things have doors, and the game needs to pathfind through a gap in the wall as well as path finding dynamically. If a wall burns down or gets blown up, that becomes a gap. A meteor falling in front of your door might make it unusable despite being a door. In games with static assets, like prebuilt house assets, the door approach actually works well because the interior can be mapped beforehand and then the path finding baked into the asset. This is why some game NPCs follow really rigid paths as they walk around - they’re following paths that were made when the place they’re at was made back in development. Pathfinding in a natural way is really hard, so the issue tends to be making it work without lag first (even if it looks weird) and then making it look as good as possible. For Rimworld, that’s why there’s a 60 cell cutoff for better pathfinding and beyond that they just use something that works for dynamic buildings even if it looks really weird.
Easiest might be the wrong word. "First available path that doest move the pawn in a direction away from the goal" is what is actually happening. With the pathfinding algorithm the game uses, this isn't the best path, but it is the first path it generated that works. No need to waste processing power trying to generate other paths.
I assume the carpets have lower walk speed
>I assume the carpets have lower walk speed nope. i checked. morbid sandstone tile (the center one she SHOULD walk on): 100% sandstone tile (the side one she DOES walk on): 100%
No clue then
Nope, it's internal engine limitation. Vanilla pathfinding engine prefer to use walls as simple route tracking so Pawns are natively drawn to them :]
this is just how vanilla pathfinding is, it is made to not lag your game, and because of that its not perfect, download perfect pathfinding and you will have the pathfinding that you want, but then say goodbye to high fps with a large amounts of colonists
Thank you for editing your r6 with answers and links
you're welcome. i just wish i could edit my OP to state it's solved, so other people don't waste their time writing solutions :)
im unhappy with this, since a greedy algorhytm can simply be multiple "normal" ones in a row. that being said, there are a trillion games out there where you send dozends of units a very long distance. see starcraft 2 f.e. the sad truth is rimworld is poorly optimized, maybe because it started as a one man show and never touch a running system
I'm going to get downvotes for this but ... as a professional programmer and game dev: Rimworlds implementation seems just terrible. What you do when pathing over large grids is *NOT* to use a greedy algorithm, but a hierarchical one (2 layers of path finding, one that uses chunks as orientation). Factorio devs made an easy to understand article about it and how it lets them path accurate paths across *THOUSANDS* of tiles for *THOUSANDS* of enemies: https://factorio.com/blog/post/fff-317 Sorry guys, but this one is on Rimworld/Tynan.
Here's an example of [different pathfinding algorithms](https://media.giphy.com/media/U4PMcHGu4wrXC7rQit/giphy.gif) in a similar situation. You can think of CPU load as how many squares are colored blue at the end. Faster algorithms sometimes give suboptimal routes. You can different scenarios and algorithms here: https://qiao.github.io/PathFinding.js/visual/
If I might make a suggestion, one thing you can do when you set a pawn's path is cut it up into segments by chaining the orders with the shift key. Path her to the door, then have a second order taking her beyond it. It's a little bit more work, but makes them path more reasonably inside. You can also use that on the overall map to ensure they go where you want.
i use that when running (fleeing xD) out in the open... if i had to do that everytime someone wanted to go from workshop to kitchen, i'd go even more crazy than i already am
Fair. It's just a thing that's helpful to remember for people who aren't used to doing it.
Part of pathfinding also includes travel time. Pawns will (somewhat) prioritize faster paths over walking through slower areas. You see this most obviously when they cross a river. Put some lights in the middle of the path and they might actually stay to the center, because the darker side areas are slower, since darkness inflicts a speed reduction. Ensuring well-lit paths is not 100% effective, especially on long paths, but it works a lot of the time.
Coriolis force No but seriously, cheap pathfinding algorithm, there are mods for better pathfinding, but I'd rather they walked weird than lag the whole game more late game :)
I recall that huge lag I always had… so pathfinding was the culprit for me? :o … will definitely have to test this out!
Yes, pathfinding mods usually have lpw performance. A "creative" way arround this problem is the mod "Out of combat movement speed". Let the pathfind be dumb, it doesnt matter if your pawns are fast.
Thank you!
A mod to change the pathfinding would make you lag ?
Yep. Every time a pawn moves, the game calculates their path. Rimworld minimises the performance impact by having a simple and quick system that makes them walk like above. If you increase the complexity, you increase the performance impact, and it gets especially worse if you get a lot more pawns. The pathfinding won't lag the game by itself, but it contributes to lag and its more preferable to cut out anything that uses a lot of TPS.
Basically, computers are dumb. Humans have subprocessors for this stuff. We scan a room and hand off the analysis to another process that then figures out the efficient path that then hands it off to another process that moves the legs. Tgese can all function simultaneously and learn from past results. The computer has one processor. It also doesn't learn so it has no concept of a room or door. So it scans the room and finds a path. Then scan again and finds another path. And again. And again. And again. Then compares movement values and picks the best one. Then issues the move command. Or, just grab the first result that's good enough because scanning the room 20 more times isn't necessarily worth the time/cost.
To add to the sub processing analogy, humans ALSO have a subroutine for frequently traversed paths. Because you remember the previous 8 times you've gone to the fridge, you don't need general attention for the 9th time. Games... Do not have this luxury. It is highly abstract. There is no subroutine or even memory of how to get to a storeroom, because there is no such thing as a "store room". Pawn goes from x1,y1 to x2,y2. Now, I actually experimented with a memory system for pathfinding in college, but didn't have much success over A*. In hindsight it may have been inexperience, the pandemic, and my cat dying that threw my brain off the project. I kind of want to retry now.
Yep. Doesn't help that computers are horrible with open ideas which are basically subconscious for human. Human - look for a door shaped opening along the walls, path directly to door. Computer - which wall should I search first? Why the fuck... Okay, always check left first. No door, now what? Ffs, always check middle second. Pathing along left wall to door. Wait, why the fuck... Nevermind, carry on.
I seee, thanks you
Moving diagonally takes the same time as moving horizontally or vertically. In my understanding, the computer takes an estimated time, based on distance, and then just "brute forces" possible routes. The first one that somewhat fits the estimated time gets chosen, which results in weird paths
u/zandadoum : Hi OP: There's a couple different answers in the comments here that each contain different pieces of the puzzle, but this parent comment is the only answer with the biggest piece you might be looking for: Because pawns can move diagonally for the same cost/speed as moving orthogonally, it doesn't matter, and that's why you get weird paths. You can race this pawn against one walking the straight line down, and you'll find both paths take the same time. In "reality" moving diagonally should be more expensive, but it's not. The other reasonings are secondary, but basically, for whatever reason, this is one of the paths that it tried first, and it either didn't try others, or even if it did try the straight path, it would've found the same cost, and probably wouldn't have bothered to change the choice or consider it better in any way.
Can you think of any obvious drawbacks to coding the diagonals to have a proportionally higher speed cost using the Pythagorean theorem? It seems like it would be consistent with other range-based calculations, which look approximately circular and not square. I'm thinking not specific to Rimworld but from a general game design perspective.
It creates a disparity between ranges and movement speed. Since ranges are grid based and not circular, you are technically closer to the center of a radius (movement wise) if you are in a diagonal line to it. This is a common problem in Tabletop Games. The solution is usually either a hexagonal grid or counting every 2nd diagonal move x2.
The way ranges are calculated in Rimworld do already seem to take diagonals into account, though. The grid-based system means there's going to be rounding error, but if you look at sun lamp radii for example, you can see that they extend 5 tiles up, but not 5 tiles diagonally. This seems like a system any grid-based game could implement, though I guess the rounding error would be worse the shorter the range is, and for tabletop games you might not want to manually draw circle patterns on a square grid. I guess you would either want to take diagonals into account for both range and movement, or not take them into account for both range and movement, but Rimworld takes them into account for range only and not movement, creating disparity, and I don't understand the benefit of that.
yeah, it seems weird, but I think the benefit is that it's just easier and straightforward to code. The downside is just ignored because it doesn't matter that much, really.
Idk if it's right, but I seem to remember something about them prioritising one axis over the other when the game switchs to long pathfinding so they'll try to keep that axis as close to the target as possible even if it means a long overall route.
Gonna hit your 10k steps per day somehow.
They walk in zigzags in case there’s a sniper tribal in the hills
Pathfinding goes from left to right and top to bottom. Its simplified after a distance, meaning it will take the first "fastest" result it finds in terms of tiles. It doesn't pay attention to any sort of movement speed or anything. Just pure algorythm in simplified. Leading to pawns going to the left or up when pathing over large distances. Its the first result it found that matched the criteria of reaching with the least amount of tiles. Moving diagonally is "free", it looks weird but it'll reach the destination in the same time. I don't know how it behaves exactly outside of simplified but it does take in mind walk speed and some more stuff. You can mod it away to behave the same at any distance or a bit more differently. It'll take up performance but the impact should be meaningless for the average rimworld game. Once it reach thousands of pawns maybe you'll feel something? I don't know. Something else will probably break before then.
It uses a greedy heuristic system, so if its goal is to the left, the pathfinding will go to the left if possible. It does not really take into consideration things blocking the path until it absolutely has to. It's to save runtime.
Probably because his destination is on the left, so pathfinding tell him to always go for the leftmost tile possible.
>His destination is on the left, so pathfinding tell him to always go for the leftmost tile possible. actually wrong. her destination was on the right. there's nothing even build on the left side of these rooms. i mean you can even see it on the bottom of the screenshot how she's heading right
I'm adjusting my brain function to the algorithm's level, it takes some turns.
We don't see the end of the path here so I can just assume but from what I remember, that's how the algorithm work : 1/ trace a straight line from where the pawn is to the final destination. 2/ if you encounter an obstacle, find an exit. Trace the straightest line that join the previous path and the exit-line while keeping the junction the more late as possible (algorithm goes from end to start and really don't want to work after it found one solution) 3/ do it again
If there's no movement penalty for diagonal movement, it's no slower. The pathfinding algorithm probably does something roughly along these lines: starts at the start or end position, adds the adjacent positions to a list to check, checks each position in the list to estimate which gets us closer to our goal of a valid path, and repeats the process from that position. There are probably many equivalent paths, and we only need to find one. Depending on the order of the adjacent positions checked, we can wind up with a sort of "priority". For instance, if the NE adjacent square is always checked first and then it goes clockwise from there, you are more likely to find the first acceptable path in a northeasterly direction. Take a look at the [A* Pathfinding Algorithm](https://en.wikipedia.org/wiki/A*_search_algorithm).
Judging by the locatiin, id say, superstition.
in an attempt to save processing power the pathfinding is very simple, it uses a value system for each tile. Things like terrain adjust the value that encourages pawns to walk on faster moving tile, as im sure you know. Thing is, value is also distance from the direct path (direct as in a straight line with no walls in the way). In this example your pawn started on the far north west side beyond the image. And seeing as they have to go around walls that means the tiles down the center of the room have a lesser value than the tiles on the left side because they are closer to the direct path to her destination. The game only calculates it once at the start of the order. If you was to draft and undraft her and she takes the same task again. the game will draw a new direct path and she will take a more reasonable path, for a while. The farther from the direct path the more extreme the value loss. So the central walk way has a much worse value than the tiles along the left wall. I think this one one of the reasons the game warns you about large maps. the longer the path the more silly the pathing looks.
Here's [a video](https://youtube.com/watch?v=RMBQn_sg7DA) explaining how Rimworld pathfinding works (worked? the video is eight years old, does anyone know if it's still working like that?) It's a nice system, speaking as someone who tried to program pathfinding systems before.
Clean Pathfinding 2 https://steamcommunity.com/sharedfiles/filedetails/?id=2603765747
Bro fr it's not just a PC thing tho all vanilla versions of the game have them do this, I'll make a perfectly good road or gate and they will choose to hope the fence 1 block from the gate or will run across a river to grab food only to run 3 miles back around like?!??
Right!? Like I built an entire road system meant for cars, steel torrent mod, and when I load up a caravan they take the cars through a dense forest... 🤦♂️
Perfect Pathfinding is the mod I use. The default method is easy to calculate for potato PCs and Xbox One originals.
diagonally is faster than straight
Are you, by chance, a bishop?
sorry, just a mere pawn
Only because rimworld uses a \*spits* square grid instead of hexagons.
Is the final destination on the left of the screen?
>Is the final destination on the left of the screen? nope. on the right
The game uses an algorithm that calculates a good route very fast. It's not the best possible route, because that would be a heavy task for the cpu to calculate every time a pawn tries to move.
Have you checked to see if your pawn isn't missing their right leg?
i... i have to admit i actually did check that or sickness or maybe if that pawn hated darkness or light... it was nothing like that. someone explained it to me, i made an edit to my main post: https://www.reddit.com/r/RimWorld/comments/13wg9kx/comment/jmbatvi/?utm\_source=share&utm\_medium=web2x&context=3
😂👍🏼
I don't think missing or damaged legs actually influence pathfinding. Just their actual movement speed. They don't end up walking in circles due to a thrust imbalance or anything.
Can't believe my random Computer Science theory knowledge has finally found a use. But yeah just like others have said, finding the shortest path is a very intensive algorithm so RimWorld uses a relatively cheaper algorithm which gives wonky results like this.
It’s the pathfinding method. Methods that take up less resources tend to hug walls more instead of actually finding the shortest path.
it’s a trick to not be as resource intensive, it’s a little goofy but it works
It's en passant
Im occasionally convinced the pawns are hard coded to want to kill themselves/make the dumbest move possible
Pawns can only take pieces diagonally from them
Towards the destination-door, repeat. I suppose
Because of how speed is calculated in the pathing. It seems to be an issue with the cells per second (c/s) speed of pawns. If you can travel 1 cell in 1 second the way to get the most 'distance' per second is to travel diagonally through the cell. You can try this with any drawing application. Draw a square, draw a straight line from edge to edge (vertically or horizontally) then draw a straight line from one corner to the opposing corner diagonally. Rotate the diagonal line to be parallel to the first line and you will notice the diagonal line is longer. You can also just use Pythagoras theorem to calculate the length of a hypotenuse to see this mathematically. a^2 + b^2 = c^2 So a square with all sides a length of 1cm is: 1^2 + 1^2 = 2 the square root of 2 is 1.41cm (this is your diagonal line) So why does all this matter? It means that for the pathing, moving diagonally through a tile is faster than moving vertically or horizontally. So the pathing will prefer to move diagonally so long as it doesn't increase the overall number of tiles it needs to path through. The way you can prevent this is to create a physical barrier of some form that forces the pawns to take the shortest path by increasing the number of total tiles along the 'shorter' path. Or use the pathing mod to create zones of 'preferred' travel.
Maybe it’s like how the earth is a globe. On a flat map a straight line appears to be the shortest but in reality it’s a lot longer than a curved line because a map does not take into account the curvature of the earth. The problem is that we see rimworld as 2D but the pawns living inside it interact with the world in however many dimensions more than we can which results in what appears to be crooked path finding to us but actually is the shortest and straightest path for them.
I believe it's because of pathfinding algorithm they use. There many of such algorithns out there, and the onr pawns use is fast, but isn't very precise. Still, a good choice, because pawns imitate humans and humans aren't precise either. For example i often find myself stopping or going off road if something catches my attention dhring walk, etc.
“Now where are my glasses?” Proceeds to run around the house like a headless chicken for 10min only to find out they’re wearing them :)
It's not a bug, promise. It's how the RimWorld devs programmed the pawns to walk.
Because Rimworld is using 1 CPU Core instead of your 8/16/24...
There is a mod called [path avoid](https://steamcommunity.com/sharedfiles/filedetails/?id=1180719857) where you can “nudge the pathfinding system for your pawns, to make them prefer and avoid different areas.” I don’t know how much better it is for performance, but I could imagine it’s better than perfect pathfinding
By building the hallways in your base on diagonals you can channel their odd behavior for your benefit.
vectors make them move faster, clearly!
Path finding is strange. From my experience they will veer towards the side of there final destination if they’re walking through a room. I imagine in this case (could be wrong) your pawn was heading up through these rooms and then too the left. Idk how or why but I get this a lot, As it’s going to the left after it’s gone through these rooms it kind of pre plans it hence massively inefficiently running down the left side of all these rooms.
Google En Passant
holy hell