Prototyping a trade loop in a weekend
Two hundred lines, a spreadsheet of prices, and the afternoon the economy stopped being a table of numbers.
Galaxy Trader started as one question I could not answer on paper: why would a player ever visit the second port? The first port can sell you fuel and buy your ore, and a game that stops there is a shop with a starfield painted behind it. Everything interesting depends on the second port wanting something different, and on the player being able to find that out before the fuel runs out.
So the first prototype was not a game. It was a strip of ports along one line, each with a price per good, and a ship with cargo space and a fuel tank. Two hundred lines, most of them data.
Prices as a function, not a table
The obvious version stores a price per good per port in a table and hand-tunes it. My first attempt did that and it broke the moment I moved a port: the numbers were balanced against distances that no longer existed. A port that produced ore was cheap ore only because I had written a small number next to it.
The second attempt derives the price from what the port does. Each port has a production and a consumption profile, an ideal stock level, and a stock that the simulation moves every tick. Price is a function of how far the stock is from ideal:
price = base * (1 + scarcity * (ideal - stock) / ideal)
That is not a clever economy. It is the smallest thing that responds to the player. Buy all the ore at Kepler and the stock drops, the price climbs, and the third haul that used to be profitable is not. The player never reads that formula; they feel it as “the run is getting worse” and they go looking for a different run.
The moment it became a game
For about three hours the prototype was a spreadsheet with thrusters. Then I added one rule — the price of a good drifts toward the port’s base price every tick, slowly, whether or not anyone trades — and the whole thing changed. Waiting became a decision. A route you skip today is a route that pays better in four minutes, and the ship costs you nothing while you sit there except the fuel you already spent.
I watched my own test run do something I had not programmed: it bought ore, waited at the port for the price of textiles to fall, and left. That is the only evidence I trust that a system has become a game. Not “the numbers are balanced” — the numbers are not balanced — but “the tester found a strategy I did not think of”.
What it cost
The prototype is a single script and a scene with five circles on it. What it does not have is any of the things I will need: saves, a route planner, a reason for the ports to be where they are.
I am keeping it anyway. Every economy I have built before this one was a table, and every one of them died when I tried to make it bigger. This one is a small set of rules with a stock value at its centre, which means the next thing I add is another rule, not another hundred numbers.
The route map is the placeholder cover for this post: the five ports and the prices the first pass actually used. It is already out of date, which is the point of keeping it.