07 — Tuning guide: recipes, testing, and event scripts¶
This chapter collects the common balance changes and shows the smallest correct way to make each one. All examples are written as mod files that load the previous version and modify it (00 §3).
1. Workflow¶
- Create
MODS/<YourMod>/info.txtwithICBM MOD "Your mod". - For each game file you change, create the same path in your mod and start it with
USE PREVIOUS "<same path>". - Change existing entries with
MODIFY; create new ones with a new ID (orCOPYfor units, missiles and radars). - Use the Cheats build (
ICBM_CHEATS.exe) for testing: the game reads the units, weapons, sensors, explosions, technologies, ladders and AI files at loading and names the file and line of a mistake (00 §9, 08 §2 for the AI files). - Start a skirmish: an "unknown keyword" error means a typo stopped the file (see 00). Warnings go to
Fatal.txtin Documents/My Games/ICBM-Escalation, so read it too. Then check your changes in game. - Test with the Cheats build: Shift + T researches the queued technologies at once, Ctrl + click in the production panel builds a unit instantly, Shift + 0 … 9 switches faction.
- Multiplayer: every player needs the identical mod set; the game compares CRCs of the loaded data.
// MODS/Tougher Destroyers/info.txt
ICBM MOD "Tougher Destroyers"
// MODS/Tougher Destroyers/Units/Units.txt
USE PREVIOUS "Units/Units.txt"
[UNIT] "Destroyer" MODIFY
Power 14
2. Recipes¶
Make a unit tougher or cheaper¶
USE PREVIOUS "Units/Units.txt"
[UNIT] "Destroyer" MODIFY
Power 12 // hit points
ProductionCost 7
Remember that AutoRepair speed is inversely proportional to ProductionCost, so a cheaper unit also
repairs faster.
Change a weapon's range only after research¶
USE PREVIOUS "Units/Missile_defs.txt"
[MISSILE] "SAM" MODIFY
delete ImprovedBy "SAM_Mk2" // drop the old upgrade…
ImprovedBy "SAM_Mk2" Set Range 450 // …and give a new one
delete ImprovedBy "tech" removes every line of that tech on this weapon, whatever its property, so write again
the ones you want to keep. For a chain of upgrades use Set in increasing order; later known techs are applied
later and win. A multiplier written before a Set is lost (06 §9).
Make nukes more or less deadly for cities¶
Edit the explosion, not the missile:
USE PREVIOUS "Units/explosion.txt"
[EXPLOSION] "nuke_100" MODIFY
FullEffectRange 7 // was 10: full-effect area −51 %
Range 45 // was 60
Casualties scale with the covered area (radius²) and only slowly with Damage (see
03 §3). MinCasualties adds a flat number per city hit. To cut a city's
deaths by a stated share, give the missile a Casualties modifier.
Make a missile harder to intercept¶
USE PREVIOUS "Units/Missile_defs.txt"
[MISSILE] "ICBM (1M Light)" MODIFY
CanBeIntercepted 0.25 // chance that an interceptor hit counts
Power 2 // needs two counted hits of a Damage-1 interceptor
FakeHeads n "decoy" and higher Speed also help. DisableCanBeIntercepted rules out whole classes of
interceptors. The opposite knobs on the defence side are the interceptor's explosion Damage, Launch per salvo
and the global MinMissilesPerTarget/MaxMissilesPerTarget. CanBeIntercepted counts only against weapons with
MissileHitModel Interception: a nuclear ABM bursts on the missile and is judged by its blast
(03 §4).
Make a unit stealthier against radar¶
// in Units/Units.txt of the mod
USE PREVIOUS "Units/Units.txt"
[UNIT] "Bomber" MODIFY
Modifier "Bomber_Stealth_Bonus_Modifier_1" value 0.6 // tag the unit type (tag = a tech ID)
// in Units/Radars.txt of the mod
USE PREVIOUS "Units/Radars.txt"
[RADAR] "STD Long Wave" MODIFY
delete AffectedBy Unit "Bomber_Stealth_Bonus_Modifier_1" // the shipped line, Range 0.55
AffectedBy Unit "Bomber_Stealth_Bonus_Modifier_1" Range value // range × 0.6 against tagged units
Repeat the radar part for every radar that should react. The effect is active only while the unit's owner knows
the tech Bomber_Stealth_Bonus_Modifier_1.
A buff aura (e.g. faster reload near a command post)¶
[MISSILE] "Command_Aura" // Units/Missile_defs.txt (new, illustrative)
Tech "M_Command_Aura"
Type "No Attack"
RequiresPreciseTargeting No
Icon "Units/Images/Missiles/Buff.png"
Explosion "No_Explosion"
Range 150 // aura radius
Speed 1
Hidden Yes
HideRange No
Switchable ON
CanBeLimited false
[UNIT] "Command_Post" MODIFY // Units/Units.txt (illustrative unit, without weapons so far)
Weapon "Command_Aura" 1 // the aura works while the weapon is switched on
[UNIT] "Army_Division" MODIFY
ImprovedBy InRange "Command_Aura" Modify Weapon "Land Forces" Time 0.8 // 20 % faster reload
A unit that already has a default config takes no bare Weapon line: write delete Config "name" and the whole
config again (00 §4). At most 32 aura weapons work in
the whole game; one more stops the loading.
A lasting debuff (EMP-style)¶
[EXPLOSION] "My_EMP" // explosion.txt
Damage 0
Range 80
FullEffectRange 80
LastingEffect 3600 StringID 1908 // 120 "seconds"
TriggerResponse No
[UNIT] "VirtualCity" MODIFY // Units.txt
AffectedBy Explosion "My_EMP" Production 0.5
Faction-specific unit¶
[TECHNOLOGY] "U_My_Unit" // tech.txt
Name "U_MY_UNIT_NAME"
Description "U_MY_UNIT_DESC"
Parent "Your_Research_Tech" // the research tech that unlocks it
Parent "PREFIX_NA" HideLink // only factions using the NA model set
Make a weapon count as inhumane in diplomacy¶
Mark its explosion, not the missile (03 §1.6):
USE PREVIOUS "Units/explosion.txt"
[EXPLOSION] "nuke_500" MODIFY
Inhumane 1 // every weapon with this explosion: an atrocity of weight 1 per use, in Conquest
Inhumane 0 on a biological explosion takes the default 2 away. The other factions' answer (mood, protests, sanctions)
is described in 20 — Diplomacy. Every weapon that carries the explosion is affected; to mark one
weapon alone, give it an explosion of its own.
Give a faction's ships names¶
// Lang/Eng/namebank.txt of the mod
USE PREVIOUS "Lang/Eng/namebank.txt"
Unit "Destroyer" "Cruiser"
Prefix "EU"
Names
"Daring" "Dauntless" "Diamond" "Dragon" "Defender" "Duncan"
Each new destroyer or cruiser of a faction with the EU prefix takes a free name from the list
(01 §11.1).
Move a unit in the tech tree¶
Change which research tech has its zero-cost unit tech as a child:
[TECHNOLOGY] "Old_Parent" MODIFY
delete LeadsTo "U_My_Unit"
[TECHNOLOGY] "New_Parent" MODIFY
LeadsTo "U_My_Unit"
If the link is written on the child's side, use delete Parent "Old_Parent" there. Check the spelling: a name that
exists nowhere is ignored, and a zero-cost tech with no parent left is known from the first tick.
Tune a hit chance and check it with a duel¶
1. Find the keyword. A weapon's HitModel (02 §3) decides what its
accuracy value means:
HitModel |
Keyword | Meaning |
|---|---|---|
Deviation |
HitSpread |
The shot lands evenly between 0 and this many km off. |
Chance (a beam) |
HitChance |
The chance to hit, 0–1. |
GuaranteedHit |
Precision |
Used only for a strike at a map point: against a unit the value changes nothing. |
HitSpread and HitChance are one value, so the wrong one for a weapon is written to Fatal.txt at loading. Technologies
never change the HitModel. A weapon whose shots always hit takes HitModel Deviation after its Type line first.
USE PREVIOUS "Units/Missile_defs.txt"
[MISSILE] "Torpedo" MODIFY
HitSpread 1.5 // the base value
ImprovedBy "Improved_Underwater_Weapons" HitSpread 0.8 // this upgrade multiplies it
2. Calculate one shot. With target Size S, explosion Range R, FullEffectRange F, Damage D and
HitSpread H, all after modifiers, while H is at least S + R:
chance of any damage = (S + R) / H
chance of full damage = (S + F) / H
mean damage of one shot = D × (S + F + (R − F) / 3) / H
An explosion with a Range above 1 km hits aircraft and submarines at sea less: divide F and (R − F) by 2 and
by 1.5 (03 §2). A multiplier of 2 on HitSpread, from a jammer for instance, halves
the mean damage of a small blast. With a blast much bigger than HitSpread every shot hits, and accuracy upgrades
change nothing.
3. Calculate the duel. Power ÷ mean damage is the number of shots to kill. A salvo is Launch shots, the
next comes 2 × Time ticks later, and a shot flies Speed × 0.0025 km per tick. The averages hide how the fight
ends, so play it many times. This runs on its own, for two equal units firing at each other from the start:
import random
HITSPREAD = 1.0 # km, with the modifiers that apply
SIZE, POWER = 0.2, 5.0 # the target
DAMAGE, F, R = 4.0, 0.025, 0.1 # Damage, FullEffectRange, Range of the explosion
LAUNCH, TIME = 2, 150 # the Weapon line
SPEED, DIST = 100, 200 # the weapon's Speed, the firing distance in km
WIRE = True # SurvivesLauncher No
def shot():
d = random.random() * HITSPREAD - SIZE
if d <= F: return DAMAGE
if d <= R: return DAMAGE * (1 - (d - F) / (R - F)) ** 2
return 0
def duel():
power, dead = [POWER, POWER], [1e9, 1e9] # dead: the tick each side dies
for salvo in range(10000):
fired = salvo * 2 * TIME
arrive = fired + DIST / (SPEED * 0.0025)
shooters = [s for s in (0, 1) if dead[0] > fired and dead[1] > fired] * LAUNCH
if not shooters: break
random.shuffle(shooters)
for s in shooters:
if WIRE and dead[s] < 1e9: continue # the launcher is dead: the shot is lost
if dead[1 - s] == 1e9:
power[1 - s] -= shot()
if power[1 - s] <= 0: dead[1 - s] = arrive
return dead
runs = [duel() for _ in range(20000)]
both = sum(max(r) < 1e9 for r in runs) / len(runs)
tick = sum(min(r) for r in runs) / len(runs)
print(f"both die {both:.0%}, the first dies at tick {tick:.0f}")
These values give a mean damage of 1, so 5 shots to kill, with 800 ticks of flight:
HitSpread |
SurvivesLauncher |
Both die | First death at tick |
|---|---|---|---|
| 1 | Yes (WIRE = False) |
61 % | 1350 |
| 1 | No | 0 % | 1350 |
| 2 | Yes | 33 % | 2065 |
| 2 | No | 0 % | 2065 |
Read the mechanism behind the numbers. Three salvos are in the water before the first hit lands, so without the wire rule the loser's shots still sink the winner. More deviation lengthens the fight and does not change who wins between equals.
4. Check what the calculation leaves out. It knows nothing of detection: a unit whose sensor range is shorter than its attacker's firing range loses without seeing it, whatever the accuracy. It also leaves out the modifiers on either side unless you put them in the values. Then place the two units in the Cheats build (Ctrl while deploying places a unit anywhere) and watch several fights.
Add a jamming ladder¶
The shipped game jams radars only. This recipe makes guided weapons miss more often at what stands under an EW unit's aura, less so as the attacker researches countermeasures. A ladder compares the two research lines level by level (06 §5.1):
// Ladders.txt of the mod
USE PREVIOUS "Ladders.txt"
[LADDER] "My_Jamming"
Measure "Jammers" "Jammers_Mk2" "Jammers_Mk3" "Jammers_Mk4" // the target's side
Counter "Electronic_Counters_Mk1" "Electronic_Counters_Mk2" "Electronic_Counters_Mk3" "Electronic_Counters_Mk4"
Difference -2 Multiply 4 2 1.18 1 // counter − measure level: −2 or less, −1, 0, +1 or more
// Units/Missile_defs.txt of the mod
USE PREVIOUS "Units/Missile_defs.txt"
[MISSILE] "My Missile Jammer" // the aura
Tech "M_EW_Ground"
Type "No Attack"
Icon "Units/Images/Missiles/JAMMER.png"
Explosion "No_Explosion"
Range 150
Switchable ON
CanBeLimited false
[MISSILE] "AGM" MODIFY // one line per weapon to jam
AffectedBy TargetInRange "My Missile Jammer" Ladder "My_Jamming" HitSpread
// Units/Units.txt of the mod
USE PREVIOUS "Units/Units.txt"
[UNIT] "EW_MOBILE" MODIFY
delete Config "default"
Config "default" Default
Weapon "EW Jammer" 1
Weapon "My Missile Jammer" 1
- The unit's configs. A
MODIFYcannot add a weapon to a config it has: writedelete Config "name"and the whole config again, with every weapon it had (look them up inUnits/Units.txt); do it for each config that should jam. - Which weapons. Only those with
HitModel Deviation.GuaranteedHitshots do not deviate at a unit, and shots at missiles and strikes at a map point are never jammed. A beam takesHitChanceand multipliers below 1. - What is rolled when. A ballistic missile's deviation is rolled at launch, so the target's cover at launch counts; a guided missile's at impact; a direct-fire shot's when fired.
- It stacks with the target's own
AffectedBy Unit "ECM_Bonus_…"of the shipped guided weapons. - The aura works only while switched on, and it counts towards the limit of 32.
- Errors that stop the game: a modifier naming an undefined ladder, and a research name in any ladder that the mode's
tech.txtlacks (Technology not found). - Blitz reads none of these files of the mod: it has its own
Ladders.txt,Units/Missiles.txtandUnits/Units.txt.
Units/EW_Jamming.txt in the game folder holds such lines for 18 guided weapons, commented out, ready to copy.
Check the result with the duel above, multiplying HITSPREAD, then in the Cheats build. The weapon's Explodopedia page
shows the ladder row by row.
Add a weapon or unit so that every game mode still loads¶
Follow the checklist for a new weapon or a new unit, then look at the modes (12 §8):
| Mode | What it reads | Result |
|---|---|---|
| Standoff, Conquest, Campaign | The base files and your mod, with the mode's changes on top | The new object exists. |
| Blitz | Its own Tech.txt, TechLevels.txt, ProductionEfficiency.txt, Ladders.txt, Units/Units.txt, Units/Missiles.txt, Units/Radars.txt, Units/explosion.txt and AI files; your versions of these are not read |
The new object does not exist. |
So:
- Anything else of your mod that names the object is still read in Blitz and stops the game there (Technology not found, Unit Type not found). This goes for every file Blitz does not ship, a map's starting setup and scripts among them. In a definition file, wrap such entries:
IF NOT "BLITZ"
// entries that name the new tech, unit or weapon
ENDIF
- To have the object in Blitz too, ship a complete copy of
GameMode/Blitz/with the object in its files. The copy must keep every file of the original. Without itsLadders.txt, for instance, the game folder's file is read, and it names research Blitz does not have. - A mode's own file wins over your mod. A new line in a file a mode ships does nothing in that mode unless the mode's
file reads yours with
USE PREVIOUS, as Standoff's and Conquest's do. - Test every mode: start a skirmish in Blitz, Standoff and Conquest, then look for a multiplayer game. The game loads all three modes at that point, so a mode that fails stops a player who never plays it.
Change a unit so the AI still builds it¶
The AI builds groups from AI/GroupsConquest.txt, not single units, and weighs them through roles
(08 §1). Check these after changing a unit:
| Change | What goes wrong | What to do |
|---|---|---|
| Renamed or removed the unit | Groups and roles still name it: Unit Type not found stops the game. | Keep the ID, or change it in SupportTypes.txt, NuclearTypes.txt, SpaceTypes.txt, GroupsConquest.txt and Conditional.txt. IDs are case-sensitive there. |
Moved its tech behind a faction (PREFIX_XX, S_FACTION_ID_n, BlockedBy) or BLOCKER |
Group leaders' techs join the research lists as Critical, and a disabled Critical tech makes the whole strategy unavailable (08 §8.3). |
Give the group alternatives: "My_Unit" then "Old_Unit" leader. The first the faction can build is used; the last one's tech is researched automatically, so put the earliest last. |
Gave it a DisablingTech |
The unit disappears when the tech is known, and a group naming only it can no longer be built. | List the newer unit as an alternative, as above. |
| Changed its weapons | Unless the role has points, a unit's score in it is its damage per second against the role's compare unit (08 §3). If it can no longer hurt that unit, it counts for nothing. |
Check the compare of each role that lists it, or move it to another role. |
| Changed a weapon's cost or hint | A config's score falls with its cost against the target's, and AIHint 0 means never useful (02 §7). |
Keep the hints close to the shipped scale. |
Changed its Type, range or mobility |
The group's PlacementType, DistanceFrom and the role flags (NavalSupport, AntiAir …) were written for the old unit (08 §7). |
Review the groups that use it. |
| Gave a launcher another missile | The AI keeps reloads in stock only by its group's extra missile N (or N to M: more as a nuclear war grows likely). |
Check the group's line (08 §7.3). |
| Added a new unit | It is invisible to the AI until a role and a group name it. | See the recipe in 08. |
A group line that names a new unit with the old one as its alternative (in a copy of AI/GroupsConquest.txt, inside
the group that used the old one):
"My_Airport" then "Airport" Leader
Start a skirmish with AI factions in the Cheats build, read any message and Fatal.txt, and switch to one with
Shift + 0 … 9 to see what it has built and is researching. The faction you leave is taken over by the computer, so you
can switch back and forth. Blitz has its own AI files and is not affected by changes to these.
Add a technology the AI researches¶
// tech.txt of the mod
USE PREVIOUS "tech.txt"
[TECHNOLOGY] "Reactive_Armour_Mk2"
Name "Reactive_Armour_Mk2_NAME"
Description "Reactive_Armour_Mk2_DESC"
Image "Images/Science/Reactive_Armour_Mk2.png"
Points 60
TechLevel 4
Parent "Army_Mech_Mk2"
Type "Ground Forces"
// TechLevels.txt of the mod: without this the research does not raise the tech level
USE PREVIOUS "TechLevels.txt"
tech "Reactive_Armour_Mk2" Add 0.12 // Points ÷ 500, the shipped scale
// AI/Default/TechInvasion.txt of the mod
USE PREVIOUS "AI/Default/TechInvasion.txt"
InvasionTechList
"Reactive_Armour_Mk2" Target
The strings go into lang/<Language>/tech_t.lng of every language you ship
(12 §5). Without them the ID is shown.
- Every strategy has its own lists.
AI/Default/,AI/Airforce/andAI/Submarines/each haveTechInvasion.txt,TechNuclear.txtandTechMinCities.txt; all three useAI/Default/TechDomestic.txt. Add the tech to each strategy that should research it, or useDomesticTechListfor all of them. - Tags (08 §8.2): none = optional,
Target= preferred,MinRequired= first. Parents are researched automatically, so list only what you want. Criticalmakes the strategy unavailable where the tech is disabled, so leave it off faction-specific techs.- The level matters. The AI takes candidates at or below its current tech level first, so a tech with a high
TechLevelwaits. A tech it cannot reach is skipped without a message:CanBeResearched No, a disabled parent, a timer (AvailableFrom). - A tech name missing from
tech.txtstops the game (Technology not found). - Research as a reaction to what an enemy does goes into
AI/Conditional.txt(08 §10), and applies to every strategy. - A unit or weapon behind the tech still needs a group, as in the recipe above; a leader's tech joins the lists by itself (08 §8.3).
Global knobs¶
| Want | Where | Setting |
|---|---|---|
| All units faster/slower | Units.txt |
GlobalSpeedModifier 1.2 |
| All missiles faster/slower | Missile_defs.txt |
GlobalSpeedModifier 1.2 |
| All reloads slower | Units.txt |
GlobalMissileLaunchDelayModifier 1.5 |
| All aircraft launch slower | Units.txt |
GlobalAircraftLaunchDelayModifier 1.5 |
| Cities easier to hit | Units.txt |
GlobalCitySizeModifier 1.2 |
| City capture time | Units.txt |
CityOccupationMultPerPercent, Min/MaxTimeToOccupyCity |
| Less pollution | explosion.txt |
PollutionMultiplier 0.25 |
| Research cost per level | TechLevels.txt |
NextLevelMultiplier 1.3 |
// Units/Units.txt of the mod
USE PREVIOUS "Units/Units.txt"
GlobalSpeedModifier 1.2
GlobalMissileLaunchDelayModifier 1.5
3. Event scripts and unit definitions¶
Mission event scripts (chapters 15–18) cannot change the numbers in these files, but they use the same names. The robust pattern is: put the balance change in the data files behind a technology, and let the script grant the technology.
- Technologies:
GRANT_TECHalso grants unknown parents and throws noResearchedevent. It works forCanBeResearched Notechs, never for techs parented toBLOCKER. Scripts react withON ResearchedandON Tech_Available. - Units:
Build,CREATE_UNITandSELECT … TYPEtake[UNIT]IDs, so renaming a unit breaks the scripts that name it. - Weapons:
Enable / Disable Missilesreads the explosion types and the Geneva and AI categories, and category bans affect only weapons withCanBeLimited Yes.Weapon_UseoverridesAutoEngagefor one unit, andWeapon_SwitchturnsSwitchableweapons on and off. - Values: the script functions read weapon and unit values after tech modifiers (17).
Example — a scenario reward that unlocks a hidden upgrade (the tech has Points 100 and
CanBeResearched No in tech.txt; its effect is ImprovedBy "Scenario_Railgun_Bonus" Range 1.25 on the
railgun):
BLOCK GrantRailgunBonus()
GRANT_TECH(SelfID, "Scenario_Railgun_Bonus")
Message "Railgun range increased" Position TopLeft
END
FOR BOTH
ON Mission "Secure the lab" SUCCESS GrantRailgunBonus()
END
(Mission "…" must match a mission declared for the map, see 11 §4.)
4. Before you publish¶
- The game starts without "unknown keyword" errors, and
Fatal.txtshows no new warnings. - It loads in every game mode: a skirmish in Blitz, Standoff and Conquest, and the multiplayer game list.
- Every new object has a
TechwithName/Descriptionstrings in every language file you ship. - New weapons are in some unit's config, new units are buildable (
CanBeBuilt, class, tech reachable), new aircraft are hosted somewhere. - New research techs have an
Addline inTechLevels.txtand a place in the AI's research lists; new units have a role and a group. IFmarkers wrap whole entries.- You used
MODIFY+USE PREVIOUSwherever possible, so your mod combines with others.