Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Grain farming expansion and seed adjustments #65924

Merged
merged 133 commits into from
Jul 9, 2023

Conversation

worm-girl
Copy link
Contributor

@worm-girl worm-girl commented May 30, 2023

Summary

Features "Expand grain farming and adjust seeds"

Purpose of change

#64807 and the ensuing discussion outline several issues with farming, specifically that it's a fire-and-forget process with almost no character-side labor time involved. In reality, pre-industrial farming was backbreaking work that demanded enormous man-hours to keep people fed.

Previously, it was possible to plant a few wheat or barley seeds in a matter of minutes and return later in the year to a field which yielded tens of thousands of calories of unspoilable food which required no processing or even cooking. Picking a plot of crops was nearly instantaneous and had no calorie cost. This skipped many important steps in the real-life process and trivialized food acquisition, which especially late in the mid to late game should be an important survival concern.

#49327 identifies farming, base management, and food security as avenues for building out the mid game. While this PR doesn't address any of the concerns specific to growing and tending plants (that's beyond me, codewise) it does try to build a much more robust and accurate simulation of small-scale grain production, which I hope will spur further development in this area.

Lastly, the biggest justification in my mind for complexifying this process is that many players, myself included, enjoy the homesteading aspect of the game. I personally don't see farming as a button you push to receive food, it's fun part of the game in itself, food just happens to be the reward.

Describe the solution

GRAINS HAVE BEEN OVERHAULED

Someone overhauled corn a while back, but the other grains were left undone. I have largely left corn alone and approached the rest of the gains with an eye toward creating parity with corn.

  • Wheat, barley, wild rice, oats, buckwheat, and canola must be harvested with a tool that has the grass cutting quality. At the time of this writing, that includes: bill, bronze bill, combat machete, machete, makeshift machete, stone sickle, tempered combat machete, bronze sickle, scythe, scythe, sickle.

There's presently no difference between these tools, if it cuts grass it'll do the job. Cutting wheat with hand tools seems tricky, but it's a pretty fast process once people get going. I don't know that there's much point in getting more granular than that.

Cut grain can be eaten by cattle mutants immediately, it also works as cattle fodder.

  • Wheat, barley, wild rice, oats, and buckwheat must be dried before use.

These plants now have the FRESH_GRAIN flag, which allows them to be dried in a stook. A stook is a traditional method for drying grain where you pile cut stalks in a self-supporting A-frame shape which keeps their heads off the ground and away from moisture and vermin. To make a stook, simply build a stooking spot, which has a 10L storage capacity - more than enough for lots of grain, but capped for sanity's sake. Place undried grain stalks on the spot, and examine it. After two weeks, it may be examined again to take it down and receive your dry grain.

It is also possible to use a smoker or any other food dehydrating method to dry your grains. Lentils IRL typically dry on the plant and are harvested without need for further drying. I am aware that in some cases it's possible to let other types of grains dry in the field (a process known as "drying down"). This comes with certain complications, such as the grain rotting, freezing, blowing away, or lodging, but there's no reason it shouldn't be possible under the right conditions. However, our plant code is pretty simplistic, and expanding it to account for things like rainfall, swathing, wind, and temperature are beyond my abilities, so it's out of scope at this time.

Corn cannot currently be stooked even though it's possible IRL. This is because corn is harvested by hand as ears, rather than cut as whole stalks. The best solution to this would probably be to allow the player to choose whether to cut or pick corn while harvesting it, but that's out of scope for this PR. It does seem like it might be useful though.

  • Dried grain cannot go bad.

Dry grain IRL has a shelf life that often gets into the decades if stored properly, and really only risks going bad if it's exposed to moisture or other bad conditions. This isn't something we currently model, so for now you can have fun making a corn fort.

  • Dried grain must be threshed before use.

Once you have dried the grain by whatever method you like, you must thresh it. There are currently two methods to thresh grain: A peasant flail; or a cudgel, plank, stick, or wooden club. The flail is much faster as it's a purpose-built tool, the other items are slow but not intolerably so.

