'Make until you have (range)'

Started by Nopkar, November 08, 2014, 07:48:26 PM

Previous topic - Next topic

Nopkar

would it be possible to code in a range amount for jobs? Take meals for instance. right when someone eats my cook drops what they're doing and runs to make that one extra meal to fill the quota. in larger colonies that's not such a problem because a dedicated cook can be allocated but in smaller colonies I have to resort to the NPD so I have more labor available. With the advent of refrigeration in some mods there's no longer a need to keep a precise amount of meals on hand, so not having the 'exact' amount is acceptable.

It's possible to finesse this with making extra's and then setting the 'make until' lower but still, a range function where they make until they have the maximum but don't start till it hits the minimum amount would ease the micromanagement.

mrofa

Im not sure, you want a option to make untill thers certian number of meals in storage ?
If so then this is in vanillia i think its from a5 version
All i do is clutter all around.

Nopkar

Quote from: mrofa on November 09, 2014, 05:27:25 AM
Im not sure, you want a option to make untill thers certian number of meals in storage ?
If so then this is in vanillia i think its from a5 version

Make until you have : 25 meals

you lose ONE meal, the cook runs to the stove and makes that 25th again. rinse and repeat.

Make until you have : 6-20

The cooks works until 20 meals but doesn't pick up work again until she detects 6 or less.

sorry if that wasn't clear

Tynan

Understood. It is something I want, conceptually, but it's actually quite tricky because of the way the AI is structured. Essentially, the AI has no way of transferring information between 'jobs', which means every decision to make food is totally independent of the one before. This can, of course be feasibly solved. I'm just very wary of adding any complexity to the AI. It is already by far the most complex and difficult-to-maintain system in the game.
Tynan Sylvester - @TynanSylvester - Tynan's Blog

mrofa

Quote from: Nopkar on November 09, 2014, 07:48:08 PM
Quote from: mrofa on November 09, 2014, 05:27:25 AM
Im not sure, you want a option to make untill thers certian number of meals in storage ?
If so then this is in vanillia i think its from a5 version

Make until you have : 25 meals

you lose ONE meal, the cook runs to the stove and makes that 25th again. rinse and repeat.

Make until you have : 6-20

The cooks works until 20 meals but doesn't pick up work again until she detects 6 or less.

sorry if that wasn't clear

Ahh sorry my bad :D
This is actually to op idea , it would save soo much time of a cook ;p

Quote from: Tynan on November 10, 2014, 01:15:45 AM
Understood. It is something I want, conceptually, but it's actually quite tricky because of the way the AI is structured. Essentially, the AI has no way of transferring information between 'jobs', which means every decision to make food is totally independent of the one before. This can, of course be feasibly solved. I'm just very wary of adding any complexity to the AI. It is already by far the most complex and difficult-to-maintain system in the game.

Cant that info be transfered in recipe or workbench ?
All i do is clutter all around.

Nopkar

Quote from: Tynan on November 10, 2014, 01:15:45 AM
Understood. It is something I want, conceptually, but it's actually quite tricky because of the way the AI is structured. Essentially, the AI has no way of transferring information between 'jobs', which means every decision to make food is totally independent of the one before. This can, of course be feasibly solved. I'm just very wary of adding any complexity to the AI. It is already by far the most complex and difficult-to-maintain system in the game.

oh, okies! wonderful. As long as its on the table that's fine, seemed so useful it was a crime not to be added. and its neat to see you in the mod section tynan!

Riph

Quote from: Tynan on November 10, 2014, 01:15:45 AM
Understood. It is something I want, conceptually, but it's actually quite tricky because of the way the AI is structured. Essentially, the AI has no way of transferring information between 'jobs', which means every decision to make food is totally independent of the one before. This can, of course be feasibly solved. I'm just very wary of adding any complexity to the AI. It is already by far the most complex and difficult-to-maintain system in the game.

If I may hurl uneducated speculations at you for just a moment, a suggested solution:

Player sets a "Make until you have 6-20" request as noted earlier in the thread.
The game records this internally as "Make until you have 20" and the cook runs over and cooks until there is 20.  Now, the check you add, is "Is this the last item in the batch order?" which I'm foolishly guessing is pretty easy.  Each time the cook cooks, he compares the current stocks 18.. 19.. 20.. to the target number which is 20.  There is no change in behavior until he hits the last item in the batch order.  At 20, the table sets its internal cook order to 6.

