[A14] Colony Manager

Started by Fluffy (l2032), November 18, 2015, 06:20:55 PM

Previous topic - Next topic

Fluffy (l2032)

glad to hear you're enjoying it overall :)

As for your issues, I'm playing with MVP myself so I know the annoyance. There's not terribly much I can do though. The problem is that the powered and non-powered versions of the recipes are completely separate. They have the same ingredients, to an extent (and not guaranteed), but are defined for the different tables and have different settings.

Working out when to migrate to a newer recipe, and what new recipe would be ok to use or even better at all is very complicated to do automatically, especially since it might have a knock-on effect on ingredient filters and thresholds. I'm not really sure I want to devote a considerable amount of effort into this, especially since I am 100% sure it will never be perfect. Besides, the manual solution of just adding a new job for the recipe on the new worktable isn't a huge deal, is it?

As for getting error messages when changing jobs on no longer existing worktables, I'll look into that. It would be really helpful if you could P.M. me the output_log or just a screenshot with the stacktrace expanded.

Fluffy (l2032)

Actually, thinking about this a bit more, I can probably add a button to switch to a different recipe - I'll add it to the suggestions list ;).

Fluffy (l2032)

Quote from: Dodging Rain on November 23, 2015, 04:19:25 PM
I'm fairly sure that I am doing something wrong but I am getting a strange problem with the production tab.  I have the manager have two sculpture tables produce 25 sculpture each to hit the threshold up to 50 sculpture total which is fine.  However, I ed up with repetitive orders for the same thing over time.


I've tried to replicate this, but I'm unable to - it works fine for me. I'ld really appreciate a copy of a savegame where this is happening!

willow512

Well, I played with it last night. And it seems to work like a charm. Including the while animal corpse>0 do butcher. So  ;D  8)

I did have some colonists standing still for unknown reason without being idle. I'm not sure what's up with that but I also updated MVP, I would seek the culprit there first...

The only "wouldn't it be cool if" moment I had was when a workbench was inactive because it didn't have resources to create an item and I failed to notice that for a while. So.. Wouldn't it be cool if I could see in the manager tab which jobs are suspended because of lack of resources? (And which resources!)

Also, you have a hunting tab, a foresting tab.. But not a mining tab.. Though you have probably already considered that one yourself... ;)

But it works really well..

Fluffy (l2032)

Quote from: willow512 on November 26, 2015, 03:41:22 AM
Well, I played with it last night. And it seems to work like a charm. Including the while animal corpse>0 do butcher. So  ;D  8)
Awesome!

Quote from: willow512 on November 26, 2015, 03:41:22 AM
I did have some colonists standing still for unknown reason without being idle. I'm not sure what's up with that but I also updated MVP, I would seek the culprit there first...
Yeah, I've had the same problem with MVP, it's a workgiver bugging out somehow. What you do is turn on devmode so you get the error messages popup. You'll probably get sporadic pawn x did 10 jobs or more errors popping up. The error messages will list the pawn, the work they tried to do, and the worktable they tried to do it on. For me, deconstructing and rebuilding the offending worktables seemed to do the trick. I don't see how this could be my fault, as I don't do anything with the actual worktables/jobs/toils, so I'm just going to say it's MVP's fault and have simon figure it out :P

Quote from: willow512 on November 26, 2015, 03:41:22 AM
The only "wouldn't it be cool if" moment I had was when a workbench was inactive because it didn't have resources to create an item and I failed to notice that for a while. So.. Wouldn't it be cool if I could see in the manager tab which jobs are suspended because of lack of resources? (And which resources!)
Thats a good idea, I'm not near the code at the moment so I can't say how feasible it is, but I'll definitely have a look :).

Quote from: willow512 on November 26, 2015, 03:41:22 AM
Also, you have a hunting tab, a foresting tab.. But not a mining tab.. Though you have probably already considered that one yourself... ;)
I did think about a mining tab, but the problem is how to determine where you allow them to mine. If I just say 'mine any visible steel close to the base', they might just cut a hole in your perimeter. If I have you designate an 'allowed mining' zone, why not just designate the mining itself? If you have any clever ideas on how to handle this, I'll be happy to give it a try! :D

Quote from: willow512 on November 26, 2015, 03:41:22 AM
But it works really well..
Awesome, keep reporting issues/feedback!