Adam Ragusea states that his amateur attempt to thresh what looks like two tiles of wheat without a flail took him about half a day.

Living History Farms states that a 19th century farmer with a flail could do about 420 pounds of wheat per day.

The conclusion I drew was that this is a painstaking process that scales extremely well, and that proper tools really help. Beating a small pile of wheat is not really all that different from beating a large pile of wheat, and the force of your blows is going to be distributed well through even a very large heap. Thus a fit and determined survivor wielding a peasant flail can do 700 stalks of wheat (around 450 pounds) in a 16 hour work day, accounting for weariness and meal breaks.

Threshing grain produces 2 piles of straw per unit of grain, except for lentils, rice, and buckwheat, which only produce 1 due to having either smaller portion size, being smaller plants, or both. Straw can now be crafted into cattle fodder (if you have a lot of it) or eaten by cattle mutants.

  • Threshed grain must be winnowed before use.

Winnowing is a much less laborious process than threshing, though doing it by hand can take longer. The traditional method is to toss it in the air on a windy day and let all the seeds fall to the ground while the chaff blows away. The seeds can also be sifted out or even picked out by hand. There are many many tools that have been used historically for this process, such as pitchforks, paper fans, special baskets, etc., but for sanity's sake I have settled on two recipes - one requires no tools and is slow, the other uses an electric device which blows air to do it much more quickly.

Introducing the BLOW_AIR quality. Currently this includes hair dryers and desk fans, though I'm sure other stuff could be added. These items now take medium batteries, break in water, and have power draws taken from some rough googling and comparison with other appliances.

Winnowing produces 1 pile of chaff per unit of grain. Chaff is a new item which can be made into cattle fodder or bird food (at 50 and 25 units respectively), or eaten by cattle mutants.

Wild rice can't be winnowed, as the hulls stick too tightly to the seed. Instead, it's milled. This was actually the case before this PR and remains unchanged.

  • Dry grain and raw beans are now inedible.

The implementation was not at all uniform, but in many cases, dry grains were previously edible with little consequence, which is not true in real life. Humans cannot digest large amounts of dry cellulose, and if we eat more than a tiny amount of the stuff, we will get sick. Uncooked beans tend to contain toxins that can make you very sick or even kill you, and every google result for "can I eat raw rice" or "can I eat raw beans" begs you not to do it. Our ancestors didn't invent cooking and milling for nothing.

All grains must now be cooked or turned into flour before consumption, unless the player is a cattle mutant. If this gets merged, I'll add a way for birds, rats, and mice to eat raw grains and for rabbits to eat straw.

MISC OTHER CHANGES

  • Seeds have been more or less standardized to be 1:1 with crop items, except in edge cases like watermelons and sunflowers where the food produces an outsized amount of seeds IRL. One of the reasons watermelon and pumpkin were popular subsistence crops historically is that a single fruit produces a tremendous amount of seeds and quickly pays for itself.

Seed amounts were pretty arbitrary, and seem to have not been consistently implemented. Now, a "seeds" item generally represents a handful of seeds, enough to sow a roughly 2 meter square area and produce a full harvest in that tile.

  • Many crops will no longer give seeds on harvest.

Getting seeds from food crops is a little more complicated. Previously you'd just get random seeds out of nowhere when you harvested. This is still true for carrot, garlic, onion, dahlia, cotton, bamboo, spurge, datura, cattail, lettuce, chicory, mustard, burdock, salsify, mugwort, tobacco, dogbane, cabbage, bee balm, broccoli, cannabis, chamomile, wild root, dandelion, wild herb, sunflower, wild garlic, horseradish, decorative plant, groundnut, wild sasparilla, and jerusalem artichoke, but all other plants (notably grains and fruiting crops) now require you to craft seeds out of your produce.

