Changes to Farmers

Is there any possible way to change how farmers work so that they only harvest up to a maximum? Kind of like the way Towns did their resource management. I was imagining a crafting menu much like other crafting jobs, with orders that can be placed, like to maintain 10 wheat. However I can’t come up with a way to do this that doesn’t involve a crafting bench and instead tells them to harvest with the way crafting is set up. Is there a way to do this without writing completely new code or is this possible through scripting?

1 Like

In the current system, farmers don’t keep track of their crops at all really; they simply plant seeds which they’re able to plant in plots that are currently requesting a seed be planted in them; and then harvest any plants which are requesting to be harvested. This allows for farmers to harvest crops that they didn’t personally plant, so it’s not entirely a bad thing… but it would, indeed, make the task of modding their harvesting behaviour more difficult since such a mod would require adding a check on how many of a given item is owned by the town before accepting the harvesting task.

Even then, it’s not an elegant solution, since a) crops will continue to grow and eventually rot if they’re not harvested, and b) if a task is ignored by one farmer it would probably keep sending requests to be harvested, which adds its own slew of problems (performance impact from multiple needless queries is the big one that comes to mind.) It would be messy, and every band-aid added to fix one problem introduces a potential new one, or at the very best it’s an extra layer of complexity.

The way to avoid this would be to have the crops themselves keep track of the total supply in storage, and to either not request harvesting or simply pause growing (not realistic at all, but the most elegant from the player’s perspective) when that cap is reached. That way, there’s no time or processing power wasted with task allocation queries, there would still be a lot of queries happening due to “growth ticks” from the crops but these are less frequent anyway so it shouldn’t cause a noticeable impact. The other nice thing about doing it this way is that you can put the limit/cap value in the existing crop selection GUI, so it’s immediately obvious to players how the whole thing works (i.e. “I want to grow carrots and keep 30 in storage” is immediately obvious since you have the number 30 right next to the button to order carrots to be grown, so even though it’s not quite the same as how crafters queue their orders it’s still easy to figure out.)

The other alternative is to actually take a page out of Towns’ book, and totally convert farming away from a “passive” task as it currently is and turn it into an active crafting task the same as you’d order a carpenter to make a chair. To do this, you’d start by removing the vanilla farming system altogether; and then make a workstation which just looks an awful lot like a field (for added realism you could have different “fields” for each crop with each one requiring different materials, an appropriate seed/wild plant to start them off, and possibly even other requirements for each growing task – more on that later); and then a single “farm a carrot” job would involve walking over to the workstation, performing an animation, and creating a carrot after an appropriate waiting period. You could, alternatively, have the farmer create some other item (a “young carrot”) to be stored within the farm plot workstation, which then grows on its own for a while; it looks better from a player’s perspective but it requires some shenanigans to make sure that the job to create a young carrot properly counts the stock of carrots in the town’s inventory (otherwise the farmer will continue blindly making young carrots until enough have grown into the proper carrot item, and you’re back to the problem of over-supply.)

For the record, the way that Towns handled this system was that the farm plot was an item with its own independent growth stages but no maximum age where it would rot; it would remain fully grown until harvested. The task to harvest a crop would cause a townie to look for a fully grown crop, convert it to a new item of the same crop type (re-setting its age, and thus its growth state, to 0), and then create the harvested item and end the task. There was also often a chance of a second harvest added, this was done through some shenanigans of having the fully-grown crop item being transformed into a different version which had a chance to spawn the harvested item (as a separate item in the world – due to Towns’ handling of items it could only spawn items into an un-occupied space; which is why it was better to leave a couple of rows between farm plot rows so that townies had somewhere to drop off their harvested items rather than having to walk to the edge of the field to put them down) before that alternative ‘spawner’ crop would turn back to the normal version at age 0 again.

Because Stonehearth handles items and their aging/growing process slightly differently to the way Towns does I don’t think there’s a way to neatly translate that system into Stonehearth using only vanilla Stonehearth; however, I’m pretty sure that ACE adds a similar functionality (I believe it’s related to the “evolve” component, and if I understand correctly it works the same way that Towns’ arguments do), and if that’s the case then you could probably translate Towns’ farming design directly over to Stonehearth using that new component from ACE. However, I’m not entirely certain about how you’d do that since I’m yet to properly dig into modding Stonehearth (I used to mod Towns and stay up to date with all its moving pieces, but sadly I haven’t had the chance to do that with Stonehearth since I have less time to tinker these days and Stonehearth is a much larger and more complex beast than Towns was, data-wise)… in theory it shouldn’t be difficult for someone who knows Stonehearth modding to pull off, though.

Paging @paulthegreat who designed ACE’s new/improved version of the “evolve” component, hopefully he can explain further how it works. Like I said, I believe that the new capabilities from the ACE version of the game would allow a more direct port/translation of the idea from Towns, where there’s a crafting GUI (probably attached to the farmer as you first suggested @Lostsouls46) and orders from that GUI trigger an action involving the item to be harvested being harvested and re-planted.

1 Like

Are you talking about something like the ACE cheese vats (crafted by the cook)? I’m not really sure how you’d translate that into a farming system that isn’t either painfully micro-intensive or has the same perceived issues as the current farming system and is also clunkier, but I don’t know anything about Towns. I think any real transformation of the farming system would require a lot of code [re]writing.

1 Like

