multi profession building occupants multitasking

inaiwae

Chieftain
Joined
Apr 27, 2021
Messages
24
pretty much title :crazyeye:

I really don't like my coffee driers to just sit around if they run our of coffee fruits after half a day of work ... if there is cocoa pods collecting dusts, I think they can manage a bit of multitasking

in other words, if my city is producing +4 coffee fruits and +3 cocoa pods, being able for my drier to split their time would be welcome, something like this

coffee-cocoa-drier.JPG


perfect solution would be to offer all combination of coffee and cocoa production (i.e. 4/2, 5/1), not just split 50/50

I just started to look into how hard it is to code it in, and it seems it is quite hard just to do 50/50 split (if I understand the code right, it seems that bunch of stuff is hard-coded and assumed for hunter/seal hunter as they are only professions now with this feature) ... so for now I will settle for 50/50 split

now, if I code it just for myself, it'll be quite crude, text hard-coded in English, button pictures won't get any attention and such ... so, I am curious, would this be something WTP can benefit from, i.e. need to be coded nicely ? :nono:
 
I like the idea, but it's near impossible to do with the existing code. The idea with the current code is that it takes the inputs and then it produces the outputs. The building then has a multiplier for how many times it can be done during a single turn. If there are multiple outputs, the current code is currently hardcoded to let the second yield produce 50% of the first (rounded down).

For instance a blacksmith profession takes in ore and outputs tools. That's the profession. The building then says 3, meaning it can be done 3 times each turn. Another building of the same building class can then say 2, 4, 5 or whatever.

I would like to expand on this system as in the profession will get a multiplier as well. Default is 1, but you could set it to 0.42 or 1.5 or whatever. This will allow a profession to have multiple inputs and outputs and be able to set the ratios in xml. This will not be possible without implementation of fixed point math though and that won't happen in the near future. In other words a long term dream project.

This won't solve your issue of having two professions for a single building you want to swap between. Thinking out loud on this, what I could imagine would be a partial automated unit. Right now units are either automated or locked. A partial automated unit would lose the ability to move building or plot, but it would use AI code at the location to pick profession according to what the AI code considers best.

To take your cocoa/coffee example, you would have 3 units working there. They would automatically produce the same, which would be whatever sells for the most in Europe. What has the highest profit in Europe is price * the number of yields processed. Let's say cocoa produces the highest profit. However 3 coffee is still worth more than 1 cocoa and as such the units will change production to optimize. Units are processed one at a time meaning if there are 4 cocoa, the first will process cocoa while the next will consider what to do with just 1 cocoa available. If cocoa is still more profitable, the last unit will consider what to do with no cocoa present, hence swapping to handle the single coffee.

Still not trivial to code, but it has a higher chance of working with the existing code. A single unit doing multiple professions is impossible in our code design (well vanilla) and will require a brand new system written from scratch.
 
  • Like
Reactions: nci
hold my beer :D

seriously, thanks for heads up ... I could see it's not going to be easy, just didn't realize it's nay impossible :badcomp:

I guess, I leave it be for now
 
I could see it's not going to be easy, just didn't realize it's nay impossible :badcomp:

As @Nightinggale already correctly said, the Production logic simply does not work like that.

And my old code for Multiple Professions Per Building is already complicated enough as it is.
(It would maybe not be the best idea to make it even more complicated without need.)

Also, what do you do if the oringal profession produces 5 Yields?
Split it by 2,5 A / 2,5 B? (Currently not possible.)

-----
perfect solution would be to offer all combination of coffee and cocoa production (i.e. 4/2, 5/1), not just split 50/50

Please not, you completely ignore the bonusses (Expertise, Buildings, Founding Fathres ...) :sad:

This sounds like a Socialist Human Ressource Simulator with all exchangable workers that can be shifted around without care.
Civ4Col is built on a much more sophisticated design than that.

More details, see below.

-----

About equal 50 / 50 split for Multiple Profession Per Building.

Theoretically (on first sight) it is not that bad of an idea.
(But check my list below and you will see it is a really bad idea considering code.)

