Construction
How a game builds a structure or unit over time and charges for it.
On this page
Construction is the clock and the bill for a new structure or unit. In Dune II a builder pays a share of the cost on each tick of progress, so a build pauses when its owner runs out of credits1. A computer house builds slower in early missions2, and its construction yard builds only the structures it has lost3.
- Pay as builtDune II (1992). A builder pays cost ÷ build time each structure tick and waits when the money runs out; the computer builds slower early and only rebuilds what it lost.1,2,3Command & Conquer (1995). A factory pays in 108 installments over a time set by the item's cost and the house's power; a human player's extra factories speed it up.4
Games
| Game | Year | How | Note |
|---|---|---|---|
| Factorio | 2016 | construction robots build the ghosts a blueprint lays down, and rebuild what is destroyed | |
| Dune II | 1992 | Pay as built | a builder pays cost ÷ build time each structure tick and waits when the money runs out; the computer builds slower early and only rebuilds what it lost |
| Command & Conquer | 1995 | Pay as built | a factory pays in 108 installments over a time set by the item's cost and the house's power; a human player's extra factories speed it up |
| Infiniminer | 2009 | Pay up front | a block's whole price in ore leaves the builder's pocket the moment it's placed |
Every claim about this mechanic, by game (11)
References
- ^ abA factory or construction yard counts a build down from 256 × the item's build time. On each structure tick, every 30 game-timer ticks at normal game speed, a builder at full health takes 256 off the count (less for a computer house; dune2/ai-build-speed) and pays the build cost ÷ build time, carrying fractions of a credit in 1/256ths; a damaged builder takes off and pays only its share of full health (hit points × 256 ÷ maximum) each tick. When its owner can't pay a tick's share, the build waits, and a player's build goes on hold with a message. Computed: at full health an item takes its build time in structure ticks and costs about its build cost, which OpenDUNE's 60 Hz game timer makes half a second per unit of build time at normal speed.CodeOpenDUNE
How we know
1665 s->countDown = oi->buildTime << 8;src/structure.c line 1665 at ebea79a · upstream ↗ 68 s_tickStructureStructure = g_timerGame + Tools_AdjustToGameSpeed(30, 15, 60, true);src/structure.c lines 66–69 at ebea79a · upstream ↗ 175 if (!s->o.flags.s.onHold && s->countDown != 0 && s->o.linkedID != 0xFF && s->state == STRUCTURE_STATE_BUSY && si->o.flags.factory) {src/structure.c line 175 at ebea79a · upstream ↗ 188 buildSpeed = 256; 189 if (s->o.hitpoints < si->o.hitpoints) { 190 buildSpeed = s->o.hitpoints * 256 / si->o.hitpoints; ⋮ 198 buildCost = oi->buildCredits * 256 / oi->buildTime; ⋮ 201 buildCost = buildSpeed * buildCost / 256; ⋮ 208 buildCost += s->buildCostRemainder; ⋮ 210 if (buildCost / 256 <= h->credits) { 211 s->buildCostRemainder = buildCost & 0xFF; 212 h->credits -= buildCost / 256; ⋮ 215 s->countDown -= buildSpeed;
src/structure.c lines 188–215 at ebea79a · upstream ↗ 265 /* Out of money means the building gets put on hold */ 266 if (s->o.houseID == g_playerHouseID) { 267 s->o.flags.s.onHold = true;
src/structure.c lines 264–269 at ebea79a · upstream ↗ 1168 Timer_Add(Timer_Tick, 1000000 / 60, false);src/opendune.c line 1168 at ebea79a · upstream ↗ 364 if ((s_timersActive & TIMER_GAME) != 0) g_timerGame++;src/timer.c line 364 at ebea79a · upstream ↗ Checked against the evidence by its author, an AI model, 2026-10-22.
Checked by a second AI model, 2026-10-22.
- ^ abA computer house builds at no more than (20 × mission index + 95)/256 of full speed, where the first mission is index 0, and pays per tick in the same proportion. Computed: 95/256, about 37%, in the first mission, rising to 255/256 in the ninth.CodeOpenDUNE
How we know
193 /* For AIs, we slow down building speed in all but the last campaign */ 194 if (g_playerHouseID != s->o.houseID) { 195 if (buildSpeed > g_campaignID * 20 + 95) buildSpeed = g_campaignID * 20 + 95; ⋮ 201 buildCost = buildSpeed * buildCost / 256;
src/structure.c lines 193–202 at ebea79a · upstream ↗ 295 g_campaignID++;src/opendune.c lines 288–295 at ebea79a · upstream ↗ 931 g_campaignID = 0;src/opendune.c line 931 at ebea79a · upstream ↗ Checked against the evidence by its author, an AI model, 2026-10-22.
Checked by a second AI model, 2026-10-22.
- ^ abA computer house's construction yard builds only structures the house has lost. Removing a structure records its type and position in the first free of five slots per house; while the house's AI is active and it has credits, an idle yard builds the first recorded type it can build, places the finished structure at once at the recorded position, and clears the slot. If no slot matches or placement fails at every match, the house gets the cost back and the structure is dropped.CodeOpenDUNE
How we know
1338 for (i = 0; i < 5; i++) { 1339 if (h->ai_structureRebuild[i][0] != 0) continue; 1340 h->ai_structureRebuild[i][0] = s->o.type; 1341 h->ai_structureRebuild[i][1] = packed;
src/structure.c lines 1338–1342 at ebea79a · upstream ↗ 1993 if (s->o.type == STRUCTURE_CONSTRUCTION_YARD) { 1994 for (i = 0; i < 5; i++) { 1995 type = h->ai_structureRebuild[i][0];
src/structure.c lines 1993–2003 at ebea79a · upstream ↗ 308 /* AI maintenance on structures */ 309 if (h->flags.isAIActive && s->o.flags.s.allocated && s->o.houseID != g_playerHouseID && h->credits != 0) { ⋮ 316 if (si->o.flags.factory && s->countDown == 0 && s->o.linkedID == 0xFF) { 317 uint16 type = Structure_AI_PickNextToBuild(s);
src/structure.c lines 308–319 at ebea79a · upstream ↗ 240 /* The AI places structures which are operational immediately */ ⋮ 247 if (!Structure_Place(ns, h->ai_structureRebuild[i][1])) continue; ⋮ 254 /* If the AI no longer had in memory where to store the structure, free it and forget about it */ ⋮ 258 h->credits += nsi->o.buildCredits;
src/structure.c lines 240–261 at ebea79a · upstream ↗ Checked against the evidence by its author, an AI model, 2026-10-22.
Checked by a second AI model, 2026-10-22.
- ^In the remaster's code, a factory splits every build into 108 steps and pays in installments: each step costs the unpaid balance ÷ the steps left, and when the house can't pay it, the step is undone and the factory tries again at the next one. The build time in game ticks starts as the item's cost in credits, grows when the house's power fraction is below full (× 256/171), below half (× 256/103), or zero (× 4), and is divided by 108 into ticks per step (1 to 255). A human player's factory runs its step timer once per factory of that kind the house owns each tick; the code's comment says this acceleration "applies only to human players". Computed: for a human player's structure from one factory at full power, an item costing C credits takes 108 × ⌊C ÷ 108⌋ ticks, at least 108 and at most 27,540. Dune II also pays as it builds, but each tick costs cost ÷ build time, and a player's build goes on hold when the money runs out.CodeC&C Remastered source · OpenDUNE
How we know
97 STEP_COUNT=108 // Number of steps to break production down into.TIBERIANDAWN/FACTORY.H line 97 at f1f0d42 · upstream ↗ 238 ** Determine the acceleration factor for factory production. 239 ** This applies only to human players. The computer builds ⋮ 243 if (Object && House->IsHuman) { ⋮ 258 stages = House->BuildingFactories; ⋮ 261 stages = MAX(stages, 1);
TIBERIANDAWN/FACTORY.CPP lines 238–261 at f1f0d42 · upstream ↗ 265 for (int index = 0; index < stages; index++) { 266 if (!Has_Completed() && Graphic_Logic()) { ⋮ 269 int cost = Cost_Per_Tick(); ⋮ 279 if (cost > House->Available_Money()) { 280 Set_Stage(Fetch_Stage()-1); 281 } else { 282 House->Spend_Money(cost); 283 Balance -= cost;
TIBERIANDAWN/FACTORY.CPP lines 265–296 at f1f0d42 · upstream ↗ 724 int steps = STEP_COUNT - Fetch_Stage(); 725 if (steps) { 726 return(Balance / steps);
TIBERIANDAWN/FACTORY.CPP lines 720–728 at f1f0d42 · upstream ↗ 402 Balance = object.Cost_Of() * house.CostBias;TIBERIANDAWN/FACTORY.CPP line 402 at f1f0d42 · upstream ↗ 544 time = Object->Class_Of().Time_To_Build(House->Class->House); ⋮ 549 time /= STEP_COUNT; 550 time = Bound(time, 1, 255); ⋮ 552 Set_Rate(time);
TIBERIANDAWN/FACTORY.CPP lines 543–553 at f1f0d42 · upstream ↗ 296 int time = Raw_Cost(); ⋮ 334 int power = hptr->Power_Fraction(); 335 int inv_scale(256); 336 if (power == 0x000) { 337 inv_scale = 64; ⋮ 339 else if (power < 0x080) { 340 inv_scale = 103; ⋮ 342 else if (power < 0x0100) { 343 inv_scale = 171; ⋮ 345 time = (time * 256) / inv_scale;
TIBERIANDAWN/TECHNO.CPP lines 291–345 at f1f0d42 · upstream ↗ 72 if (Rate) { 73 StageTimer--; 74 if (!StageTimer) { 75 Stage++; 76 StageTimer = Rate;
TIBERIANDAWN/STAGE.H lines 71–77 at f1f0d42 · upstream ↗ 198 buildCost = oi->buildCredits * 256 / oi->buildTime; ⋮ 210 if (buildCost / 256 <= h->credits) {
src/structure.c lines 188–215 at ebea79a · upstream ↗ 265 /* Out of money means the building gets put on hold */ 266 if (s->o.houseID == g_playerHouseID) { 267 s->o.flags.s.onHold = true;
src/structure.c lines 264–269 at ebea79a · upstream ↗ Checked against the evidence by its author, an AI model, 2026-10-22.
Checked by a second AI model, 2026-10-22.
Sources
Code
- OpenDUNE contributors. 2026. “OpenDUNE: a C re-creation of Dune II from its DOS executable (OpenDUNE/OpenDUNE).” Commit ebea79a. OpenDUNE/OpenDUNE @ ebea79a · licence, all uses