A per-city economy calculator for Conflict of Nations: World War 3. Give it one city (its resource, population level, morale, buildings, whether it is occupied) and it tells you what that city makes per day and how that changes over the next days. A second mode looks up what any unit or building costs to make, to keep, and to research.
It runs on your computer from the files in this folder. No server, no account, no game login. Made by Tintin.
- City production per day for its resource (Supplies, Components, Rare materials, Fuel or Electronics), from base output, population level, morale, the buildings standing and the one under construction, and ownership (homeland, annexed, occupied).
- City money and manpower per day, with the Arms Industry flat money and the Recruiting Office manpower table.
- Morale drift and population growth, one step per day, so you see the city a week or two out.
- Provinces (population below 4): money and manpower at the province's own base tier, plus a resource for the few provinces that make one, with the captured factor.
- Money cities (resource 20) earn their tax plus their own money output, as the game shows it.
- Half-built and damaged buildings: the flat parts (Arms Industry money, Recruiting Office manpower) are paid in full at once, the percentage part follows progress; a building below its hit-point cap counts as under construction.
- Costs: mobilisation cost, upkeep per day, mobilisation hours and the research chain with its cost for any unit level; build time, cost and upkeep for any building level.
The city formulas reproduce the game's own numbers: 3,447 of 3,448 places exact on a live day-24
reading (production, tax and manpower together). docs/FORMULAS.md says which ones were measured and which were not.
You need Node.js version 22.18 or newer (node --version to check). Node
runs the TypeScript files directly, so there is nothing to install, compile or download.
npm run check # runs the self-checks; every line should start with "ok"
npm run example # runs examples/city-example.json and prints the city day by day
Your own city, and the cost lookup:
node examples/city.ts my-city.json
node examples/city.ts cost 2039 # a unit item id (data/unit-levels.json, item_id)
node examples/city.ts cost 152 3 # a unit line id (unit_id) at level 3
node examples/city.ts cost 2276 # a building level id (data/building-levels.json)
node examples/city.ts cost "Arms Industry" 2 # a building name at a level
examples/city-example.json:
{
"name": "Example city",
"resource": 1,
"poplv": 6.0,
"morale": 90,
"builds": ["AI3", "AF2", "RO1"],
"pending": [{ "tag": "AI4", "prog": 50 }],
"captured": false,
"annexed": false,
"days": 14
}| field | meaning |
|---|---|
resource |
what the place produces: 1 Supplies, 2 Components, 4 Rare materials, 5 Fuel, 6 Electronics, or 20 for a money city. Money and Manpower (3) are always computed. Leave it out for a province that makes nothing. |
base |
optional. The place's own base output before multipliers, as the game reports it: 1500, 3000 or 5000 (6000 in an Elite variant); independent of game speed. Default 3000. |
poplv |
population level, 1.0 to 10.0, as the city panel shows it. Below 4 the place is a province: money and manpower only. |
morale |
morale percent, 0 to 100. |
builds |
finished buildings as tag + level: AI Arms Industry, AF Air Base, NB Naval Base (shown level, the free harbour is NB1), LI Local Industry, RO Recruiting Office, HQ Headquarters, UB Underground Bunker, CO Combat Outpost, FH Field Hospital, HS Hospital. Only these affect the numbers; others are ignored. |
pending |
a level under construction, with prog percent done. Its percentage bonus climbs with progress; its flat money or manpower is paid in full at once. A damaged building counts the same way, with prog = HP / (5 x (level + 1)) x 100. |
captured |
true for any city outside your homeland (output x 0.25). |
annexed |
true when it is captured and you are its legal owner (output x 0.5 instead). |
atWarPenalty |
optional morale points taken off the morale target while at war. |
days |
how many days to project. Default 14. |
The projection assumes the buildings stay as given. Population growth and morale drift are applied once per day, like the game does.
docs/FORMULAS.md lists every formula this calculator knows, grouped economy first, then
research, build times, combat, movement, morale and manpower. Each entry carries the formula, its
inputs, which function implements it (if any), and an honest status:
- verified: reproduces numbers measured in a live game
- derived: read from the game's data files or derived on paper, not re-measured
- UNVERIFIED: wiki or hearsay. Do not trust these, and do not be surprised if they are wrong.
data/formulas.json holds the same entries machine-readable (id, name, expr, inputs,
status, verifiedBy, implementedIn). The expr field uses plain infix arithmetic; the
syntax field at the top of the file explains it. Entries about research, build times, combat and
movement are knowledge only: this package implements the city economy, not those.
If you find a formula that is wrong, or can verify one marked UNVERIFIED:
- Edit the entry in
data/formulas.jsonand the matching one indocs/FORMULAS.md. Change thestatusonly when you have measured it in a game, and write what you measured inverifiedBy. - If the code has to change too, the
implementedInfield names the file and function. The constants live at the top ofsrc/econexact.ts. - Run
npm run check. It fails if the JSON is broken, a status is not one of the three words, or animplementedInnames a function that does not exist. - Send back a diff (
git diffif you keep the folder in git, otherwise the changed files).
data/ holds the game's own rule tables, consolidated into flat JSON: units and their levels,
mobilisation times, costs and upkeep, buildings with build times, costs and upkeep, the research
tree with unlock days and costs, and the starting stock per scenario map. The economy formulas
in src/econexact.ts are the published ones with constants fitted against live games until the
model matched the game exactly.
Only the city economy is here. The full tool also plans builds and research over time, reads live games, keeps team plans and draws the map. None of that is in this package: no timeline or planner, no game or server access of any kind, no recorded games, no team plans, no map data, no user interface.
src/econexact.tsthe city economy: production, tax, manpower, morale, population, provincessrc/inventory.tsbuilds the cost lookups from the rule tablessrc/load.tsreadsdata/src/econexact.check.ts,src/formulas.check.tsself-checks, run bynpm run checkdocs/FORMULAS.md,data/formulas.jsonthe formula referenceexamples/city.ts,examples/city-example.jsonthe example above
Free to use, copy and change for anything Conflict of Nations related. Credit Tintin. No warranty.