[WIP] Britnoth's experiments thus far

Started by Britnoth, December 16, 2015, 12:42:37 PM

Previous topic - Next topic

stigma

Thanks for the quick reply.

DEADLOCK JOBS
You are right that defining what is problematic dead-lock work is not easy. It's not clear-cut for many jobs, but assuming that it is possible to exclude certain jobs on technical level I think that some jobs are no-brainers for exclusion (like research, I don't see any good reason why workflex should consider this at all really).

I would also be very interested in a version that only did hauling because IMO better/smarter hauling efficiency as pawns move around is 90% of what this mod brings to the table anyway. Cutting away other problematic tasks reduces the problem right away (and I would use a haulonly-workflex even with no other changes).

The ideal thing would be for included jobs to be user-selectable of course. An ingame UI would obviously be the best way - but IMO if you can easily edit in the mods text-files somehow then that is almost as good if you don't know how to do the UI stuff.

CONTROL SYSTEM / INTERRUPTS
Currently the only way to control/limit workflex to keep it from inevitably deadlocking (for the rest of the day anyway) is to use the scheduling with some periods of "work" set up - but this overkill and has unintended consequences (work restricts a lot of things a colonist can do other than just workflex jobs). You also need to constantly monitor and adjust it since it's static.

All that is needed to prevent all this are some interrupt-points where jobs are re-evaluated to keep workflex from hogging 100% of the worktime (just like a CPU works with threads). It's very convoluted logic or anything. I don't understand why you are so against it :(

scheduling "work" on and off is exactly the same thing as what i'm talking about really, except that it's very "dumb" and static because it happens at set intervals (and also blocks other actions that you might not intend). Much better if the interrupts just happen whenever workflex-jobs have used too much consecutive time (dynamic). Add a couple of values for how sensitive that interrupt is and it sounds like it would resolve the whole problem more or less.

I really like workflex for the smarter hauling behaviour it creates - but I don't think I can justify using it as long as the only way to prevent disasters is to bruteforce interrupt it via scheduling and hope that it is enough and at the right time ect. to not block critical work. (or else feel like I have to constantly babysit my colonists).

I hope I can somehow convince you on implementing a better control system :D
Everything I say here is only meant as constructive criticism.

About UI I wouldn't sweat that to start. I think advanced users who mod rimworld probably aren't scared to change a number in the XML files. As long as options exist there that's a pretty good stopgap solution, and you can worry about UI in later versions when the functionality is how you want it.

PS: I don't suppose it's possible to get a look at how the sourcecode looks? I've never created a mod for rimworld before, but it would be interesting to see how the internals work and if I think I could maybe tweak it a little bit to make something I like for personal use until if/when you make an improved version :)

-Stigma

Britnoth

QuoteAll that is needed to prevent all this are some interrupt-points where jobs are re-evaluated to keep workflex from hogging 100% of the worktime

Defining how a pawn has spent too much time doing the same thing sounds... very very difficult. The game keeps a record of how much time a spawn has spent hauling, asleep, under a roof etc but I do not think it has a way of checking how much of the day was spent researching as opposed to wardening a prisoner and so on.

As I said, I do not want to interfere with the decisions the player makes. Either the work should happen or not depending on the settings the player uses, not because the game decides for you that you have done enough research now and should be doing something else.

WorkFlex is incredibly simple: all it does is use a duplicate of the existing work giver with its already implemented maximum distance used rather than left at 9999f, and with a slightly higher priority returned when a pawns schedule is not set to forced work.

I'd like to give the player more control over the mod, but want to avoid having the mod take control of the game. :) I have used it for some time over multiple alphas and had no issues. But that might be due understanding the mod and setting my work priorities with it in mind.  ???

Quotebut assuming that it is possible to exclude certain jobs on technical level

I really do not know where to start with this with the way the mod currently works. An alternative is to use specifically made AI checks for hauling or cleaning, but either way that does not sound as compatible with other mods as it could be.  ???

poolday

Quote from: Britnoth on June 24, 2017, 03:34:41 PM
Hmm, Urgent Hauling adds another hauling work type with a priority higher than flicking?

A simple way would be to add the <emergency>true</emergency> flag to its WorkGiverDef. Then any pawns allowed to would do that before any normal work in the same way they fight fires - the check for emergency work is made before the main behaviour, including annoyances like eating, sleeping, socialising or changing clothes.

Thanks for the reply, it took me a couple of weeks to get back to the game and test this. It seems to work but the problem is that because they now treat the urgent hauling as an emergency the pawns might exhaust themselves or even starve while trying to haul things. Anyway it was worth it for a while and I know this is a WIP so let me say this mod is a good one to keep in mind. I'm going to wait until it may or may not be compatible with the AllowTool. Thanks.

stigma

Quote from: Britnoth on July 07, 2017, 09:52:59 PM

As I said, I do not want to interfere with the decisions the player makes. Either the work should happen or not depending on the settings the player uses, not because the game decides for you that you have done enough research now and should be doing something else.

I think we have 2 very different ways of looking at this.

I totally agree that the game should follow the players rules and not try to decide for itself, but the way I see it - workflex is already removing some of the control (my pawn has a priority to hunt but ended up only doing work inside the base the whole day sort of situation). Yes, you are choosing known parameters for workflex, but the situation is constantly changing outside your control since the "true" priorities of a pawn are going to change depending on where he is and what jobs are available close by - and no one can keep track of that continuously.

The way I see it Interrupts are actually giving back the player control and making sure that the players choices are at least not completely ignored - so you know that at least some hunting will be done if it is set to a high priority.

About timing jobs - I don't know what functions the game has available - but I'd assume that the simplest way to do it is just to start a timer at the start of every workflex-motivated job. If that timer exceeds a threshold, disable workflex priorities for X time so that normal priorities resume for a bit.

I don't think there is any need to track what type of job it is - or do any sort of fancy tracking of historical data. Just a simple timeout should do it.

I hope I'm not being annoying and overly persistent about this. If so I apologize. I don't mean to backseat develop - only to give ideas for what I think would be improvements.

-Stigma

Britnoth

Quote from: poolday on July 08, 2017, 03:27:31 AMIt seems to work but the problem is that because they now treat the urgent hauling as an emergency the pawns might exhaust themselves or even starve while trying to haul things.

I think it would be upto the player to learn to show restraint in how many items they set to be hauled.  :)

