Hell and damnation, I see I've been necro-ninjad. I had some farming stuff in preparation as well. Curse the boss that makes me work weekends. Anyway, at least it motivated me to finish the damn thing and put it here while the thread is hot. Thanks for the recap Dante, it has been useful. I tried to string together a lot of game elements without adding too much complexity or unavoidable micromanagement, while still opening interesting opportunities for synergy. The stuff obviously builds on all the suggestions in this thread and elsewhere.
DF Farming.rtfPlants need:
1. AirAssumed to be present anywhere, dissolved or otherwise.
2. EnergyPlants can acquire energy if the circumstances are appropriate to their tag. Depending on the type, something is used up or energy extracted, but usually not.
- [Photosynthesizers]: light. Green plants. Typically not underground, barring magic. (For the time being, 0 or 1. I suggest standardizing it at a range of 0-7, depending on the light arc.)
- [Saprotrophs]: decaying matter. Normal fungi. Standard choice underground, although the decaying matter still needs to come from somewhere.
- [Parasitics]: other plants. Obviously, that plant does need to get its energy elsewhere. Parasitic mushrooms on the roots of trees qualify.
- [Carnivores]: animals. Drosera, venus flytrap etc. Animals obviously include sapients. Fun, if you tire of guard dogs.
- [Thermosynthesizers]: heat. AFK, only bacteria. In DF, irrigating with lava becomes sensible.
Other sources of energy may be considered (motion, magic, specific minerals, ...) or more specific tags may be wanted (eg. plants that grown only on corpses, or parasitize only specific hosts).
3. WaterPlants get a [moisture tolerance: 0-7] tag in which they grow. One level of water is used up by plants to grow a level. I suggest standardizing the level of moisture in the soil at 0-7. This would correspond with the amount of water left if the square was mined out. A moisture of 0 means that the soil is damp, but not wet enough to leave water when mined out. Any mineral/soil type would have a [moisture containment: 0-7] tag. A square next to a body of water would have its maximum allowed quantity as defined in that tag, a square one step further away the maximum-1, two step m-2, etc. This allows irrigation ditches to moisturize seven squares in every direction. (Water should seep out in quantities equal to the moisture level the square would have had if you didn't mine it out.)
4a. Soil TextureSoil types are few enough to treat them case by case. If a plant has a tag with the soil, it will grow there, otherwise not. Easy modding to add local variety. Loamy sand might qualify for plants requiring either [sand] or [loam], to keep things simple.
4a. Soil pH.I suggest to standardize it in a range of 0-7, or 0-14 in order to facilitate mimicking real plants, or use whatever rating Toady wants to use for acids.
All plants get a [pH range: n-m] tag. Effect: within the pH range, plants grow normally. Outside it, the pH rating is subtracted from the nutrients available, so plants will grow badly or not in areas that are too basic or too sour for them.
Some plants change soil pH (eg. grain decreases it). Some fertilizers/minerals change it (eg. gypsum or the economic stones used for steel increase soil pH); indicate by tagging them. Standard pH for a place depends on the biome. Reverts to standard if fallow.
5. TemperatureIt's unclear how detailed temperature will be kept track of, like light. In any case, like soil pH, plants get a tolerance range, and energy penalties outside it. They also get a preferred range inside that tolerance range, where they get a +1 energy bonus. Thermotropic plants can get more energy out of it.
6. NutrientsSoil contains nutrients. Typical crops use the nutrients in the floor they're planted in (that has the same nutrient rating as a whole square. That makes sense, because topsoil tends to be the most nutrient-dense.) Plants with significant roots can have access to the squares that contain these roots too, typically the ones below the plant. This makes trees a lot more durable.
Dead organic matter returns the nutrients it contains to the soil; energy is lost. It will be mostly energy that is accumulated and used up. The other nutrients ought to cycle around nicely, from plant to animal to meal to dwarf to sewer to manure to field to plant. N, P and minerals have specific minerals that are more effective to supply them; those minerals can be tagged appropriately.
* Energy:
- source: see 2. Energy
- storage: in fruit, seeds & wood.
- function: Maintains plant. Accumulates in fruit and seeds as sugar, starch, fat. Wood contains energy by its nature, useful for fire for those who can't eat it.
Range: might get to be large for energy, especially in old wood or magically stimulated fruit, or later on in the production chain in very elaborate meals. The following three could best be standardized at a range of 0 tot 7.
* N: - source: comes from the soil, or free from the air for N-fixing plants.
- function & storage: seeds, fruit, leaves.
* P: - source: comes from the soil / fertilizer: specific rocks, eg. apatite
- function & storage: blooming, roots.
* Minerals (K, S, Ca, Mg and the rest of Mendelev's table, chair & cutlery):
- source: comes from the soil / fertilizer: any rock
- storage: everywhere in the plant
- function: increase quality of wood, fruit, etc. Those quality levels would determine disease resistance of the plant.
Normal land in a biome (on the map or off-map) is considered stable, and will need no calculations. The nutrient values will be the biome's standard. The nutrients of fallow and untended land will revert towards the biome standard in steps of 1 per season (or year), until they're almost there (leaving some farming history in the form of less/more nutrients locally: nice for reclaiming).
7. Growing plants.Growth levels:Energy is used to maintain the plant during each growth step, and additionally to add energy to wood, seeds and fruit. Lack of energy means the plant loses a growth level.
When available, other nutrients are extracted from the soil in order to form the corresponding tissues for the growth level. If they lack, nothing grows.
The order in which plants try to grow is determined per plant in the raws. For example: [Grow:LLLBLSD] (Leaves, Bloom, Seed, Die) or [Grow:LLWLBLFLSLWLL] (Wood).
Growth speed: Three options to choose from:
- environment-based: The game checks often and makes the plant grow whenever nutrients and conditions are good. CPU-expensive.
- plant-based: Tries to grow a plant every n frames, depending on the plant: allows to differentiate plants with growing speed. The middle ground.
- time-based: Tries to grow all plants at certain times in a year. Constraining, but CPU-cheaper.
Conceivably, there could be differentiation between plant zones and other places.
8. Managing plant growth.Plant zones:Plant zones are defined using a combination of room flow/zoning tools. In them, a variety of plant-related tasks can be scheduled either in a yearly schedule or on an as-needed basis: that means dwarves with the appropriate skill go do a job as soon as needed (eg. watering: maintain moisture level x, weeding: yes/no, woodcutting: some/lots/all, fertilizing: maintain nutrients level x,...) with the distinction that more highly skilled ones will react faster.
It would be convenient to combine these with animal zones (for fishing, herding animals -> fertilizer & grazing pastures, that need clearcutting). Even a combination with stockpiles is possible (so you can stockpile meat chunks in the wolf pit, or farm saprofytic mushrooms on the refuse pile).
This allows to give orders for a group of squares, but they can still be separately affected by cave-ins, goblin trampling, flooding, etc. Weeds/unwanted plants grow normally.
9. Tracking food value[/u]
If nutrients and energy are tracked throughout the production chain, we only need to adjust the base productivity of the plants to adjust game balance. This is very useful for modders who want to adjust productivity with a few broad strokes. It's still possible to adjust reactions later in the production chain.
Therefore, every organic item should track its nutrient and energy content, for example potash, which contains all the nutrients of the wood that was burnt to make it.
(Rough correspondences plant vs. animal: (to give an idea, no conversion happens)
- Energy: sugar, starches and fat.
- N : proteins.
- P: bones
- Minerals: everything else, general healthiness.)
Rotting organics add their nutrients to the soil. If that's not possible, the adjacent soil. If that's not possible (rock floor, too much nutrients, for example), it turns into compost (except the bones, of course), containing all the nutrients and usable as fertilizer by a farmer.
10. Balancing- Balance: This is an alpha. We can't, nor should we try to, finetune the game balance. The best we can do is to identify the levers that will allow the modders to find their balance later on.
- Mining efficacy, trade opportunities, trade value of cooked meals, stacking, pathfinding, skill efficacy, % of world suitable for agriculture, racial abilities, etc. don't belong in a farming discussion. Let's identify where eg. skill ought to play a role, but not how much yet.
- All given numbers are naturally subject to change.
- As a benchmark (based on historical observation), I suggest that farming with totally unskilled farmers, using a basic crop, leaving the land fallow half the time, using no fertilizer but not exhausting the land either, ought to require 50% of the population.
- This is intended as maximum complexity. Init options might set any of the discussed variables to an average standard, reducing the maximum yield possible, but making the supply more steady.
- The true nutritional value can be adjusted a lot through the food preparation reaction raws. I expect at least distillation for example to add energy.
- The first step will be to set up plants. Everything flows from that.
- The big hidden lever is: the energy requirements per creature per action. I'd like to see those rawed.