[1.0] Common Sense - basic AI tweaks

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

Previous topic - Next topic

avilmask

Updated to 1.1.3:
- fixed a problem, when material of an item could change with "all components hauled together" on, because order of picking up could change due to path optimization (basically, whatever was closer to the pawn, it automatically become a main ingredient);

sidfu

for specfic mods u have it enact changes if it finds the mod enabled. for example dubs u would have if the mod enabled they would use the time in morning to shower/bathroom if they wake early.

wouldnt be much differnt than what u doing for joy but just the extra code to see if the mod is enabled

avilmask

#17
Quote from: sidfu on March 25, 2019, 08:21:14 AM
for specfic mods u have it enact changes if it finds the mod enabled. for example dubs u would have if the mod enabled they would use the time in morning to shower/bathroom if they wake early.

wouldnt be much differnt than what u doing for joy but just the extra code to see if the mod is enabled
I didn't mean "how to do that", I meant "with my mod I change what different author intended in their mod". It becomes a QoL change "for a mod" that way. Usually things like that asked from a person that made it in the first place, not from a guy, who shuffles vanilla numbers. That's why it felt off to me.

avilmask

1.1.4
- when recreating, colonists will prefer taking spare meals if they don't have one;
- fixed a problem, due to which colonists would prefer herbal medicine over any other when doing surgery;
- added a special patch for "dubs bad hygiene" that tweaks assignment priorities (in a way, how joy need works now);

Tenshi~Akari

Hi, thanks for these tweaks! Unfortunately, I'm coming across this situation with this mod & Dub's Bad Hygiene at the moment...


AG started 10 jobs in 10 ticks. List: (Wait_MaintainPosture (Job_1371662)) , (washAtCell (Job_1371664) A=(85, 0, 118)) , (Wait_MaintainPosture (Job_1371665)) , (washAtCell (Job_1371667) A=(85, 0, 118)) (Wait_MaintainPosture (Job_1371668)) , (washAtCell (Job_1371670) A=(85, 0, 118)) (Wait_MaintainPosture (Job_1371671)) , (washAtCell (Job_1371673) A=(85, 0, 118)) (Wait_MaintainPosture (Job_1371674)) , (washAtCell (Job_1371676) A=(85, 0, 118)) (Wait_MaintainPosture (Job_1371677))  curDriver=JobDriver_WaitMaintainPosture (toilIndex=0) curJob=(Wait_MaintainPosture (Job_1371677)) lastJobGiver=null
Verse.Log:Error(String, Boolean)
Verse.AI.JobUtility:TryStartErrorRecoverJob(Pawn, String, Exception, JobDriver)
Verse.AI.Pawn_JobTracker:FinalizeTick()
Verse.AI.Pawn_JobTracker:JobTrackerTick()
Verse.Pawn:Tick_Patch2(Object)
Verse.TickList:Tick_Patch2(Object)
Verse.TickManager:DoSingleTick()
Verse.TickManager:TickManagerUpdate()
Verse.Game:UpdatePlay()
Verse.Root_Play:Update()


This 10-tick bug happens when pawns are on the generated caravan event maps & attempting to bathe in any form, whether it be from any on-map water, wash tubs, etc.

It doesn't happen on any of my main colony maps, and before I added this mod, it didn't do this on event maps either. (Confirmed just a few minutes ago by removing the mod from the list, and pawns were back to washing on those maps without red errors.)

Any way you can check in on how the recent tweaks might be affecting this? I would like to keep using this mod for sure, but I know when pawns try to take care of their hygiene need during caravan events, that's going to be a small annoyance with them getting stuck like that until their need is high enough to move on to another task...

avilmask

