Hauling suggestion.

Started by Rock5, December 09, 2016, 04:39:16 PM

Previous topic - Next topic

Rock5

I just had an idea.

Currently if colonist A is is looking for a job to do and sees an item nearby that needs to be hauled, but it is already reserved by colonist B, then colonist A ignores it, even though colonist B is all the way across the map.

If a player sees this and decides to micromanage it he will interrupt colonist B and order colonist A to do the hauling. Why can't the game do this as well.

What the game should do, when looking for a job for colonist A, is when it sees the item that is reserved it should check to see if colonist A is closer than the colonist that has it reserved. If it is it should switch to colonist A. I can't see any downside to this. Sure colonist B might have traveled most of the way to the item but it's still going to save time if colonist A is closer.

I hope I made myself clear enough. I sometimes have trouble making myself understood.
Rock5 [B18] Mods
- Butchers Can Count Meat
- Sun Lamp Planner
- JTZoneButtons
- RimSearch
- JTExport

MAKAIROSI

That's all good for simple stuff like hauling and cleaning and chopping wood. But it would be a disaster for more advanced jobs like construction or doctoring. I put my best doctor operate on a patient, and let the other doctors handle the simple bandages. If what you say was at play, then my best doctor (who is at the other side of the map) would stop, and the operation would be done by someone who isn't as good. Disaster.

Illusion Distort

For hauling this seems to be a good idea, but it could increase computing in a large colony to the point that you would almost be forced to turn it off.

Rock5

Quote from: Illusion Distort on December 13, 2016, 04:49:49 PM
For hauling this seems to be a good idea, but it could increase computing in a large colony to the point that you would almost be forced to turn it off.
Hm... Not really. The only extra processing it would do is to consider an object or job that is already reserved. How many reserved items can there be on a map? At most 1 for every colonist. So if you have 20 colonists then there will only be 20 extra items to be considered at most. I guess that would be per colonists but still, considering how much calculations are already done, I don't think it will be that much extra.
Rock5 [B18] Mods
- Butchers Can Count Meat
- Sun Lamp Planner
- JTZoneButtons
- RimSearch
- JTExport

Zebukin

Agree with topicstarter.
The same and deeper with switches.
If 5 switches are close to each other, they are not require 5 people. They require one.

The same with hauling milk. Hauler got 6 milk and go. Even if he walk nearby with another 6 milk, he just ignores and pass. So there should be radius of search.
1st: get the first item
2nd: get the second and search more like it happens now now.
3rd: pathfinding makes path.
4th: if hauler is not full and can carry N more, precalculation starts: all tiles around path with radius R will be searched for the same item untill the algorytm will find N free (not assigned to other haulers) items. All items that found, will be marked like assigned to prevent others to start drag them.
If assigned item found, AI will check what path is longer: path of the 1st hauler or 2*Path of the second (or even time, we know their speed). If 1st is better, the item will be reassigned to the 1st.
If not, algorythm stop search temporary and mark this spot. Just because the second will carry all other items.
5th: After reaching this spot, check again if item is there and assigned 2nd hauler is far than 1/2 way of the 1st hauler.
If so, and 1st hauler can get all item(s), the assignation of the 2nd hauler will be break, and the seach 4th will resume (if first hauler can carry some more).

This is raw algorythm I just thought, and it should be checked and polished twicw at least =)

JuicyPVP

Quote from: MAKAIROSI on December 13, 2016, 12:12:26 PM
That's all good for simple stuff like hauling and cleaning and chopping wood. But it would be a disaster for more advanced jobs like construction or doctoring. I put my best doctor operate on a patient, and let the other doctors handle the simple bandages. If what you say was at play, then my best doctor (who is at the other side of the map) would stop, and the operation would be done by someone who isn't as good. Disaster.

Not if in the operation Bill you change the minimum medicine skill. Because your best doctor would be the only one who meets the bill requirements.

MikeLemmer

Quote from: MAKAIROSI on December 13, 2016, 12:12:26 PM
That's all good for simple stuff like hauling and cleaning and chopping wood. But it would be a disaster for more advanced jobs like construction or doctoring. I put my best doctor operate on a patient, and let the other doctors handle the simple bandages. If what you say was at play, then my best doctor (who is at the other side of the map) would stop, and the operation would be done by someone who isn't as good. Disaster.
This is solved simply by stopping the algorithm from overriding manually-assigned tasks.

On a sidenote, here's some other suggestions:

Currently hauling priority is determined solely by proximity to job. This often leads to colonists ignoring cargo pods outside the base, leading to decomposing/rotting supplies. I would prioritize rotting hauls, then decomposing hauls, and then stable hauls.

Zebukin

The next thing. Stock optimising.
Look at the picture. Full stack is 600 (with Stack XXL mod, just because without it one tile can carry 3kg of potato.)
So here we need a priority: hauler will put in the biggest stack first, and get from the smallest one.

Very useful  good stock system Gnomoria have: Boxes with list of item, Stock list, that can be sorted by item.
Check this game and check how haulers work there, so the next thing...

The next thing is multithread hauling:
If we need to haul from stock A to stock B 100 items and three haulers can carry only 30 (I am using trained animals for it, dogs can`t carry much), so...
Create main transport route from A to B that should transfer 100. We know the quantity at the start for caravans and droppods at least. For stocks it should be calculated approximal, like this: we have 5 free tiles on stock B. 100 items will get 2 tiles (core game), but now 4 haulers are already dragging 4 different things to stock B. So potentially we have 1 free tile and transport route drops to 75 from 100.

Then create 1 sub-route. First hauler. How much he can carry? 30? ok. Now we have 75 in main route and 30 in subroutes. 75-30>0, we need more haulers. Assign another one to the same A-stock, to the same square/stack of items.
Repeat until main route quantity will be filled/overfilled with haulers abilities.

Now, when only one hauler can be assigned for 1 stack is pretty slow and wrong.
Also the distance to hauler (at least simple radius) should be checked too.
But precalculated patmap will work faster and better. Just because it is precalculated. Ask author of Better pathfinding about it. I think, he is know a lot about.

[attachment deleted by admin due to age]

Zebukin

Quote from: JuicyPVP on January 12, 2017, 01:24:27 PM
Quote from: MAKAIROSI on December 13, 2016, 12:12:26 PM
That's all good for simple stuff like hauling and cleaning and chopping wood. But it would be a disaster for more advanced jobs like construction or doctoring. I put my best doctor operate on a patient, and let the other doctors handle the simple bandages. If what you say was at play, then my best doctor (who is at the other side of the map) would stop, and the operation would be done by someone who isn't as good. Disaster.

Not if in the operation Bill you change the minimum medicine skill. Because your best doctor would be the only one who meets the bill requirements.

I am using WorkTab mod, and there I can set detailed, who can make operations for people and animals.
Sadly, such operation like «give him some smokeweed» is counts like operation too, not like «feed him». But... May be it is realistic: only qualified doctor can give some booze and weed to the patient  ;D

Also skill level for the operation is good too. Even better.

Rock5

I'm noticing that colonist are doing exactly what I suggested in the opening post, i.e. automatically dropping tasks to let someone closer do it. I'm necroing this old topic just to say, I'm so grad to see my suggestion was implemented. :)
Rock5 [B18] Mods
- Butchers Can Count Meat
- Sun Lamp Planner
- JTZoneButtons
- RimSearch
- JTExport