Quote from: stigma on July 08, 2017, 09:37:24 AM
but I'd assume that the simplest way to do it is just to start a timer at the start of every workflex-motivated job. If that timer exceeds a threshold, disable workflex priorities for X time so that normal priorities resume for a bit.

Certainly possible, but it would have to add its own data to each pawn recording the last tick a workflex job was assigned.  :-\

stigma

@Britnoth How does your replace walls function differ from JT Replacewalls? Aside from yours being a seperate tool that is.

It would be nice if it could override doors too, because you typically change those along with the walls.

-Stigma

Britnoth

Quote from: stigma on July 14, 2017, 10:58:20 AM
@Britnoth How does your replace walls function differ from JT Replacewalls? Aside from yours being a seperate tool that is.

It would be nice if it could override doors too, because you typically change those along with the walls.

-Stigma

1. It is almost 6 months older.  :P

2. It does not use any detouring. It just adds the build on walls flag to the existing wall def, and adds a tool that places wall blueprints on existing walls. Very simple.

3. Really? The game only has the 'build on existing wall' flag, which is why it is limited to just walls. I rarely replace existing doors so felt this wasn't a critical problem...

shentino

Have you considered uploading this to the steam workshop?

BlackSmokeDMax


stigma

Quote from: Britnoth on July 14, 2017, 05:13:33 PM
Quote from: stigma on July 14, 2017, 10:58:20 AM
@Britnoth How does your replace walls function differ from JT Replacewalls? Aside from yours being a seperate tool that is.

It would be nice if it could override doors too, because you typically change those along with the walls.

-Stigma

1. It is almost 6 months older.  :P

2. It does not use any detouring. It just adds the build on walls flag to the existing wall def, and adds a tool that places wall blueprints on existing walls. Very simple.

3. Really? The game only has the 'build on existing wall' flag, which is why it is limited to just walls. I rarely replace existing doors so felt this wasn't a critical problem...

Well, thinking critically about it - I guess it is highly situational in practice.
I guess I use non-wooden doors mostly on defense, and past the early game you don't swap around materials on those very often.
It's not critical by any means.

JT Replacewalls is ever so slightly more convenient for not having a seperate tool you need to use - but if this is done in a more compatible way then I prefer that. I don't need this functionally THAT often. It's mostly just nice to now have to micromanage it those few times that I do.

-Stigma

Likif

Hey Britnoth, any progress on better AI for A17? Or are you going to wait for future versions? I am not too keen on starting any game without your AI modifications.

Pokk720

This mod should be on the releases page! Experimental or not it's sooo essential. I've only been using it for 10 minutes and I'm already impressed with how much smarter my pawns are. Now they will actually clean their rooms instead of wallowing in filth and becoming depressed because of it without my express orders. Hauling is also soo much better. I've fiddled with the priorities in the work type defs a lot up until now to try and replicate what this mod does. The patient fixes are also a big improvement. I'm just mad that it took me so long to find this!

stigma

Quote from: Pokk720 on July 20, 2017, 10:56:50 PM
This mod should be on the releases page! Experimental or not it's sooo essential. I've only been using it for 10 minutes and I'm already impressed with how much smarter my pawns are. Now they will actually clean their rooms instead of wallowing in filth and becoming depressed because of it without my express orders. Hauling is also soo much better. I've fiddled with the priorities in the work type defs a lot up until now to try and replicate what this mod does. The patient fixes are also a big improvement. I'm just mad that it took me so long to find this!

I agree that hauling and cleaning tasks benefit greatly from this (I am assuming you are talking about workflex here).
It's all the other stuff that creates problems - I find I end up losing control of what the actual priorities are, and I can't bring myself to use it long-term, especially the later in the game I go as the workloads become larger and more complex. Maybe part of the problem is that I'm the sort of person who set up priorities for everyone to do everything EVENTUALLY somewhere down the priority ladder - even when I know that they will most likely never get a chance to under most circumstances. It would be less of an issue if you tend to set people to only do 2-3 types of tasks.

I reiterate that it would be really great if there was a haul/clean only version of workflex *hint hint*

-Stigma

Britnoth

RE: SID for a17: Probably not for a while yet. I am looking at how the AI has been changed though. Bad news: it is just changing from 'defend' to 'assault' AI. :(

I have never used manual priorities myself. Never found the need. Plus as the proud owner of a potato pretending to be a PC, having pawns limited to only a few work types helps reduce lag.

One thing users of Patient Sanity need to pay attention to - as all treatment is now emergency, even priority 4 doctors are going to rush to anyone needing treatment - including those where quality matters such as infections and plague.

Anyway... did some experimenting and produced this. Feel free to test. Seems to work alright for the few minutes I tried.

WorkFlex limited to haul and clean:

[attachment deleted by admin due to age]

Boundir

Quote from: Britnoth on December 16, 2015, 12:42:37 PM
Friendly Berserk: Berserk pawns will no longer be hostile to their own faction.
a17: Updated to use mod-friendly xml.
If going berserk would you go pick a fight with a wolf or a bear? I see that state as a pawn that would more likely break stuff, throw insults and get into social fights but not try to die either :)