Quote from: Tenshi~Akari on March 28, 2019, 09:56:49 AMI'm coming across this situation with this mod & Dub's Bad Hygiene at the moment...
Try to disable "recreational priorities" (that one, when pawns also change sleeping schedule to recreation if they're not sleeping atm). Report me if it does something (or not) if possible. I'll verify, what's up with that.

avilmask

#21
Figured source of the problem, fixed it (1.1.4b).
I had to make a not ideal solution.
Problem is, there is some sources of washing that do not make a pawn completely clean (washing at a well or in open water, it maxes out at 0.69). But priority logic was "hm, I'm on free time and I'm not very clean (below 0.8 ). I should take a bath while I have a free time". Then jobgiver tries to finds something suitable, goes through bathes, then basins, finds nothing (close enough), and tries to find ANYTHING globally, gives a job that maxes out at 0.69. It's done immediately, and pawn comes bake to a priority loop. I could add an additional global scan operation to the ticker... But it's a bad idea for a whole lot of (performance) reasons. So I've just reduced required need level to 0.55 (what's awfully close to original number when sleep need is above 0.95). Not perfect... But better, than nothing, I guess?

Maybe sometime later I'll just add an additional variable to the "Need_Hygiene", that could tell "we should target for a lower number", using which pawn would be able to adjust priority checker after first job.

Canute

Someone just mention at another topic
QuoteIs there any chance of Pick Up And Haul being updated to include something that makes people pick up what they harvest?
But i think this is basicly an AI tweak ! :-)
So when Pickup&Haul mod is active, you can patch that the pawn pickup the harvest/choped stuff after a harvest before he looking for the next job.

avilmask

Quote from: Canute on April 03, 2019, 03:13:14 AMBut i think this is basicly an AI tweak ! :-)
So when Pickup&Haul mod is active, you can patch that the pawn pickup the harvest/choped stuff after a harvest before he looking for the next job.
Yes, I had that idea popping in my had from time to time. But it's still a separate mod material (it doesn't really fit "basic ai tweak" formula), and I had a lot of things that need to be polished in Common Sense, and still have. I'm on vacation for a month, during which I'll not be able to work on pretty much anything. After returning from vacation, I'm going to do some more polish on Common Sense, and after that I'll start working on new mods (but I think I'll try to realize that idea first).

Canute

I notice an odd thing, i didn't encounter before.
Sometimes pawn's sleep on ground even when they are assigned to a bed, no zone restriction, no blocked way to their bed.
When i just draft/undraft them they move to their bed.

I can't verify it so far that this AI tweaks let them do this, i just want made you sensitive for that if someone else got similar expierence.

ertzuiop

Quote from: Canute on April 07, 2019, 06:22:39 PM
I notice an odd thing, i didn't encounter before.
Sometimes pawn's sleep on ground even when they are assigned to a bed, no zone restriction, no blocked way to their bed.
When i just draft/undraft them they move to their bed.

I can't verify it so far that this AI tweaks let them do this, i just want made you sensitive for that if someone else got similar expierence.


I can confirm that, but its not this mods doing. That issue existed way before release of common sense.

Canute

I didn't encounter that problem before.
But maybe i found the issue, old version von SnapOut, but can't confirm it yet.


LiteEmUp

so since this mod changes alot of ai tendencies, what mods out there will this mod is looking like a better replacement??

also any known incompatibilities so far??

avilmask

Quote from: LiteEmUp on April 09, 2019, 05:52:57 AM
so since this mod changes alot of ai tendencies, what mods out there will this mod is looking like a better replacement??

also any known incompatibilities so far??
Updated the top post, added incompatibilities information that I know of ATM.
There is no mods that do the same thing Common Sense does. Or is there? Because I didn't see any.

Roolo

First of all, nice mod! Saves a lot of micromanaging.

Quote- 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;

I'm the author of Giddy-up. Are you sure this is an actual issue, and not just a feature? Right now, when a pawn uses an animal to ride somewhere, and dismounts, the animal waits for a while, to allow the pawn to mount again if it wants to go back at some point. The animal is only "released" after a certain amount of time passes, or when a pawn is outside a certain range of the animal, or starts a job outside a certain range. Mounts can't mind-read if a ride back is needed at some point, so we'll have to do with simple checks like this (which I'll still finetune a bit more in the future).

Note that if the animal would be "released" immediately, this would make mounts feasible for one-way trips only, since animals would go back to their restrictred area immediately after the rider hops off, leaving the poor rider behind.

When the job destination is in a "forbid riding area", the animal won't wait, as these areas are often inside a players base, and in that case a ride back is often not needed. Using these areas is probably smart for things like hospitals and bedrooms, as it also prevents animal filth when pawn don't walk in with their mount. And to be honest, you don't want elephants in your bedroom or hospital.