1. Both Yields use the same Expert (which is often the case but not guaranteed in XML)
2. Building has the same Bonusses (flat and modifier) for both Yields
3. There is yet no such Type of Profession and you would need to create a new one that may get issues with LbD (see 2)
4. The Bonusses of Founding Fathers usually only apply to one Yield not 2.
5. What should AI do with this selection?
...

This will get a horrible mess of computation if you want to correctly reflect all Bonusses of Experts, Building, Founding Fathers, ...
This will get a horrible mess in bugfixing / adapting if there would ever be 2 Experts for a Building with Multiple Professions per Building.
(We originally had 2 Experts for every Building with Multiple Professions per Building and nobody knows what cases we might have in the future.)

And personally I do not really even like the gameplay consequeces of it. :sad:
All it does again "reduce the need for thinking, paying attention and managing".
But ok, nobody would force me to use that option so I could simply ignore it. :dunno:

-----


Summary:

Equal 50 / 50 split is thinking too simple. :dunno:
  • You will be coding yourself to death to implement all changes needed for it
  • And it will be extremely prone to errors when XML config for a MPPB-Building changes (e.g. 2 instead of as currently 1 expert)
I am also not a fan of implementing "Socialist Human Ressource Factory Simulator" in Civ4Col.

I really hate it if in professional development engineers are forced to "multitask" like modern slaves and are ripped apart in 8 projects.
I do not like to see such cruelties again human nature and human dignity in our mod. ;)


Or to formulate it different:

gameplay benefit
vs. performance / effort / risk / adaptability ...
(Really really not a good relation in this case.)
 
Last edited:
  • Like
Reactions: nci
This sounds like a Socialist Human Ressource Simulator with all exchangable workers that can be shifted around without care.
Civ4Col is built on a much more sophisticated design than that.
Actually that is precisely what the AI is doing. Players can activate the AI code by clicking the lock button on each citizen. Unlocked citizens will be moved around each turn as the AI views as best.

Is it good? Well I never use it, but I want to keep it that way for two reasons:
  1. Some people might use it and we shouldn't remove if it doesn't cause harm
  2. Easy access to visual results of how the AI code is working, hence would be helpful when testing AI improvements
Those two reasons are good enough for me to keep it around. Particularly the fact that it uses the AI code means that there is hardly any extra code/maintenance to keep it as we would have to keep the AI code regardless of what human players can access.

This feature is unlocked if a unit is removed from working on the plot it is on (say pirates removing fishermen). Once the pirates are gone, the unit will return to the original task if that is what the AI views as the best option.
 
Actually that is precisely what the AI is doing.

Not really, it does not have a colonist multitask two jobs at the same time / the same turn. ;)
I wanted to make a different point and explain that I do not like the "multi-tasking" as this concept suggests.
(Maybe my explanation was misleading though.)

----

Moving around is perfectly fine for me, because there is an active decision making / reacting to changing conditions involved.
(It is not just a "fire and forget" setting that players use for)
 
Last edited:
does not return the colonist to the place from which he was "thrown out", for example, the pirates.
That's something I would like to see changed eventually. Something like a memory of where locked citizens are and that they will move back when possible. Also moving away from the plot for one turn shouldn't reset the learning by doing counter.
 
Something like a memory of where locked citizens are and that they will move back when possible.
Maybe that can be combined with "Turn off Citizen Automation"? :think:
(Because otherwise AI moving your Units should be ok.)

Concept:

Whenever a Unit is moved by "City Logic" (instead of active Human action) and "Turn off Citizen Automation" is set.

* The Unit with original Profession / Buidling / Worker Plot is stored in "Job restoration memory" (of City)
* Every turn "Job restoration memory" is looped and checked if it is possible to put Unit back to original Profession / Buidling / Worker Plot
* Once the Human manually moves the Unit it is removed from "Job restoration memory"
 
I was thinking along those lines as well. It's fine that the unit is automated, but restoring should also lock it as in turning off automation. "Job restoration memory" should be in CvCity and contain entries of "unit, profession, plot". If the profession is in a building, the plot is NULL (though I can't offhand think of a case where units would be removed from buildings". This would need to be saved or it would cause OOS if somebody joins mid game.

Well stuff to consider later.
 
Top Bottom