<rambling>
That said, the next tab coming up is a ranching/livestock module (I haven't decided on the name yet), which would allow you to set population targets for male/female juvenile/adult animals, training targets and restricted zones, after which your managers would auto-designate training, butchering, and if you desire even taming wild animals to reach the targets you set. Code for this is about 1/3 done. After that I'm a bit hazy, I've been thinking about a farming tab  (rotate crops, try to time stuff to finish before winter, etc. Possibly not so useful in vanilla, but if we had winter crops that would be cool), a 'pawn management' tab (set restrictions on pawns based on certain conditions, e.g. restrict to area when raid is happening, set time restrictions based on presence of night owl trait, set medicine and recruit/release on prisoners based on their attributes, etc). Not sure of how feasible this is, as the list of possible triggers is a lot more complex (i.e. not just a resource count, but based on any number of attributes of pawns/map/world).

I also really want to do my own implementations of the autosell and autoequip mods. I think they both fit well into the manager framework, and I feel both implementations are currently flawed. Autosell because the way it handles things internally is quite clumsy, and because it doesn't work with Haplo's traders and can't do auto-buying. autoequip because it gives too many options, is unstable, and very unoptimized. On the other hand, both are mostly functional, and currently maintained, so not sure if it's a good idea to re-do them.

Finally, I will need to sit down for a weekend at some point before A13 hits and rip this mod apart into different modules. Most of the code is compartmentalized and should allow for this quite easily, and it would make the process of getting this monstrosity up to date for A13 a lot quicker.

And then there's the 'mundane' xml based things of adding more another manager station (auto one, with AI core), as well as the hell of adding jobs and toils for managers to do, e.g. the speeches/scoldings. I want to have them in the mod, I think they're really cool ideas. But I also really don't want to open the can of worms that is rimworld work/jobs/toils.... :P
</rambling>

willow512

Quote from: Fluffy (l2032) on November 26, 2015, 04:29:06 AM
Quote from: willow512 on November 26, 2015, 03:41:22 AM
Also, you have a hunting tab, a foresting tab.. But not a mining tab.. Though you have probably already considered that one yourself... ;)
I did think about a mining tab, but the problem is how to determine where you allow them to mine. If I just say 'mine any visible steel close to the base', they might just cut a hole in your perimeter. If I have you designate an 'allowed mining' zone, why not just designate the mining itself? If you have any clever ideas on how to handle this, I'll be happy to give it a try! :D
Seems to me you can use the mining zoning features to allow players to set where colonists can mine. I'd suggest to consider inverse zones. Like  "Mine anywhere BUT at home..." Which would pick any reachable minable block of the right type outside the home. And in all honesty I wouldn't worry about mining through defensive walls. You can easily plug them up again. It's really not such a big deal considering the benefit it gives. The only thing that might be a problem is collapsing roofs.


Quote from: Fluffy (l2032) on November 26, 2015, 04:29:06 AM
<rambling>
That said, the next tab coming up is a ranching/livestock module (I haven't decided on the name yet), which would allow you to set population targets for male/female juvenile/adult animals, training targets and restricted zones, after which your managers would auto-designate training, butchering, and if you desire even taming wild animals to reach the targets you set.
Interesting, I tend to bring chickens to colonies. The eggs are nice, but you have to periodically cull them to avoid a chicksplosion.

Quote from: Fluffy (l2032) on November 26, 2015, 04:29:06 AM
Code for this is about 1/3 done. After that I'm a bit hazy, I've been thinking about a farming tab  (rotate crops, try to time stuff to finish before winter, etc. Possibly not so useful in vanilla, but if we had winter crops that would be cool),
I don't quite see it. You could restrict fields with crops that can't complete before winter indeed. And re-enable them when spring arrives. But that's not a tab, that's a checkbox.

But if we combine with hydroponics... You designate how many crops of a type you want, and the manager will assign hydroponic bays in order to produce them. The advantage is that hydroponics usually have only a few slots per bay. And they complete quicker so it makes more sense to switch them.  Big farms are fire and forget, you lose so many crops by switching halfway the summer that it's too much of a waste.



Quote from: Fluffy (l2032) on November 26, 2015, 04:29:06 AM
a 'pawn management' tab (set restrictions on pawns based on certain conditions, e.g. restrict to area when raid is happening, set time restrictions based on presence of night owl trait, set medicine and recruit/release on prisoners based on their attributes, etc). Not sure of how feasible this is, as the list of possible triggers is a lot more complex (i.e. not just a resource count, but based on any number of attributes of pawns/map/world).
I like the prisoner features. Also don't forget the feature to restrict animals to a zone during a raid. ;)

Quote from: Fluffy (l2032) on November 26, 2015, 04:29:06 AM
I also really want to do my own implementations of the autosell and autoequip mods. I think they both fit well into the manager framework, and I feel both implementations are currently flawed. Autosell because the way it handles things internally is quite clumsy, and because it doesn't work with Haplo's traders and can't do auto-buying. autoequip because it gives too many options, is unstable, and very unoptimized. On the other hand, both are mostly functional, and currently maintained, so not sure if it's a good idea to re-do them.
If you do these, you could consider combining with production, so you can craft objects specifically to sell them later on. Or you could build tools to play the stock market. Buy expensive and sell cheap ;)