Ignoring Towns a bit, what I can imagine (in a more SH way) from what the OP says would be a “selection dropdown box” (or maybe an input-type) (similar to the one we added to shepherd pastures to choose how many animals to keep) and that number would do the same but taking the farming produce from that field in the inventory into account. Similarly to what YetiChow said, but having the check be for sowing and not for harvesting would solve the issues of wasted crops and be less process intensive since the value/check wouldn’t change after each plant is harvested (just a single check to decide whether to sow the field or not after harvest, plus a couple of daily checks for re-sowing (should be efficient enough and not expensive enough)

For example, let’s say the player has 3 choices: “Unlimited”, “100” and “200” (just an example)
And this particular crop produces baskets of carrots. The player chooses 200. So that system would detect there are 200 baskets of carrots (or more) and the farmer would not sow the field. Once the carrots go down under 200 again (being eaten, cooked, etc) the farmer will sow that field.

That way you could both control your overflowing inventories and give more “time” to your farmers.

I kinda like it, actually.

Edit:
Those values would have to be global, per crop. That way if you have multiple fields of the same crop, they would all have the same value set across them. It could also be completely global (a single value for all crops), which would be easier, but I suppose players would appreciate the ability to choose what produce to have more of, etc.

3 Likes

Oooooh, I hadn’t thought of that option of controlling sowing rather than harvesting; but it’s much more elegant and simple even than going the “full Towns route”, and it means not having to eliminate the vanilla SH farming system…

honestly that’s not just the best of both worlds, it’s IMO the perfect balance between player decision making and avoiding the need to micro-manage each farm plot.

For reference, in Towns the farming system treats growing 1 bale of wheat or 1 apple exactly the same as, say, crafting 1 chair – the UI sends a “create item” order to a worker who finds the suitable item in the world, goes there, and creates the item. The only difference between creating an apple and a chair is that the chair also has a “pick up wood and take it to the workstation” action before the worker goes to the workstation and creates the chair; whereas creating an apple uses a harvestable apple tree (which is a different item from a regular fully-grown apple tree*) item in place of a workstation and the apple is created out of thin air after transforming the harvestable apple tree back to a sapling for a regular apple tree (which is again technically a different item from the apple tree itself.)

*Towns was pretty basic in its implementation of items and used a lot of these borderline-voodoo shenanigans hahah. Items don’t have states, each state is a different item and there are various triggers to transform an item into other ones. SH doesn’t do that since items can have multiple states, but previously there wasn’t really any way to have a hearthling go to an item based on its state – either the item itself “called” the hearthling to it, or the hearthling went looking for that item because it was considered as a workbench.

What I was suggesting was to use ACE’s transformation and evolution options to replicate that voodoo method; but what you’ve already implemented with shepherd pastures gives the same result with significantly less shenanigans (and thus, significantly less that can go wrong or get confusing; and hopefully less work to implement)… so I definitely prefer the idea that you’re talking about now that it’s clear how viable and comparatively easy it would be to do.

2 Likes

Could you then make the fields have priorities? So say the farmer has 200 baskets of carrots and doesn’t want to sow anymore. Would it be possible to set up a secondary or tertiary crop to prioritize?

1 Like

Well, I think prioritizing would happen naturally. ie: if your production of carrots is good enough to reach the limit, they’ll have more time for the other crops, which would naturally walk towards their own limits as well (as long as you have a balanced amount of farmers X fields)

Plus controlling sowing also achieves the good effect of having the production yield a lot more than the limit. Let’s say each field gives 70 carrots and you want the limit to be 100, they’ll harvest 2 times before not sowing again, but that will leave you with 120~140 (considering consumption) which will give you free farmer time to focus on other crops. If harvest was the limiter, they would harvest up to 100 and as soon as you go down to 99 they would want to harvest again and so on.

So indeed it is a nice approach, and the more I think of it (and with all YetiChow added to it) I kinda really want it now :smiley:

It would also definitely help - even if indirectly - with overall performance on the long run. It’s very common in SH for people to “overfarm” (farms are TOO efficient) and you end up with tons of extra, useless crops that often gets wasted and spoils before being used or eaten.

With a system like this, players would be able to control their overproduction and avoid the endless sea of baskets that farms often become! :merry:

6 Likes

Really love this idea :heart_eyes:
Maybe a great feature for the ACE Expansion

2 Likes

My solution to overproducing crops is processing them: Cook and Weaver are the easiest way of increasing net worth by both having the processed items in the inventory and selling the excess (you can trade food and tapestries for metal which isn’t renewable until you hit the Geomancer so it’s another plus). And if I overproduce fiber a lot I make one of my combat guys a Weaver so they can get that additional HP for levelling up.

2 Likes

Exactly my train of thought that spawned the idea. Plus I like having my farms aesthetically and dont want to limit their size in order to stop overproduction. Eventually everything gets littered around everywhere :(. I Kind of really want it now too…

well in between there being a cap to X setting in farms, you can always use my MRF mod which just slows farming down to 3x slower. more fields. less over production.

i like the “dont sow new crops when at/over x of this crop” setting though. so yes please

1 Like

I was thinking about this today, if this is possible with farmers, would it be possible with shepherds for butchering animals or getting milk or eggs etc? I love automation and this is the one area where I think Stonehearth needs just a touch of automation.

you havent placed ACE in a while have you? its already in ace :stuck_out_tongue:

1 Like

I actually took a hiatus from stonehearth for a while lol. I got an HTC Vive and Skyrim kind of took over my life… :upside_down_face: I just downloaded ACE last night and havent gotten the shepards yet so I was not aware of that! Thanks :slight_smile:

2 Likes