Author Topic: Farmers + land = food  (Read 819 times)

Offline Chris

  • Game Owner
  • Level 35
  • *
  • Posts: 2,217
  • Reputation: +28/-1
    • View Profile
Farmers + land = food
« on: September 14, 2010, 07:00:23 PM »
Farmers work on land to produce food. Land alone or farmers alone produce nothing. How to make a formula that would take into account both these factors in a more on less realistic (and playable) way?

I think land is more scalable than farmers. Because if you have a lot of land and few farmers, farmers will simply plow the most fertile land giving more crops. On the other hand, if you have 5 or 10 farmers plowing your small garden it won't make any difference.

Offline Sagefire135

  • Level 14
  • *
  • Posts: 107
  • Reputation: +2/-0
    • View Profile
Re: Farmers + land = food
« Reply #1 on: September 14, 2010, 08:40:53 PM »
if you pretend that [1 farmer] can tend [1 land] to produce [1 food] ... when farmers >= land then land = food, when farmers < land then farmers = food. your equation would have to be piecewise but very simple.

in general if [x farmers] can tend [y land] to produce [z food] then ... when farmers >= (x/y)*land then land*(z/y) = food. when farmers < (x/y)*land, then farmers*(z/x) = food.

i cant think of a way to realistically account for both farmers and land in a 'single equation' though, in every case one of the factors becomes totally irrelevant.

Offline dsheroh

  • Level 21
  • *
  • Posts: 235
  • Reputation: +6/-0
  • Perl Vicar
    • View Profile
    • Psi Rangers
Re: Farmers + land = food
« Reply #2 on: September 15, 2010, 07:58:46 AM »
Sagefire's already given the straightforward answer of "food = min(land, farmers)", but that answer ignores one detail:

if you have a lot of land and few farmers, farmers will simply plow the most fertile land giving more crops.