Loose grains and legumes now act as seeds, but are categorized as food. Dried versions of these items can be crafted into seeds, but those seeds can also be crafted back into the food version. This allows a player without access to drying facilities to plant some fresh beans they found, but doesn't screw up sorting zones or NPC work. It also lets you decide that you're going to cook that seed corn instead of eating it, or vice versa.

All other fruits and vegetables will only give seeds if you craft them into seeds. This destroys berry-sized fruits, but larger fruits (cucumber, zucchini, bell pepper, tomato) give you a cut up version which has a much shorter shelf life but otherwise serves in place of the original.

  • Harvesting crops takes 60 seconds and is light exercise.

Harvesting previously took 10 seconds and didn't have an activity level. While it would be possible to define harvest difficulty and time in the seed jsons, I've decided that's a lot of fiddly work for questionable benefit and is out of scope for now. Harvesting crops is now light exercise and takes 60 seconds per tile for all crops. This feels generous to the player considering that while picking zucchini would only take a couple of seconds, picking berries can take quite a while, and cutting cane can be extremely strenuous work. Harvesting can still be fobbed off on NPCs via zones, faction camps, or Tacoma.

  • Oats were for some reason set to only 45 days to grow. This was fixed. I went for a reasonable average for the region (65 days) per this source: https://fieldcropnews.com/2012/07/summer-seeding-oats-for-extra-forage/

  • Soybeans were kinda weird all over. I've given them a proper drying recipe and made raw edamame the product rather than the byproduct. Edamame can be disassembled to make soybeans, which can then be dried, planted, or cooked. Dried soybeans can be planted, cooked, turned into soy nuts, or milled into wheat-free flour.

  • Pumpkins no longer have charges. Pumpkin volume and weight were way off. Pumpkins now use the format established by melon and watermelon. A whole pumpkin is inedible, but it can be disassembled into 4 edible and cookable sections with a much shorter rot timer, this also yields a bunch of seeds. This means it's no longer possible to grow 1/3 of a pumpkin.

  • INEDIBLE flag now properly makes food inedible when it doesn't also have one of CATTLE, BIRD, LUPINE, FELINE.

Describe alternatives you've considered

I would have preferred splitting the seed changes out into a separate PR, but they're tied up with the grain changes, so it's all done at once here.

I have included both craft (into seed) and uncraft recipes for fruits. I can get rid of the uncraft recipes if they're too superfluous, but uncrafting is already how melons and watermelons were handled, as well as nuts and edamame. I'd love to hear feedback on which method would be preferred, or whether both are fine.

Pushed out to future PRs: Threshing and winnowing jobs at the faction camp, making seeds edible for birds, making straw edible for rabbits, product-dependent tool requirements for faction camp farming jobs.

Testing

