Devlog · Entry 1
How About the Price of Grain in Mesopotamia?
Logan Beaver · June 11, 2026
I am building a strategy game with a materialist core. Each city produces grain in the Private market and Temple/Crown estates at harvest time. The supply trickles down through consumption and waste, which leads to some interesting economic strategies. In this blog post we will explore how the pricing mechanism leads to a behavior bifurcation, and how that can affect the balance of power both internally and externally.
Let’s call the price of grain $x,$ in units of annual consumption per capita. This means one laborer will consume one unit of grain every year. I compute the price of any good using a symmetric hyperbola of supply $s$ and demand $d,$
where $b$ is the base price (in this case, $1$ unit of silver buys one year of grain), and $d$ is the current demand. Now, if supply equals demand, we recover the base price; as the supply increases (decreases) the price goes down (up).
Computing Grain Price
Grain is a unique resource, because it’s produced all at once (i.e., during harvest) and consumed slowly. So we don’t just want enough grain now, we need the stores to last until the end of the year. Commodities are processed in “ticks” throughout the year, so we can compute the demand as a function of the current tick $t,$
Here $n$ is the population, which consumes 1 grain per year each, $T-t$ is the number of ticks remaining before harvest, and $T$ is the total number of ticks in a year. So after harvest ($t=0$) we need enough grain to feed everyone, and just before harvest ($t=T-1$) the demand signal drops to almost zero.
Supply is consumed evenly over $T$ ticks by the population, plus some monthly losses due to spoilage, etc. For each tick, the forecasted supply is,
where $q(t)$ is the current quantity and $\alpha$ captures 1% loss per monthI compute losses monthly instead of per-tick, but this still captures the behavior on average.. We can substitute all of these terms into our price formula to compute the price of grain (where $b=1$) at each tick,
This gives us the price for $q(t),$ the quantity at the current tick. This is everything we need to compute live market prices!
A Price vs Time Curve
If we want a price curve over time, we need the dynamics of $q(t).$ From tick $t_{k}$ to the next at $t_{k+1}$, exactly $\frac{n}{T}$ grain is consumed,
We can identify the fixed point of this system by substituting a constant $q,$
Because of the problem structure, $q(t)$ exponentially decays from an initial value $q_0$ at harvest to the fixed point $-K,$
Notice that plugging in $t=0$ recovers $q(t=0)=q_0$ and letting $t\to\infty$ gives $q(t\to\infty) = -K,$ as we expect.
Finally, we can compute some useful price quantities. The final value of $q$ is,
The forecasted supply becomes,
Finally, the grain price curve is,
We want $q(t)$ to be well-behaved, so in-game I saturate it at a minimum of zero. I also saturate $x(t)$ at a maximum price, so that the price is never actually infinity; this would cause problems downstream. This is exactly the curve in the interactive price calculator at the top of the postThis isn’t necessarily the market price, it’s what a royal scribe or treasurer would record. This fits directly into the Three Estates economic model..
Price Regimes
The price model is simple, and we never need to compute it in the game. So why derive it? It turns out the curve has some interesting dynamics that the player can exploit.
To identify the regimes, we will take a time derivative to see if prices go up or down. We can compute the time derivative $\dot{x}$ with the chain rule,
where $\dot{d} = -\frac{n}{T},$ and $\dot{s} = K\ln(\alpha)\alpha^{T-t}.$ This simplifies to,
We want to compute when $\dot{x} = 0,$ where the price of grain is constant, so we can understand when it will rise or fall. This can only happen when the numerator is zero,
Rearranging yields,
For $\alpha \approx 1,$ the logarithm goes to zero and $\alpha^{T-t} \approx 1$. This yields the condition,
So, when $s(T) = 0$ the price is approximately constant. Note that it will still increase, since spoilage will decrease supply throughout the year.
This also means that when $s(T) < 0,$ we get a strictly positive $\dot{x}$, and we expect prices to increase at every tick. In a bad harvest, the prices start high and continue to climb as more grain is consumed.
Conversely, if $s(T) > 0,$ we expect a strictly negative $\dot{x}$ as supply eclipses demand all year. Grain prices start low, and they continue to fall as we approach the next harvest, which will add even more grain to the market.
We will look at how these two regimes can drive trade between grain-rich and grain-poor cities in a future devlog.
So what?
As the Crown, the player can allocate labor to growing crops, among other duties. This gives them some level of control over $s(T)$ through the harvest, via
where $\alpha$ and $K$ are known quantities. This determines how grain prices play out each year. Many strategy games encourage the player to achieve $s(T) \gt \gt 0$: produce excess grain, keep the population fed, and export excess grain for silver. Kārum is a game built inside an economic engine, so suppressing grain prices can have unexpected consequences.
Each city in Kārum is split into the Three Estates: the Crown, controlled by the player, alongside the Temple and the Private market. All three can produce grain (and other commodities). The Temple is a self-sustaining economic agent with a duty to stabilize grain prices. If the player grants modest farmland to the Private market (a future devlog topic), they can keep grain levels near $s(T)=0$ automatically. This also means the Temple will buy low on good years, sell high on bad years, and accumulate silver. The Temple’s growing wealth could easily eclipse the Crown!
On the other hand, the player may significantly over-allocate farm labor to the Private market, dropping the price of grain. This will drain the Temple’s silver as it buys up cheap grain to stabilize the price. This also incentivizes nearby cities to buy up the grain for export, freeing their own labor pools for growth, manufacturing, and warfare. This creates a real risk of external economic domination, where a city with cheap grain becomes over-reliant on exports and develops into an agrarian backwater.
There is a third option, which will be the topic of the next devlog. Allocate very little Private farm labor and spike the grain demand beyond what the Temple can provide. This will require both the Private market and Temple to purchase grain from the Crown, accumulating all of their silver in your pocket.