When land > farmers, productivity per farmer increases (at least in Chris' mind; I have no idea about the real world), making it not just a question of using whichever of the two values is smaller.

If land <= farmers, then food = farmers (still), so that's an uninteresting case.

If land > farmers, then food = farmers * f(farmers, land), where f() returns a value equal to or greater than 1 based on the ratio of farmers:land.  The question, then, is what f() should look like.  I'd be inclined to go with something incorporating a logarithm, if only because logs are commonly seen in this sort of "natural" relationship.  At a first pass:

f(farmers, land) = ln(e * land / farmers)

Where land = farmers, f(farmers, land) = ln(e) = 1.  Where land > farmers, f(farmers, land) > 1, with the result increasing by 1 for every power of e (roughly 2.71828 for those unfamiliar with natural logs) by which land exceeds farmers - if land = 2.7 * farmers, then farmers are twice as productive; if land = 7.4 * farmers, then farmers are three times as productive, etc.

For actual use, you'd probably want to slow the rate of f()'s growth if you want players to shoot for land = farmers, especially if farmers have any kind of ongoing upkeep associated with them, but that's for you to determine.

Offline Chris

  • Game Owner
  • Level 35
  • *
  • Posts: 2,217
  • Reputation: +28/-1
    • View Profile
Re: Farmers + land = food
« Reply #3 on: September 16, 2010, 07:31:06 AM »
Crash agrial course for kids from a big city :D
- plants need to "eat" 3 things: sun rays, water and minerals
- land is divided into 6 classes, depending on minerals richness, acidity, ability to hold water (clay), depth of water table, presence of rocks, etc. Class V-VI is recommended for forests but can be farmed with increased effort and heavier use of fertilizers. In some countries you might be disallowed to construct buildings on class I-III land since it is considered too precious.
- minerals are depleted when the same type of plant is grown, in early medieval times 1/3rd of the land was left unused so it can regenerate. Later they make a great invention, crop rotation, which is land divided into 4 plows each growing different type of plant (like plant 1 uses mineral A and extracts mineral B then you gown plant 2 that need mineral B but extracts mineral A).
- viruses, bacterias, pests, funguses can ruin the crops, the chance of occurence increases dramatically in case of mass farming of the same crop (think of it as an epidemy in a huge city without severs system, it works the same with plants) and lack of cold winter (cold kills these things). The most famous one was patato hunger in Ireland. In the past the only line of defence was plowing the land before winter so all evil things burined underground become exposed to the surface and do not survive the cold. Nowadays we have fungicides (kills funguses), pesticides (kills pests), herbicides (kills bacterias/viruses) (if you ever wondered why modern agriculture required so much chemistry now you have the answer :D)
- other non farmed land types can affect farming in a long term, like forests prevents the land turning into desert (Hispaniola island turned partially into subdesert due to monoculture of cotton during colonial times) and  soften the effects of droughts (ability to accumulate water) and marshers preventing floods.

Quote
i cant think of a way to realistically account for both farmers and land in a 'single equation' though, in every case one of the factors becomes totally irrelevant.
It does not need to be a single equation, althrough it would be nice.

I think there should be some cap based on land. I mean, it is the land producing food, not farmers. Farmers just help it grow, do the initial seeding and harvest it. There is some maximum number of plants that can grow on 1 acre of land and no matter how much you tend it you won't increase it after some point.

Let's say, assuming the best land is used, it would be 1 land = max 5 food (10 with fertilizers). This assumes crazy effort. Normal gain with very good farmers count could be 3 or 4 food per 1 land.

There is also some minimum number of farmers per land needed. If you have 1 farmer tending all fields in Australia, well, no matter how much more land you gain you won't get any addditional food at all :)

Offline Topazan

  • Level 14
  • *
  • Posts: 117
  • Reputation: +3/-0
    • View Profile
Re: Farmers + land = food
« Reply #4 on: October 03, 2010, 12:40:58 AM »
Quote
Crash agrial course for kids from a big city Cheesy
- plants need to "eat" 3 things: sun rays, water and minerals
- land is divided into 6 classes, depending on minerals richness, acidity, ability to hold water (clay), depth of water table, presence of rocks, etc. Class V-VI is recommended for forests but can be farmed with increased effort and heavier use of fertilizers. In some countries you might be disallowed to construct buildings on class I-III land since it is considered too precious.
- minerals are depleted when the same type of plant is grown, in early medieval times 1/3rd of the land was left unused so it can regenerate. Later they make a great invention, crop rotation, which is land divided into 4 plows each growing different type of plant (like plant 1 uses mineral A and extracts mineral B then you gown plant 2 that need mineral B but extracts mineral A).
- viruses, bacterias, pests, funguses can ruin the crops, the chance of occurence increases dramatically in case of mass farming of the same crop (think of it as an epidemy in a huge city without severs system, it works the same with plants) and lack of cold winter (cold kills these things). The most famous one was patato hunger in Ireland. In the past the only line of defence was plowing the land before winter so all evil things burined underground become exposed to the surface and do not survive the cold. Nowadays we have fungicides (kills funguses), pesticides (kills pests), herbicides (kills bacterias/viruses) (if you ever wondered why modern agriculture required so much chemistry now you have the answer Cheesy)
- other non farmed land types can affect farming in a long term, like forests prevents the land turning into desert (Hispaniola island turned partially into subdesert due to monoculture of cotton during colonial times) and  soften the effects of droughts (ability to accumulate water) and marshers preventing floods.

I'll take a crack at this.

First, let's imagine the ideal ratio of farmers to land, the point where every piece of usable land is planted, and every crop is perfectly tended.  I'll call a base unit of land a "field".

Now, as you said, if you had less than the ideal amount of labor the farmers would prioritize the most fertile land.  That means that diminishing returns are involved when inputting labor into a given field.

Picture a line graph with labor on the x-axis and crop production on the y-axis.  The line has a curve on the top left side, and after tinkering with a graphing calculator, I have recalled that equations with fractional exponents behave that way.  So we have this equation:

Code: [Select]
Field output = labor^(laborExponent)laborExponent = a number between 0 and 1.  It can vary according to the field if you want, representing the fact that different fields may have different distributions of land quality.  I would make it a constant for simplicity's sake.

A simpler way to simulate differences in minerals, land class, and weather would be abstracting them into a multiplier.
Code: [Select]
Field output = labor^(laborExponent) * landQualityModifiers
As for disease, I think that works best as a random event.  If you want the farmers to be involved, the player can have a slider to set the percentage of time spent warding off disaster vs tending the crops.  This is fairly simple matter, a percentage of time spent preventing disaster means that percentage of labor is removed from the field output equation, and the chance of disaster is reduced accordingly.  The effects of geography can work the same way, or they can be outside the player's control.

Ok, so what if a player owns multiple fields of different quality?  The system would prioritize the labor where it produces the largest increases in output.  I have an idea for that, but this will probably be confusing enough as it is.

Now, lets do some experimentation.

Let's set the laborExponent at 0.5.  The farmer produces 10 labor points, and each field can use no more than 5.  The landQuality is 1 (baseline), so we'll ignore it.

Code: [Select]
1 farmer, 2 fields
fieldOutput = 5^0.5 = 2.5
totalHarvest = 5
The field can't take more that amount of labor, so adding farmers at this point won't do anything but free up some labor for disaster prevention.

Code: [Select]
1 farmer, 5 fields
fieldOutput = 2^0.5 = 1.4
totalHarvest = 7.07
The farmer gets a little bit of an advantage from having all this land to pick from to find the most productive, but he can't work all 5 fields to their maximum productivity by himself, so let's add another.

Code: [Select]
2 farmers, 5 fields
fieldOutput = 4^0.5 = 2
totalHarvest = 10

I don't know if any of that was useful, or just gibberish, but it sure was fun to work out, if a little frustrating.  :)

EDIT:  Forgot to mention, in those examples the labor is equally distributed among fields because I believe that's the ideal setup given identical laborExponent, landQuality, and maximum labor per field.  If I'm wrong, oh well. :P

I also implied, but didn't say that that there has to be a maximum labor per field.  That's an important part of the system.
« Last Edit: October 03, 2010, 01:01:33 AM by Topazan »

Offline Chris

  • Game Owner
  • Level 35
  • *
  • Posts: 2,217
  • Reputation: +28/-1
    • View Profile
Re: Farmers + land = food
« Reply #5 on: October 03, 2010, 06:16:03 AM »
Picture a line graph with labor on the x-axis and crop production on the y-axis.  The line has a curve on the top left side, and after tinkering with a graphing calculator, I have recalled that equations with fractional exponents behave that way.  So we have this equation:
Code: [Select]
Field output = labor^(laborExponent)
Nice. So the formula would be like this:
Code: [Select]
food=min(5,(farmers*10)/fields)^0.5*fields;
What would be the best ratio of farmers with this system (assuming shortage of population)? I disagree with the definition of max farmers being called "ideal" number. The optimal should be something lower. The maximum would be overcrowded fields, used when you really have no land. So like dimishing returns going BOTH ways, from the optimal ratio. This would be probably the best gameplay wise.
Or maybe this formula works this way (haven't checked)?

Are there any online graphing calculators? Would be useful...


Next thing, fertilizers.
Fertilizers were an extremely useful invention. It provides minerals to the soil resulting in more crops per field. This is different than labour, since it forces fields to go above their default capacity. These are used two ways. One is to enchance output of already existing very good fields. The other, probably more important, is enchancing capacity of poor fields. Fertilizers allow usage of poor soil that would be otherwise unusable for farming.  

What I thought so far was a flat multiplier to global farming output with the assumption of max 1 fertilizer per 1 field.

Code: [Select]
food = food from previous formula * (1+min(1,fertilizers/fields))I wonder if this is not oversimplified, since in reality the worse land benefit more from fertilizers. Also, maybe a player want to save same fertilizers and use it only for best return fields? Althrough the simple one has its beauty when it comes to explaining it to players...

« Last Edit: October 03, 2010, 01:36:34 PM by Chris »

Offline Topazan

  • Level 14
  • *
  • Posts: 117
  • Reputation: +3/-0
    • View Profile
Re: Farmers + land = food
« Reply #6 on: October 03, 2010, 12:23:51 PM »
Quote
food=min(5,(farmers*10)/fields)^0.5*fields;

Nice, didn't realize you could do it all in one equation like that.  :)  Of course, that probably only works if every field has the same attributes.

Quote
What would be the best ratio of farmers with this system (assuming shortage of population)? I disagree with the definition of max farmers being called "ideal" number. The optimal should be something lower. The maximum would be overcrowded fields, used when you really have no land. So like dimishing returns going BOTH ways, from the optimal ratio. This would be probably the best gameplay wise.
Or maybe this formula works this way (haven't checked)?
Max farmers maximizes output per field.  If you want to maximize output per farmer, you would do that by maximizing fields per farmer.

I don't think you can determine the "optimal ratio" unless you know how much it would cost, in food, to add a farmer vs how much it would cost to add a field.
EDIT: No, I take that back.  You just need to know how much they cost relative to each other, then you can calculate "max food per dollar invested".  I don't know how to write it as an equation, but you can start with 1 field, 1 farmer and add whichever one gives better value until you find the pattern.

Hmm, with the current system the maximizing output per farmer would mean infinity fields per farmer.  Let's amend the formula to reflect that one farmer can't work that many fields.
Code: [Select]
food=rounddown(min(5,(farmers*10)/fields))^0.5*fields
This means that if a field has less than 1 unit of labor, output is 0, so a farmer can't work more than 10 fields.

The formula should already reflect diminishing returns for both labor and fields as you approach the maximum of each.

Quote
Are there any online graphing calculators? Would be useful...
I used this site for graphs and this one for algebraic equations when I was working this out.  Probably would have been easier if I could find my old TI-83. :)

Quote
I wonder if this is not oversimplified, since in reality the worse land benefit more from fertilizers.
If different fields have different attributes, you'd probably have to calculate output one by one.  Hm, how about:
Code: [Select]
food = food from previous formula * (1+min(1,fertilizer+baseFertility))Better fields would have a high baseFertility, so adding fertilizer might only increase their output slightly before they hit the max.  Worse fields would get the full effect of the fertilizer.

An algorithm to determine the optimal distribution of resources would be a whole nother can of worms.  With one variable you could brute force it through trial and error, but with multiple variables?  There's probably a way, but I have no idea how
« Last Edit: October 04, 2010, 09:01:21 PM by Topazan »

 


SimplePortal 2.3.3 © 2008-2010, SimplePortal