Marking A Prefered Path

Started by The-MathMog, June 15, 2016, 04:52:53 AM

Previous topic - Next topic

The-MathMog

Sometimes it seems the pathfinding is struggling a bit. It often chooses a route over items or sand, when there is a clear walking path that would be a better option.

So it would be nice to be able to "teach" the system some preferred routes. It might actually be harder to implement than on my initial thought, but that is again the problem with not doing coding ;)

But maybe something in the vain of marking a starting spot and an ending location, and then marking an optimal path between those, or simply marking paths that should be used, even if there is a shorter straight path, that is slower though. It shouldn't of course restrict them to ONLY use those paths, but rather making them prefer them if they are close. So maybe use a "check if path is within "xx" squares" or something like that.

Again, let me know if this actually would cause more issues than it solves. It's just a small issue that I've noticed, when my pawns for example is moving through my storage room, and choose to walk over items, instead of on the path.

Another example, is my pawns walking through my freezer to deliver items. It's layout was optimized to let cookers quickly haul raw foods, and then quickly deliver them into another freezer, where that freezer has another door which goes out into the dining room. That layout just creates a shorter route through the freezer which, when 20 pawns walk through it regularly, heats the room up quite a bit.

Fluffy (l2032)

the way I understand it, pathfinding works with a 'pathing cost' for each cell. In a very simplified view, it basically tries to find a route from A to B that has the lowest total pathing cost. I think the reason it sometimes has issues is because this cost isn't always updated.

Anyway, about your suggestion. While directly marking preferred paths from A to B (or X to Z, whatever) is going to be a massive pain in the arse to implement, there's a relatively simple tweak that could be done to achieve mostly the same effect (albeit a bit more roughly). Tynan (or modders, I might just try this myself) should quite easily be able to allow the user to set priority pathing zones to mark areas to be avoided, or preferred areas. This would then be used as an additional cost bit to add to the normal pathing algorithm.

Basically, all cells would default to an extra cost of, say, 5. Preferred areas would have zero extra cost, and areas to be avoided could have 10, or for 'danger zones' even 1000+ extra cost, allowing for some granularity in how far pawns will 'detour'.


Listen1

I believe your suggestion is making a "Pathing brush" so that you can decide where your colonist walks. That's really amazing. I love it.

This is a needed feature, that would not impact the gameplay since the pathing formula would not be altered. I support this ideia and would like it to come true.

The-MathMog

Quote from: Flying Rockbass on June 15, 2016, 09:23:29 AM
I believe your suggestion is making a "Pathing brush" so that you can decide where your colonist walks. That's really amazing. I love it.

This is a needed feature, that would not impact the gameplay since the pathing formula would not be altered. I support this ideia and would like it to come true.

Yes indeed, that is what I meant, but forgot to write haha! Glad you can see some potential in it. Indeed, it would just be a tool that the player can choose to use or not. I would personally only need it for those bigger colonies!

Quote from: Fluffy (l2032) on June 15, 2016, 07:42:16 AM
the way I understand it, pathfinding works with a 'pathing cost' for each cell. In a very simplified view, it basically tries to find a route from A to B that has the lowest total pathing cost. I think the reason it sometimes has issues is because this cost isn't always updated.

Anyway, about your suggestion. While directly marking preferred paths from A to B (or X to Z, whatever) is going to be a massive pain in the arse to implement, there's a relatively simple tweak that could be done to achieve mostly the same effect (albeit a bit more roughly). Tynan (or modders, I might just try this myself) should quite easily be able to allow the user to set priority pathing zones to mark areas to be avoided, or preferred areas. This would then be used as an additional cost bit to add to the normal pathing algorithm.

Basically, all cells would default to an extra cost of, say, 5. Preferred areas would have zero extra cost, and areas to be avoided could have 10, or for 'danger zones' even 1000+ extra cost, allowing for some granularity in how far pawns will 'detour'.


Cool! I imagined it being something that like, but didn't know any details about it! Good to know!
Something like what you suggested is exactly something I would love to see. It would help the player control how the pawns move, without actually restricting them from certain areas!

Vaporisor

The cost system is how dwarf fortress does it actually.  It ups artificially points value of floor so a fast tile now looks like a slow one meaning it is only used if that is only access.  So for freezers, they will only go in if that is objective, etc.
Stories by Vaporisor

Escaped convicts!
concluded
Altair XIII
Frozen Wastes

Ekarus

It would be nice to be able to keep my colonists from tracking dirt every where because it's 'faster' to path through the farm...

Sure, you successfully cut one tile off your trip, but now I've gotta wait for someone else to wander over there to clean the dirt you all seem to be incredibly content with leaving there but will complain to no end about it being "dirty" no mater how high I set your "cleaning" priority... But maybe if we play 'the floor is lava' with the farm they'll stop tracking dirt everywhere...

Drahkon

Could probably just artificially boost the pathing cost for natural flooring, making it prefer not to use it. As I understand it to save cpu cycles the pathfinding doesn't look for the best path, stopping it's search when it finds a 'good enough' one. Having it try constructed flooring before natural may help efficiency in that case.

So I guess that'd be my suggestion, have it look at constructed floors first while pathfinding.

The-MathMog

Quote from: Drahkon on June 15, 2016, 03:15:39 PM
Could probably just artificially boost the pathing cost for natural flooring, making it prefer not to use it. As I understand it to save cpu cycles the pathfinding doesn't look for the best path, stopping it's search when it finds a 'good enough' one. Having it try constructed flooring before natural may help efficiency in that case.

So I guess that'd be my suggestion, have it look at constructed floors first while pathfinding.

Yeah, that would probably be one fix for it.

But I would still love "brush tool", because the above fix, would still give me issues with the freezer and maybe even bedrooms, where pawns keep walking into rooms where people are sleeping. But maybe wandering is using different mechanics for it? Because sometimes they walk to some weird places.. Like, on top of traps..

Listen1

If you have a "No path here tool" or "Only path here" people will no go across a bedroom that has 2 doors. You can make all you bedrooms have four door, which may help in berserk/heart attack pawns.

Without having to worry about "disturbed sleep" or dirtying the hospital, this allow for new safety and planning. Giant corridors that lead to parts of the map, where you have branches to anywhere. That may lead to an optimal path for reaching outdoor cargo pods and such.

I would really love a brush system for optimal pathing. Even the cpu will have a easier time reading the prefered path, since it's already pre-made.

Boosting some types of flood may also work, but some problems will still persist, that can be avoided through the brush tool.

The-MathMog

Quote from: Flying Rockbass on June 16, 2016, 06:50:19 AM
If you have a "No path here tool" or "Only path here" people will no go across a bedroom that has 2 doors. You can make all you bedrooms have four door, which may help in berserk/heart attack pawns.

Without having to worry about "disturbed sleep" or dirtying the hospital, this allow for new safety and planning. Giant corridors that lead to parts of the map, where you have branches to anywhere. That may lead to an optimal path for reaching outdoor cargo pods and such.

I would really love a brush system for optimal pathing. Even the cpu will have a easier time reading the prefered path, since it's already pre-made.

Boosting some types of flood may also work, but some problems will still persist, that can be avoided through the brush tool.

Indeed, good point there too. All in all in would be a good tool to be implemented I think.