[1.0] Common Sense - basic AI tweaks

Started by avilmask, March 20, 2019, 10:41:51 AM

Previous topic - Next topic

avilmask

Links for Common Sense 1.1.4 Mod: Steam Workshop | non-Steam GitHub


Description:

Idea of this mod is to optimize some basic behaviors of colonist AI.


More visual examples on Steam page.

All behaviors, introduced in the mod, are optional and can be disabled right in the middle of on-going game.
This Mod supposed to be safe to install and uninstall whenever. But in rare cases some pawns can glitch out and freeze in place. Just draft and undraft them to reset their AI.

Highlights:
- fulfilling outdoors need. I didn't add any new recreational actions, instead I've tried to give colonists joy sources that they could perform outdoors. So if you have unique sources of joy, that placed "outdoors" ("unroofed" doesn't count as outdoors), colonists will prioritize them if they need some fresh air;
- when colonists are set to use drugs when their happiness is at set level, they often can take 3 or 4 dozes of a drug before their mood finally reaches a threshold (because mood doesn't recover instantly). This mod can prevent pawns from overusing drugs, taking into account potential mood growth;
- you can prevent pawns from stacking bad food (i.e. made of gross or inappropriate ingredients) with normal one, keeping it separate. Optionally you can allow ingredients that isn't "humanlike meat";
- colonists can take an opportunity to clean a room before operating a building. For example, going to sleep (yep, it counts as operating a building), or researching;
- colonists can clean rooms after tending to a patient. They don't do that if they have other jobs in queue (to prevent them from wasting time when they're queued to tend a couple of patients, or whatever else you could force them to do right after tending someone);
- colonists can switch to hauling if ingredients, that they're supposed to take for crafting, are not in a stackpile. It's useful if you don't like when your pawns pick that 10 pieces of steel in the middle of nowhere, instead of hauling 75 of it to the stockpile. Items, that have max. stack size of 1, don't count (ex. stone chunks);
- colonists can clean the room in between hauling to the crafting place and actual crafting, to save time;
- colonists can pick up all required ingredients all at once, and bring them to the crafting place, to save time;
- since for "picking up all at once" I had to make some simple inventory management mechanics, I've also made an option to manually mark items for unloading, so you can "ask" pawns to haul items from their inventory to the closest stockpile, as an alternative to dropping it on the ground;
- pawns don't drop on the ground items, that they took from their own inventory into hands and was interrupted in the middle of an action (no more dropping meals on drafting intensities);
- pawns can learn to stop taking more sweets than they can eat (no more unfinished chocolate in random places);
- pawns can prioritize close to spoiling ingredients over fresh ones, so none will go to waste;
- pawns can prioritize spoiling healroot and corpses (for butchering :P). The same reasoning as for ingredients;
- colonists will prefer finishing off the meals that gonna spoil soon. The closer meal is to spoiling, the more likely they're to chose it. Though colonists not gonna chose a simple meal, made of insect, over normal lavish meal anyway. It's under the same option as prioritization of ingredients.
- if colonist is on sleeping schedule, but can't sleep for some reason, he will act like he's on recreation;
- after topping off recreation, pawns will not try to take recreational activity until it's down to 80%;
- when on recreation, pawns will try to take spare meals and fill hygiene needs (with "dubs bad hygiene" mod on);

Non-AI changes (that probably gonna be separated into new mods soon):
- show full list of ingredients, allowed in a recipe, instead of vague "ingredients" (modded in "special recipes" usually look like "you need 1 ingredient, 1 ingredient, 1 ingredient and 1 ingredient);
- add random ingredients to randomly generated foods. Just for flavor. Because it's funny to wonder, where the hell did you get that simple meal, made of yorkshire terriers. Random meals never use "bad" ingredients, so they're safe.

Alright, no further plans for now.

Known incompatibilities:
- there's one problem with GiddyUp mod if cleaning before doing a job is enabled. Have now clue why (yet, I'll be looking into it), but mounted animals don't get released properly and stand around until get a command or something like that;

Mod powered by Harmony.
Chinese translation by chrisxlite;


Links for Common Sense Mod: Steam Workshop | non-Steam GitHub

Canute

Hi,
if that all works like you describe it, it would be a hugh advancement at the AI behavior at some ways.

Quote- since for "picking up all at once" I had to make some simple inventory management mechanics,
Did you check the compatiblity with other inventory mods like PickUp&Haul and Combat Extended ?

In the case of your demo pic, ok it doing a surgery before instaling some prothetic. But when it need to tend wounds, did do a bleed out check before he start to clean the hospital so he don't run out of time ?:-)

avilmask

Quote from: Canute on March 20, 2019, 12:53:29 PM
Did you check the compatiblity with other inventory mods like PickUp&Haul and Combat Extended ?

In the case of your demo pic, ok it doing a surgery before instaling some prothetic. But when it need to tend wounds, did do a bleed out check before he start to clean the hospital so he don't run out of time ?:-)
PickUp&Haul I use myself, so can confirm there is no compatibility issues. Didn't play combat extended, and I had no reports about issues with it.
I don't let colonists to decide on their own, whom they should tend and in which order, if it's urgent, and they never clean rooms if there is another jobs in queue, so no, I had no urgent tending in mind. And it would be hard to do, because it would require to know, what's next job it will be after ending current one. Plus knowing a gimmick, it's easy to play around it. Also this behavior is optional and can be reverted to default if it causes inconvenience. If there is a mod, that allows to re-prioritize tending by urgency, I could make something up to prevent pawns from cleaning on some condition, for example if job is forced. With vanilla AI patients would bleed out anyway, since surgeon would likely go to watch TV or something :P
Each behavior is "optional", and it's possible to disable them individually, reverting to standard activity. That way you may avoid conflicts with other mods (don't forget to report it) or disable what you dislike (ex. many people think that using inventory is cheating).

