Skip to content

CPU agriculture model

A day-stepped farm simulation in pure C#

A never-shipped showcase from the GameDevelopment.GardenFarm leaf. A 12x8 tile garden is planted with a mix of crops, then the world advances one in-game day at a time. Each day a growing-degree-day model pushes plants through their growth stages, an FAO-56 / FAO-33 soil-water balance tracks depletion and water-stressed yield, a deterministic market reprices every crop, and pests roll in on warm days. All on the .NET base library with zero dependencies - the simulation frames become the images below.

96
tiles simulated
40
days stepped
120
harvests
0
NuGet packages
An animated 12 by 8 garden grid stepping across 40 days: bare brown soil greens up as crops grow, gold tiles flag ripe harvests, red pips mark pests, and a coin curve rises at the bottom
40 days, one frame each
The garden over a season

The grid greens up as crops climb their growth stages, tiles flash gold when a plant matures and is harvested (then replanted), red pips flag pests, blue underlines show soil moisture, and the coin curve at the bottom climbs with every sale.

A single day of the garden grid, most tiles lush green with a few ripe gold tiles and scattered pest pips
Single day
One tick, mid-season

A representative day: soil types, growth stages, moisture and pests are all live state read straight off the GardenWorld tile grid.

A line chart of cumulative coins climbing day by day, with blue bars showing the rising cumulative harvest count
Economy readout
Coins and harvests by day

Cumulative coins (green line) versus cumulative harvest count (blue bars). The wallet ends the 40-day season at 282 coins - a net profit of +182 after seed costs, across 120 harvests with zero crop losses.

  • Bare / seeded soil
  • Vegetative growth
  • Reproductive / flowering
  • Mature - ready to harvest
  • Pest present
  • Soil moisture

How it works

Each call to GardenWorld.TickDay(weather) advances the whole garden by one day. For every planted tile it accumulates growing-degree-days from the day's high and low temperatures and moves the plant between the Seeded, Vegetative, Reproductive and Maturity stages; it runs an FAO-56 crop-coefficient evapotranspiration and root-zone water-balance step, so a tile that runs dry loses yield through the FAO-33 stress function; it advances a deterministic seeded market so prices drift day to day; and it rolls pest emergence inside each pest's temperature window. A tiny auto-player harvests any ripe tile and replants it. The visualisation reads that live state directly - no scripted animation. Plain C# on the base library, portable by transliteration and free of any external dependency.