But if I may be so bold as to push forward a feature you didn't mention...

How about an electricity tab?

Show us what we use, and what we produce, show us how long we could run on battery power alone (eclipse, no wind) and give us triggers to respond to: When battery power drops, first turn off the lights, then turn off some heaters, then turn off other heaters, then turn of sunlamps. Turn off lights during the day, and heaters during summer. Turn off coolers during winter. In case of raid, turn on all the guns and turn off all the heaters and lights, then turn them off after. That sort of stuff..

So this is basically a tab which marks switches to be toggled depending on triggers. If you go for that AI core manager bench you could forego the colonist toggling and just let the AI turn the device on and off... If that happens I'd probably have to experiment with blinking lights and running lights.

I'm going a bit nuts now, but the AI could probably open and close/lock automatic doors for you without colonists coming close.... (Send in the starving tigers, or close all emergency doors)

I think it is favorably analogous to what you're doing with resources and items now... You could even re-use the code you use for the graphs.

Dodging Rain

Quote from: Fluffy (l2032) on November 25, 2015, 03:24:43 PM
Quote from: Dodging Rain on November 23, 2015, 04:19:25 PM
I'm fairly sure that I am doing something wrong but I am getting a strange problem with the production tab.  I have the manager have two sculpture tables produce 25 sculpture each to hit the threshold up to 50 sculpture total which is fine.  However, I ed up with repetitive orders for the same thing over time.


I've tried to replicate this, but I'm unable to - it works fine for me. I'ld really appreciate a copy of a savegame where this is happening!

My apologies for the delay as I was out for a bit and forgot to check on this thread on phone.  As I can resume playing, I will create a new game with just this mod to see if another mod is interfering with it.

Fluffy (l2032)