Testing checklist:

  • Plant every type of seed and item with a seed function, confirm they grow up into the correct plant
  • Harvest every type of plant. Confirm 60 second harvest time. Confirm that cut_harvest plants need a grass cutting tool
  • Assign NPCs to plant every type of seed and item with a seed function to confirm they can do it.
  • Assign NPCs to harvest every type of plant and confirm that they can do it. Observe mixed cut and non-cut behavior w/npcs.
  • Stook all fresh stalks, make sure that they work properly
  • Try stooking rotten stalks to make sure they don't work
  • Try stooking non-stalk items to make sure they don't work
  • Observe bash and deconstruct results for full and empty stooks
  • Observe fire and bullet results for full and empty stooks
  • Thresh every dry stalk type to ensure proper results
  • Winnow every threshed grain type to ensure proper results
  • Mill rice to make sure it still works.
  • Make sure all dry/raw grains and beans are inedible, except for cattle mutants
  • Make sure all stalks and threshed grains are inedible, except for cattle mutants
  • Check sorting zone behavior for all stalks, dry stalks, threshed grains, grains, raw beans, raw edamame, dry beans
  • Make sure faction camp farm behavior is not affected
  • Adjust farm task faction camp calorie costs if necessary (it's not)
  • Ensure Tacoma jobs don't give seeds improperly
  • Ensure faction camp jobs don't give seeds improperly

Additional context

image

https://www.youtube.com/watch?v=_pDTiFkXgEE

  • Cattle fodder and bird seed recipes overall feel unsatisfying to me and could use another pass later. It's probably not worth doing until animal food is necessary for something other than taming, so I won't worry too much about it now.

closes #65967

@Procyonae
Copy link
Contributor

Looks cool, in case you haven't noticed though you have a load of usb changes in there too

@worm-girl
Copy link
Contributor Author

Thanks. I must have misclicked when the merge conflict popped up.

@github-actions github-actions bot added <Enhancement / Feature> New features, or enhancements on existing [C++] Changes (can be) made in C++. Previously named `Code` [JSON] Changes (can be) made in JSON Crafting / Construction / Recipes Includes: Uncrafting / Disassembling EOC: Effects On Condition Anything concerning Effects On Condition Fields / Furniture / Terrain / Traps Objects that are part of the map or its features. Items: Food / Vitamins Comestibles and drinks labels May 30, 2023
Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remaining comments which cannot be posted as a review comment to avoid GitHub Rate Limit

JSON & C++ formatters

data/json/recipes/food/corn.json|137|
data/json/recipes/food/corn.json|153|
data/json/recipes/food/corn.json|157|
data/json/recipes/food/corn.json|171|
data/json/recipes/food/corn.json|175|
data/json/recipes/food/corn.json|190|
data/json/recipes/food/corn.json|205|
data/json/recipes/food/corn.json|212|
data/json/recipes/food/corn.json|227|
data/json/recipes/food/corn.json|231|
data/json/recipes/food/corn.json|245|
data/json/recipes/food/corn.json|249|
data/json/recipes/food/corn.json|264|
data/json/recipes/food/corn.json|279|
data/json/recipes/food/corn.json|286|
data/json/recipes/food/corn.json|302|
data/json/recipes/food/corn.json|306|
data/json/recipes/food/corn.json|320|
data/json/recipes/food/corn.json|324|
data/json/recipes/food/corn.json|339|
data/json/recipes/food/corn.json|354|
data/json/recipes/food/corn.json|361|
data/json/recipes/food/corn.json|376|
data/json/recipes/food/corn.json|380|
data/json/recipes/food/corn.json|394|
data/json/recipes/food/corn.json|398|
data/json/recipes/food/corn.json|413|
data/json/recipes/food/corn.json|417|
data/json/recipes/food/corn.json|432|
data/json/recipes/food/corn.json|436|
data/json/recipes/food/corn.json|451|
data/json/recipes/food/corn.json|466|
data/json/recipes/food/corn.json|473|
data/json/recipes/food/dairy_products.json|127|
data/json/recipes/food/dry.json|399|
data/json/recipes/food/dry.json|430|
data/json/recipes/food/dry.json|461|
data/json/recipes/food/dry.json|492|
data/json/recipes/recipe_food.json|9173|
src/iexamine.cpp|2638|
src/iexamine.cpp|2642|
src/iexamine.cpp|3114|
src/iexamine.cpp|3156|
src/iexamine.cpp|3168|
src/iexamine.cpp|3171 col 1|
src/iexamine.cpp|3172 col 1|
src/mapdata.h|841|

data/json/items/comestibles/junkfood.json Outdated Show resolved Hide resolved
data/json/items/comestibles/other.json Outdated Show resolved Hide resolved
data/json/items/comestibles/other.json Outdated Show resolved Hide resolved
data/json/items/comestibles/other.json Outdated Show resolved Hide resolved
data/json/items/comestibles/other.json Outdated Show resolved Hide resolved
data/json/recipes/food/corn.json Outdated Show resolved Hide resolved
data/json/recipes/food/corn.json Outdated Show resolved Hide resolved
data/json/recipes/food/corn.json Outdated Show resolved Hide resolved
data/json/recipes/food/corn.json Outdated Show resolved Hide resolved
data/json/recipes/food/corn.json Outdated Show resolved Hide resolved
worm-girl and others added 10 commits May 29, 2023 19:40
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Copy link
Contributor

@github-actions github-actions bot left a comment

data/json/recipes/food/corn.json Outdated Show resolved Hide resolved
data/json/recipes/food/corn.json Outdated Show resolved Hide resolved
data/json/recipes/food/corn.json Outdated Show resolved Hide resolved
data/json/recipes/food/corn.json Outdated Show resolved Hide resolved
data/json/recipes/food/corn.json Outdated Show resolved Hide resolved
data/json/recipes/food/corn.json Outdated Show resolved Hide resolved
data/json/recipes/food/corn.json Outdated Show resolved Hide resolved
data/json/recipes/food/corn.json Outdated Show resolved Hide resolved
data/json/recipes/food/corn.json Outdated Show resolved Hide resolved
data/json/recipes/food/corn.json Outdated Show resolved Hide resolved
worm-girl and others added 3 commits May 29, 2023 19:50
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@github-actions github-actions bot removed the BasicBuildPassed This PR builds correctly, label assigned by github actions label Jun 18, 2023
@github-actions github-actions bot added the json-styled JSON lint passed, label assigned by github actions label Jun 18, 2023
@worm-girl worm-girl closed this Jun 18, 2023
@worm-girl worm-girl reopened this Jun 18, 2023
@worm-girl
Copy link
Contributor Author

worm-girl commented Jun 18, 2023

([slow] ~starting_items)=> overmap_test.cpp:?
([slow] ~starting_items)=> Backtrace emission took 1 seconds.
([slow] ~starting_items)=> (continued from above) ERROR : src/vehicle.cpp:1811 [bool vehicle::remove_part(const int, RemovePartHandler &)] Removing out of bounds vehicle part at (3,-1,0) from vehicle 4x4 Car (4x4_car_diesel)144.218 s: overmap_terrain_coverage
([slow] ~starting_items)=> ===============================================================================

Clang 10's latest failure doesn't seem related to this PR, which has nothing to do with vehicles.

@worm-girl worm-girl closed this Jun 19, 2023
@worm-girl worm-girl reopened this Jun 19, 2023
@github-actions github-actions bot added the BasicBuildPassed This PR builds correctly, label assigned by github actions label Jun 20, 2023
.gitignore Outdated Show resolved Hide resolved
@worm-girl
Copy link
Contributor Author

@bombasticSlacks Fixed. I was having some trouble with old changes on my fork trying to sneak into this PR and I thought adding the files to gitignore would prevent that from happening. This website is very confusing 😅

@github-actions github-actions bot removed the BasicBuildPassed This PR builds correctly, label assigned by github actions label Jun 26, 2023
@worm-girl worm-girl closed this Jun 29, 2023
@worm-girl worm-girl reopened this Jun 29, 2023
@github-actions github-actions bot added the BasicBuildPassed This PR builds correctly, label assigned by github actions label Jun 30, 2023
@Maleclypse Maleclypse merged commit 5d00d62 into CleverRaven:master Jul 9, 2023
@Karol1223 Karol1223 mentioned this pull request Feb 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
astyled astyled PR, label is assigned by github actions BasicBuildPassed This PR builds correctly, label assigned by github actions <Bugfix> This is a fix for a bug (or closes open issue) [C++] Changes (can be) made in C++. Previously named `Code` Crafting / Construction / Recipes Includes: Uncrafting / Disassembling <Enhancement / Feature> New features, or enhancements on existing EOC: Effects On Condition Anything concerning Effects On Condition Fields / Furniture / Terrain / Traps Objects that are part of the map or its features. Items: Food / Vitamins Comestibles and drinks [JSON] Changes (can be) made in JSON json-styled JSON lint passed, label assigned by github actions Missions Quests and missions Player Faction Base / Camp All about the player faction base/camp/site
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Watermelon calories and quench seem absurd