emeraldmoonx

Looks good, hoping it works good with all my mods lol. Will be trying it today.

jager666

How does this mod affect performance? Is there any known incompatibilities?

avilmask

Quote from: jager666 on March 20, 2019, 03:35:23 PM
How does this mod affect performance? Is there any known incompatibilities?
Changing priorities PROBABLY somehow impacts performance. I didn't add any new tickers or something. Nothing visible on my machine with 12 pawns.
No known incompatibilities. If you find any - don't be shy to report.

ertzuiop

Doubles in the settings.

[attachment deleted due to age]

avilmask


DiamondBorne

#8
Superb mod. I probably able to remove more than a few rebundant mods with this, thanks.  :)

avilmask

#9
Updated to 1.1.2:
- changed pawn priorities for sleeping schedule. Now they'll prioritize topping off joy need if they happen to wake up early;
- added an option to prevent colonists from taking joy activities if they're already topped off (after reaching 95%, they'll not start it again until it's down to 80%);

Canute

Quote- changed pawn priorities for sleeping schedule. Now they'll prioritize topping off joy need if they happen to wake up early;
Yeah, good thing.
Since many use Dub's hygiene mod, what's about to lets them use the toilet too.
And about food ?
So after they woke up, they clean themself, doing breakfirst (yes i know not everyone doing breakfirst) before they are going to work.
Nothing worse that a pawn is going to mine after the woke up, forget his lunchpackage and need to go home to eat.

avilmask

Quote from: Canute on March 22, 2019, 04:30:57 PM
Since many use Dub's hygiene mod, what's about to lets them use the toilet too.
And about food ?
So after they woke up, they clean themself, doing breakfirst (yes i know not everyone doing breakfirst) before they are going to work.
Nothing worse that a pawn is going to mine after the woke up, forget his lunchpackage and need to go home to eat.
I guess I could look into bad hygiene mod. Still not sure, how I feel about making tweaks for different mods :P
Nice touch about forgotten lunches, I thought about them at some point, too. I'll do something about that.

Marcus

Great mod, I like the options 'clean the room before sleep' and 'clean the surrounding before work' - no dedicated cleaners needed. I look forward to see more tweaks. Thanks!

Kobayashi

#13
I like.

Now people can finally download common sense. Thank you

Fafn1r

Quote from: Canute on March 20, 2019, 12:53:29 PM
Did you check the compatiblity with other inventory mods like PickUp&Haul and Combat Extended ?
Quote from: avilmask on March 20, 2019, 02:36:48 PM
Didn't play combat extended, and I had no reports about issues with it.

No issues with CE. Not tested with both CE and PickUp&Haul, but they are still incompatibile for 1.0 anyway.