Quick status update;

  • I cannot seem to reproduce the bug reported by Dodging Rain. I've let multiple test games run for about 2 hours in total now, fiddling with different scenarios, and full debug output on - it just ain't happening. I will keep looking for this to happen again, and will hopefully fix it asap.
  • Livestock tab (I didn't like ranching) is almost done, just fiddling with a few last enhancements to the UI. As soon as it's ready I'll put a new release up with all the other fixes/improvements as well.
  • Some improvements have made it into the other tabs;
    • graph can now show multiple resources (will be more extensively used later)
    • all triggers can now have a specified stockpile to count resources in, so you can only do a job when the ingredients are close (can't force pawns to only use that stockpile, you'll have to make sure it's closest). Also, while hunting, forestry and production use the same trigger behind the scenes, only production allows you to actually finetune the trigger directly, so only there can you use this feature.
    • production jobs can now switch their recipe (and by extension worktable), if another (not necessarily better) recipe is available which produces the same thing (e.g. simple meal on stove/campfire). An extra button will appear on the job which allows you to switch to the other recipe - cleaning up all outstanding bills and then assigning new bills as usual when a manager arrives to do the job.
    • the ability to add multiple triggers to a job is significantly harder than I had thought. I may need to do a significant rethink/refactor of how the code deals with Triggers. That's not necessarily a bad thing (in fact it's probably overdue), but maybe more something for the next alpha, when I probably have to redo the whole damn thing anyway.
  • Farming & Mining tabs are not going to happen anytime soon - while I feel they'd be nice to do, they're probably going to be marginally useful at best, and just not a good investment of time.
  • Electricity tab proposed by willow seems like a great idea, definitely looking into the feasibility of that soon.
  • Same goes for autosell, the current one is good enough for now.
  • Autoequip I might look at providing the original author with a pull request.
  • The Social/Restrictions tab I want to do is on a slow burner - it's just very, very open as to what kind of effects and triggers could be linked to it, which means an awful lot of coding, as potentially each different setup requires a special case in the code. (obviously this isn't good, and I'd have to make it as general as possible for easier extensions / maintenance).

Tekuromoto

Quote from: Fluffy (l2032) on November 26, 2015, 04:29:06 AM
I also really want to do my own implementations of the autosell and autoequip mods.

While I haven't used the managers mod yet I do use your other interface mods and love them. Next play I'll fire up the managers too. What I really want to say though is PLEASE PLEASE do an autoequip. I use the current one but it's so buggy and wierd, and I never really trust that it's doing what it says. I'm confident that a fluffyquip mod would rock.  ;)

Sure, you can call it that. No credit needed.  ;D


Dodging Rain

Quote from: Fluffy (l2032) on November 30, 2015, 03:56:21 AM
I cannot seem to reproduce the bug reported by Dodging Rain. I've let multiple test games run for about 2 hours in total now, fiddling with different scenarios, and full debug output on - it just ain't happening. I will keep looking for this to happen again, and will hopefully fix it asap.

If it helps with the debugging, what I often do is have condition -resource required- greater than number.  For example for slate sculture, I try to set Slate block > 500 since I do not want to use all of my slate blocks for the purpose of rebuilding a wall that a sapper raid often go for.

Fluffy (l2032)

I saw that in the save file dodging, also noticed you have two separate jobs for slate and (something else) sculptures, which I thought might be the key - perhaps the check was somehow stopping with the first bill. But it isnt, it works fine if I try it.

Then I thought maybe the problem is that bills which have an unfinished thing attached (i.e. they're being worked on) are somehow different. Again, no luck.

Tried combinations of those, tried adding more jobs, tried letting it run for an hour. Nothing triggers spontaneous job multiplication for me. Looking over the code, I also don't see how it could be happening other than that the manager is dropping it's internal list of tracked jobs - but there's no reason I can think of that it should do that.

Grogfeld

I had this bug few days ago, it was related with meat jerky, grill recipe in MVP modpack. It showed when I've try to create job: jerky, threshold meat > 100; It created 2 of this jobs plus it multiplicated another job that was created manually but it didn't do it right from start I think it created that after I've loaded save. I thought that it's related with that logic, and than You said that "greater than" is bugged so I've didn't use it anymore.

Fluffy (l2032)

Hmm, so I guess the problem is more general and likely linked with saving/loading. I'll look into that, thanks for the report!

P.S. greater than has been fixed, and that bug was related to the repeat count logic - which is separate from actually assigning bills to workstations.

Fluffy (l2032)

Aight, the livestock tab is done - until I get some feedback on it at least. Enjoy the new release! Several bugs and feature requests have also made it into this release, see the github commit notes for details.

NOTE: Changes in savedata structure mean this update requires a new game.

willow512

Quote from: Fluffy (l2032) on December 01, 2015, 07:00:24 PM
Aight, the livestock tab is done - until I get some feedback on it at least. Enjoy the new release! Several bugs and feature requests have also made it into this release, see the github commit notes for details.
Thanks :) I'll check it out and put up some feedback.. Though I have decimated my chicken infestation. And surprisingly ended up with a pile of food that will easily get me through this winter and the next.. (Chicks apparently eat a lot)

Also.. I was thinking some more on the overview tab. Right now it doesn't really simplify life, or actually give us an overview of our colony's job status. The problem I think is that especially with mods like MVP or hardcore there is so much going on that the visible part of the active job list is really tiny compared to the amount of data available. Also by offering the information pretty much in the same way the job tab already does it doesn't add value. And the data it does offer doesn't really show what we need to get that "at a glance" overview that an overview tab should aim for.

How about a complete redesign?

  • Enumerate all resources that can be produced by one of your existing workbenches.
  • Per resource it shows current value readonly, min and max values in editable format.
  • Preferrably set up so no scrollbars are required..
  • Show resources color coded and grouped by workbench, or item type
  • Next to every resource is a small button which shows in a popup dialog your already existing job parameter UI, which allows the player to fine tune jobs as they can do in your currently existing setup.
  • This popup might offer a list of stockpiles with checkboxes behind them that allow us to set stockpiles per resource, instead of the now existing vanilla resources per stockpile.
The manager code uses this data to check all resources: everything below minimum will generate a job that will grow the amount back to maximum and then completely remove the job until current falls below minimum again. Jobs for resources above max will be terminated or changed to lead up to max.

Random thoughts

  • This has the benefit that it shows available inventory and status in one simple screen, it allows the player to intuitively set desired values without much clicking, just open manager enter some values, done... Whilst still allowing fine tuning.
  • Color coding would show deficits in red. Sufficient amounts in green and possibly gray out items which cannot be produced due to insufficient amounts of the required resources.
  • The popup dialog shows required resources, these could also be color coded to show if they exist in sufficient quantities.  So if something requires 10 glass and you need to make 10 of that item to get to your maximum value, it will show in regular white if you have 100 glass, in red if you have insufficient resources to get to max.
  • The min/max solution would behave differently from the current target solution in that it doesn't trigger a job every time someone removes one item from the stack. It will produce batches allowing colonists to ignore the item for periods of time while it's hovering above minimum. I believe this will result in colonists sticking to jobs more consistently instead of running all over the place losing time in transit. And it more closely mimics real world inventory management.
  • I think you should not be afraid to remove or change jobs manually created by the player if they fit the parameters. Though you could of course make this optional.

At first I thought this would be a lot of work and debated myself whether I should even suggest it. But in the basis it's removing components from the overview tab and adding the enumeration. Then in the manager code it's using data available in this tab to create and remove jobs. So maybe it's not so much work after all.. You know the code and should be the judge of that, not me.