Skip to content

Power output and drain

How a house's power output and drain are totaled, and what a house short of power loses.

Features & systemsUnits, buildings & economyBuildings & economy

Changed in 0.2.0

Each house keeps two totals: its output, the power its structures produce, and its drain, the power they consume. A house whose output is below its drain is short of power.

A house’s totals include every structure it owns that is placed on the map and not in limbo. A structure counts as soon as it is placed, so one still playing its buildup animation already adds both its output and its drain.

In a campaign game, a structure owned by a player-controlled house counts only after the player has discovered it. A base handed to the player by a trigger therefore adds nothing until the player sees it.

This example defines a power plant, a structure that consumes power, a plug for the plant, and the two [General] settings that govern a shortfall. The values are examples; the linked key pages give the defaults.

rules.ini
[MYPOWER] ; example power plant
Power=100
Upgrades=1 ; upgrade slots this structure offers
[MYSAM] ; example structure that consumes power
Power=-50
[MYTURBINE] ; example plug for MYPOWER's upgrade slot
PowersUpBuilding=MYPOWER
Power=50 ; added to the host's output before damage scaling
[General]
DamageDelay=2 ; game minutes between damage ticks while short of power
MinProductionSpeed=0.75 ; lowest production multiplier a shortfall can impose

A structure’s output is its type’s positive Power= plus the positive Power= of every plug installed in it. A plug is a structure type with PowersUpBuilding=, installed into one of the host’s upgrade slots. The sum is multiplied by the structure’s current strength as a fraction of its maximum and rounded down.

A structure’s drain is the size of its type’s negative Power=, plus the drain of its plugs. Damage does not change it.

The table shows what affects each total. A stun is an EM pulse disabling the structure for a set number of frames.

OutputDrain
Typepositive Power=size of a negative Power=
Plugsadded before scalingadded
Damagescales the total, rounded downignored
Switched offnothingnothing
Stunnedunchangedunchanged

Damage reduces output from the first point lost. A plant with Power=100 supplies 99 at 999 of 1000 strength, and nothing at 1 strength. Because drain does not fall with damage, a base under attack loses output while its demand holds steady, and it can become short of power.

Only switching a structure off removes it from both totals. An EM pulse does not switch a structure off, so a stunned plant keeps supplying power and a stunned consumer keeps drawing it.

A house recalculates both totals on its next update after any of these events:

  • one of its structures changes strength;
  • a structure finishes its buildup or is captured;
  • a structure is taken off the map or changes owner;
  • a plug is installed or sold;
  • a structure is switched on or off;
  • a human player discovers a structure.

After recalculating, the house:

  • starts or stops its structures’ power-dependent animations, lights, fences and cloaking fields to match the new balance;
  • recalculates the speed of its factories;
  • rechecks whether its radar should be up;
  • rechecks its superweapons, if the house has just become short of power or just stopped being short.

The power fraction is output divided by drain, capped at 1:

  • 1 when output is at least drain;
  • 1 when drain is 0, even with no output;
  • 0 when output is 0 and drain is above 0;
  • otherwise, output divided by drain.

A house is short of power exactly when its fraction is below 1.

Players enter power mode with Power Mode or the sidebar’s power button. The power cursor offers the toggle only over an object that passes all of these tests, in this order:

Even where the cursor offers it, a switch order for a FirestormWall=yes structure is refused.

A Turn off building trigger action or a scenario’s structure record can switch off any structure whose type has drain or is Powered=yes. They ignore TogglePower. A TogglePower=no structure switched off this way cannot be switched back on by the player.

A stunned structure cannot be switched on.

Switching a structure off:

  • removes it from both totals;
  • turns off its light source;
  • starts shrinking its cloaking field;
  • drops its laser fences;
  • stops its powered animations;
  • refuses units that try to dock with it, such as harvesters at a refinery or vehicles at a repair depot;
  • makes its house recheck what it can produce, if the structure is a factory;
  • discharges an active firestorm wall, if it was the house’s last switched-on GDIFirestormGenerator.

A player-controlled house hears an announcement when a structure is switched off or back on.

While a player-controlled house’s structure is switched off, a marker is drawn over it unless its cell is shrouded or fogged.

Each effect below applies to every house, computer houses included, unless noted.

A computer house that is not following a map plan also tries to avoid a shortfall. It builds a power plant before a structure that would leave it short; AI base planning covers that rule and the margin it keeps.