Nothing happens until the stocks hit 5, at which point the cook returns to the table.  Now the second change, is a second check to see if the current batch quantity is the low or the high.  The cook returns, and the game compares the current 6 internal number to the 20 we stored earlier.  It sees a difference, and sets the internal value from 6 to 20.

The cook now cooks to 20.  The last item check is made, and the internal value is set to 6.

System now takes care of itself, and it only makes checks during the beginning of each job execution.

Riph

On a totally unrelated note, this feature (make until x) is primarily responsible for me being unable to play Dwarf Fortress anymore. ;)  Going back now I have no idea how I ever put up with having to queue up things like food and drink production over and over and over again.

RawCode

Its possible to implement such feature without any changes to AI or core files.

As far as i understand RimWorld's code - pawns actively seek what to do.
And they to it every tick vs every other object.

Every time pawn perform request "can i do something with you "thing"" that thing expose it's billstack and pawn check every bill in list and start to do first valid bill found.
Ever suspended bills are parsed and control passed to that bills.
So it's possible to suspend and resume bills due to internal logic stored inside given bill.

Sadly billstack feature no virtual methods, so no way to proxy billstack and implement "make range" without making new bill type.

Changing "ShouldDoNow" of "bill" class and adding single boolean field "returnrangemode" will allow suggested feature without any more changes.

As long as bill inside "returnrangemode" it merely suspended (no need to add one more state), when range is exceeded it resumed and continue normal operation.
It wont enter "returnrangemode" before first fail due to reaching max value.

Minor modifications to GUI and viola - ranged task is done.

ps i will make demo mod on weekend or sooner with custom bill that do this (with proper GUI).

Matthiasagreen

I would definitely like to see if this is implemented, as I suggested this about a week back.
Hi, my name is Matthias and I am a Rimworld Addict. It has been five seconds since my last fix...

SEND THE SQUIRELLS!!!!

Quote from: mrofa on November 10, 2014, 01:58:48 AM
Quote from: Nopkar on November 09, 2014, 07:48:08 PM
Quote from: mrofa on November 09, 2014, 05:27:25 AM
Im not sure, you want a option to make untill thers certian number of meals in storage ?
If so then this is in vanillia i think its from a5 version
ha! i just created an UBER QUOTE!!!!!!!!!!!!!!!!!!!!! 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8)
Make until you have : 25 meals

you lose ONE meal, the cook runs to the stove and makes that 25th again. rinse and repeat.

Make until you have : 6-20

The cooks works until 20 meals but doesn't pick up work again until she detects 6 or less.

sorry if that wasn't clear

Ahh sorry my bad :D
This is actually to op idea , it would save soo much time of a cook ;p

Quote from: Tynan on November 10, 2014, 01:15:45 AM
Understood. It is something I want, conceptually, but it's actually quite tricky because of the way the AI is structured. Essentially, the AI has no way of transferring information between 'jobs', which means every decision to make food is totally independent of the one before. This can, of course be feasibly solved. I'm just very wary of adding any complexity to the AI. It is already by far the most complex and difficult-to-maintain system in the game.

Cant that info be transfered in recipe or workbench ?
heloooooo children......................................

Tynan

I actually thought of a way to do it. Just model it like this:

When checking for jobs, if the worker is right beside the work table, check the upper bound, otherwise check the lower bound.
Tynan Sylvester - @TynanSylvester - Tynan's Blog

mrofa

"Right beside the bench" wont it make pawn to come to bench just to check in the first place ?
All i do is clutter all around.

Tynan

No. It just means he'll ignore the bill if he is not already beside the bench.
Tynan Sylvester - @TynanSylvester - Tynan's Blog

Tertnes

Quote from: Tynan on November 10, 2014, 11:32:14 AM
I actually thought of a way to do it. Just model it like this:

When checking for jobs, if the worker is right beside the work table, check the upper bound, otherwise check the lower bound.

If the bill is set to deliver to stockpile, I assume the job is finished when the meal is dropped off. Wouldn't that cause an issue if the stockpile is too far from the stove?