Farming and the Mercantile
Cleared flat ground can become a field. A field grows one crop at a time. Harvested produce is sold to the Harrison Mercantile, a buyer run by the town, for lumber.
| Crop | Unit | Seed (bd ft) | Grow (hr) | Regrow (hr) | Yield | Base price | Depletes |
|---|---|---|---|---|---|---|---|
| Hay | ton | 30 | 3 | – | 4 | 40 | -0.15 |
| Oats | sack | 40 | 4 | – | 6 | 30 | 0.08 |
| Potatoes | sack | 60 | 6 | – | 10 | 28 | 0.12 |
| Wheat | sack | 50 | 8 | – | 8 | 45 | 0.12 |
| Apple orchard | crate | 300 | 24 | 8 | 10 | 40 | 0 |
Breaking ground costs PLOW_COST = 150 bd ft and one crew-day.
Breaking ground
Section titled “Breaking ground”A parcel can be broken for a field when it is cleared (no standing timber), has no building and no field, is not steep, and is not the landing. Meadow parcels qualify. The new field starts with no crop and fertility 1.
A field can be returned to stump land at any time when no crop is in it. This is free and removes the field and its fertility. It does not restore timber.
Planting and harvesting
Section titled “Planting and harvesting”plant(crop): requires a field with no crop and lumber >= seed lumber -= seed; planted = now; bearing = false
ready when now - planted >= (regrow if bearing else grow) * 3600000
harvest: requires ready and one crew-day units = max( 1, round( yield * fertility ) ) produce[crop] += units fertility = clamp( fertility - depletes, 0.4, 1.0 ) if crop is apples: planted = now; bearing = true otherwise: crop = none (field stays, fertility is kept)The first apple harvest comes after 24 hours. After that the orchard stays in the field and bears every 8 hours. Fertility is applied before the harvest reduces it, so the first harvest of any crop on a new field has full yield. Hay gives a negative depletes, which raises fertility, to a maximum of 1.
Produce is a counter per crop, S.produce. It has no capacity and does not spoil.
The Mercantile
Section titled “The Mercantile”The Mercantile holds a stock of each crop. Stock rises with other farmers’ deliveries and falls with what settlers eat. It pays by how full the shelf is.
| Crop | Shelf cap | Eat per settler per hr |
|---|---|---|
| Hay | 60 | 0.12 |
| Oats | 90 | 0.18 |
| Potatoes | 140 | 0.3 |
| Wheat | 110 | 0.22 |
| Apple orchard | 80 | 0.14 |
Starting stock is half of each cap. Stock is stored with its last update time and advanced in steps of at most 30 minutes:
eat = settlers(t) * MERC[crop].eat units per hourothers = eat * ( 0.55 + 0.35 * sin( t / 3600000 / (5 + len(crop)) + len(crop) ) )stock = clamp( stock + (others - eat) * h, 0, cap )len(crop) is the number of characters in the crop key (hay 3, oats 4, wheat 5, apples 6, potatoes 8). The factor on eat ranges from 0.20 to 0.90 and averages 0.55. Other farmers therefore always deliver less than the town eats, and with no player sales every shelf trends toward empty.
f = (stock + extra) / capprice = max( 1, round( base * clamp( 1.45 - f, 0.45, 1.45 ) ) )An empty shelf pays 1.45 times the base price. A shelf at 100 percent or more of its cap pays 0.45 times it. Between them the multiplier falls in a straight line.
Selling
Section titled “Selling”Selling sells the whole stock of one crop.
n = produce[crop]price = price( extra = n / 2 ) (priced as if half the load is already on the shelf)freight = 0.025 if the player owns a teamster stable, else 0.05net = round( n * price * (1 - freight) )
stock[crop] = min( 1.2 * cap, stock + n )produce[crop] = 0lumber += net; farmed += netFarm income does not count toward produced, so it does not help the deed goal or the Timber baron board. It does not count toward the Merchant board either, because that board reads only town business earnings. A stock above the cap is cut back to the cap the next time the shelf is updated.
Inputs, outputs and state
Section titled “Inputs, outputs and state”Inputs are the crop choice, the crew, fertility, the clock, the settler count and teamster ownership. Outputs are lumber and counters. State: per parcel field = { crop, planted, fert, bearing }; the player counters produce, farmed; and the shelf merc = { at, stock }.
For the shared game
Section titled “For the shared game”The Mercantile is the clearest case of a market that the prototype simulates and a server must replace. One shelf per crop, shared by every player, is the natural model: the price then reflects what all farmers sold. The simulated “other farmers” term should be dropped or tuned down once real farmers exist, since it is a constant drain. A server must own planting time, fertility and harvest, because the grow timers are the only thing that keeps farming from being instant, and must store the shelf with a timestamp so it can be advanced with the same step size for everyone. Selling a whole crop in one transaction at a half-load price is easy to reproduce, but the server will need to decide how a price is quoted to two players selling at the same moment.
Source: prototype/index.html · constants CROPS, MERC, PLOW_COST in rules.json · logic farmable, breakGround, plantCrop, cropState, harvest, backToTimber, updateMerc, mercPrice, sellProduce