While a house is short of power, its structures that consume power take 1 point of damage every DamageDelay game minutes. The house’s timer runs whether or not the house is short, so the first tick lands anywhere up to DamageDelay minutes after a shortfall begins. A shortfall that ends before the next expiry costs no damage.

When the timer expires while the house is short, each structure that passes all of these tests takes 1 point of damage through C4Warhead:

  • the house owns it;
  • its strength is strictly above ConditionYellow of its maximum;
  • its type has drain.

The tick ignores the on/off switch. A switched-off structure still takes damage, although it no longer adds to the drain. The drain test reads the structure’s type only, so a structure whose drain comes entirely from its plugs is never damaged.

A shortfall wears a base down to ConditionYellow and stops there. With a 1-point tick, it destroys nothing. Raising MinDamage makes every tick larger, and a tick larger than a structure’s remaining strength destroys it.

A house short of power builds more slowly. Its build time is divided by a production multiplier that depends on its power fraction:

Power fractionProduction multiplier
11
0.75 up to but not including 10.75
0.5 up to but not including 0.75the fraction itself
below 0.50.5

If the multiplier is below MinProductionSpeed, it is raised to that value. A multiplier of 0.75 makes a build take a third longer, and 0.5 doubles it. The bottom row means a house with no output at all still builds at half speed or better.

The power division is one step in the build-time calculation. How long it takes gives the full order, including BuildSpeed, the country and difficulty BuildTime multipliers, MultipleFactory, and WallBuildSpeedCoefficient.

Every recalculation of the balance updates the speed of the house’s factories. A build in progress keeps the progress it has made and continues at the new speed, so low power slows it without restarting it, and restoring power speeds it up again. The delay between production steps cannot exceed 255 frames, so once a build reaches that limit a deeper shortfall slows it no further.

Low power never removes an option from the sidebar. It only slows production.

A Powered=yes structure that produces cash pauses its income while its house is short of power, even if it draws no power itself.

Only the local player’s house can lose its radar map. The radar is up while all of these hold:

  • no ion storm is running;
  • the house is not short of power;
  • Any of:
    • the scenario sets FreeRadar=yes;
    • the house owns a Radar=yes structure that is All of: switched on, out of limbo, on the map, and not being sold.

In a campaign game, a radar structure the player has not discovered does not count. A player who has been given the whole map keeps the radar whatever these tests say; observers and coach mode covers that rule.

A superweapon that comes from a structure is enabled while its house owns a switched-on structure that grants it, through the structure’s type or through a plug. A stunned structure still counts. The weapon is disabled whenever its house is short of power.

A disabled weapon is suspended only if its type is IsPowered=yes. Suspension stops the charge timer where it stands, replaces the status text on the sidebar cameo with a hold caption, and refuses the targeting cursor. The weapon resumes when it is enabled again.

A weapon that becomes available while its house is short of power arrives suspended, even when it is IsPowered=no. It resumes once power is restored.

A weapon granted by the Add repeating special weapon trigger action no longer needs a structure, so low power never suspends it.

Three separate tests decide whether low power stops a defense, and they treat TogglePower differently.

  1. Out of service. A structure is operational unless any of these holds:

    • it is switched off;
    • it is stunned;
    • its strength has reached zero;
    • All of: its type is Powered=yes, its type has drain, its type is TogglePower=yes, and its house is short of power.

    A structure that is not operational cannot fire. Spotlights, laser fences, sensor-array refreshes, cloak generators, and the choice of which EM pulse cannon fires use the same test.

  2. Weapons. An operational structure still cannot fire while its house is short of power if its type is Powered=yes and has drain. This test ignores TogglePower, so a Powered=yes, TogglePower=no defense stops firing even though it remains operational.

  3. SAM tracking. A SAM=yes launcher that is Powered=yes with drain stays in its ready state while its house is short of power, so it never turns toward its target.

The second test also stops a Charges=yes defense from starting a charge.

  • A CloakGenerator=yes structure that stops being operational shrinks its field ring by ring. It regrows the field the same way, out to CloakRadiusInCells, once it is operational again and, for a Powered=yes type, once its house is no longer short of power. A generator that stays operational, such as one left at Powered=no, keeps its field through any shortfall.
  • Laser fences are rechecked at every change to the balance. A fence run is up only while the posts at both ends are operational, so low power at either end drops the whole run.
  • A spotlight is neither drawn nor able to notice an intruder unless its structure is operational.
  • When a house is not short of power, every structure it owns runs its powered animations and powered lights, including a structure that is switched off. When the house is short, only a type that is Powered=yes, has drain, and is TogglePower=yes stops them.

The game announces low power while all of these hold:

  • the house is the local player’s;
  • the house’s announcement timer has expired;
  • the house is short of power;
  • it owns at least one structure of a BuildConst type, switched on or not.

The announcement plays the warning, shows its on-screen text for MessageDelay minutes, and restarts the timer with SpeakDelay minutes.

The height of the sidebar power bar grows with the size of the Power= rating of every structure the player owns, producers and consumers alike, leaving out plugs. A damaged or switched-off structure still adds its full rating to the height.

The bar’s colors follow the real totals. While the house is short of power, the whole bar is red. Otherwise, the drain shows red, the first 100 points of surplus show yellow, and any surplus beyond that shows green.

The Power Low trigger event holds while the named house is short of power.

The Turn off building and Turn on building actions use the same switch as the power cursor, for every structure on the map that carries the trigger’s tag. Turn off building affects only structures that are on, and Turn on building only those that are off.

The production ladder above is fixed in the engine. WorstLowPowerBuildRateCoefficient and BestLowPowerBuildRateCoefficient in [General] are read but never used. Changing either setting has no effect. The ladder’s fixed 0.75 step happens to equal the default of BestLowPowerBuildRateCoefficient.

26 of 26

KeyDescriptionValueWhen omitted
BuildSpeedglobal rulesThe multiplier that turns an object's cost into its base build time.floating point1
BuildTimeHouseType, difficulty settingsThe build-time multiplier a country applies to everything it produces, or the one a difficulty setting applies.floating pointVaries by type
C4Warheadglobal rulesThe warhead used for damage that no weapon deals, such as a demolition charge.classnone
CloakGeneratorBuildingTypeWhether the structure projects a cloaking field over the cells around it.booleanno
CloakRadiusInCellsBuildingTypeThe radius in cells of a cloak generator's field or a sensor array's coverage.integer20
ConditionYellowglobal rulesThe fraction of maximum strength at or below which an object counts as damaged.floating point.5
DamageDelayglobal rulesMinutes between the damage ticks a house takes while it is short of power.floating point1
FreeRadarscenariosWhether the scenario grants the radar map without a radar structure.booleanno
ImmuneNo effect in some scopes12 applicable typesExempts the type from every damage path that is not applied as forced.booleanVaries by type
IsPoweredSuperWeaponTypeWhether the superweapon stops charging while its house is short of power.booleanyes
LaserFencePostBuildingTypeWhether the structure anchors laser fence segments run out from it.booleanno
MessageDelayglobal rulesHow long most on-screen messages stay visible.floating point.6
MinDamageglobal rulesThe smallest damage a warhead may deal to a target close to the impact.integer1
MinProductionSpeedglobal rulesThe floor the low-power production multiplier is held to.floating point.5
MultipleFactoryglobal rulesThe build-time multiplier each factory past the first applies to production of its category.floating point1
PowerBuildingType, TiberiumPower a BuildingType contributes to its house, negative for consumption, or the damage a Tiberium type deals.integer0
PoweredBuildingTypeWhether the structure stops working while its house cannot meet its drain.booleanno
PowersUpBuildingBuildingTypeThe ObjectType ID of the structure this type plugs into as an upgrade.stringnone
PowersUpToLevelBuildingTypeHow many upgrade slots the plug consumes at once, or -1 for one slot in the next free position.integer-1
RadarBuildingTypeWhether the structure can supply the player's radar map.booleanno
SensorArrayBuildingTypeWhether the structure marks the cells around it as sensed, revealing cloaked objects standing there.booleanno
SpeakDelayglobal rulesMinutes an EVA announcement waits before it may be repeated.floating point2
TogglePowerBuildingTypeWhether the player may switch this structure on and off.booleanyes
UpgradesBuildingTypeHow many upgrade plugs the structure accepts.integer0
VersesWarheadTypeThe percentage of a weapon's damage the warhead delivers against each armor class, in armor order.string100%,100%,100%,100%,100%
WallBuildSpeedCoefficientglobal rulesThe multiplier applied to a wall's build time.floating point.5

History

  1. Changed0.2.0In development

    Keep charging defenses working through low power

  2. Changed0.2.0In development

    Watch a multiplayer match as an observer