Direct answer: what does a Nation actually do?
A Nation is not a fixed build order. After spawning, it combines attack, alliance, construction, Warship, ordinary nuke, and MIRV behaviors.
Difficulty changes action timing, target order, troop reserves, alliance rules, building scores, and special counters. Each Nation also receives a seeded deterministic pseudorandom stream.
You can influence its candidates through troops, relations, borders, structures, fleets, and incoming attacks. You cannot make it permanently friendly or predict one guaranteed next action.
The v0.33.7 source and tagged tests define candidate rules. They do not provide public match telemetry, player-skill controls, or a best-strategy tier list.
Nation, Bot, and Tribe are not the same
| Actor | What overlaps | What matters to the player |
|---|---|---|
| Nation | Uses shared AI attack utilities | Adds relationships, alliances, structures, fleets, nukes, MIRV, embargo, betrayal, and Nation-specific signals. |
| Ordinary Bot | Can share target and attack code | Does not run the full Nation diplomacy, construction, and nuclear behavior suite described here. |
| Tribe | Is another non-human map actor | Do not infer Nation alliances, build ratios, or nuclear choices from Tribe behavior. |
This distinction also changes exceptions. Some FFA reserve rules exclude ordinary Bots, and Team or Humans vs Nations can take separate branches.
The Nation decision loop
- Spawn: initialize a deterministic random stream from game ID and Nation ID, then draw individual thresholds.
- First expansion: immediately attack Terra Nullius once, then prefer adjacent non-fallout neutral land in later attack checks.
- Reserve check: normally stop regular attacks below the individual 30–39% reserve.
- Trigger check: normally choose active targets at 50–59% of maximum troops, with a 1/10 chance to continue below it.
- Priority queue: run the first target strategy that finds a valid candidate and completes an action.
- Parallel systems: diplomacy, structures, Warships, embargo, nuclear weapons, and signals run at their own points in the cycle.
Neutral expansion and reclaiming Bot land with structures use the lower 10–19% individual expansion reserve. This does not remove route, ownership, or target checks.
The random stream is deterministic for a game and Nation, but later draws depend on earlier calls. Similar visible positions do not guarantee identical actions.
Four difficulty levels
| Difficulty | Main action interval | General human attack gate | Defense and infrastructure |
|---|---|---|---|
| Easy | 65–99 ticks | 25% passes each general check | No responsive Defense Post, 0% rail scoring, no ship-event counter. |
| Medium | 55–69 ticks | 75% passes | 50% Defense Post gate, at most one per front; 60% rail scoring; 15% ship-counter build gate. |
| Hard | 45–59 ticks | No extra mercy gate | 75% FFA neighbor floor; 75% rail scoring; 50% ship-counter build gate. |
| Impossible | 30–49 ticks | No extra mercy gate | 90% FFA neighbor floor; 100% rail scoring; 80% ship-counter build gate. |
The Hard and Impossible troop floor protects against the strongest non-friendly, non-Bot neighbor in ordinary FFA. Team, Bots, and a Nation under attack use exceptions.
Easy can still attack humans. The 25% pass is one gate, not a per-turn attack probability, and retaliation, traitor, non-human, or Humans vs Nations paths differ.
How Nations choose attacks
The attack behavior scans actual land neighbors and nearby players. If valid neutral land exists, it tries expansion before normal enemy strategies.
With no adjacent enemy, there is a 1/5 chance to sample an island attack. With an adjacent enemy, there is a 1/10 chance to try an island route first.
A failed category does not force an attack. The queue continues until one strategy succeeds or no candidate remains.
| Target label | Code meaning | Player reading |
|---|---|---|
| Retaliation | Prioritize the largest incoming attacker | A superior army is not immunity if you are already sending troops. |
| Very weak | Target below 15% of its own maximum troops, with an FFA strength bound | A depleted bar can create a candidate before territory size changes. |
| Victim | Incoming troops exceed 50% of the target's current troops | A player already under heavy attack may attract another Nation. |
| Weakest | Lowest current troops among adjacent enemies | This is a local border comparison, not the weakest player worldwide. |
| Island | Choose among two nearest reachable candidates; 1/3 may pick the second | A continuous route matters, but the nearest coast is not guaranteed. |
Target order changes by difficulty. Impossible starts with retaliation, Bots, and very weak targets; Easy gives nuked land and Bots earlier priority.
Bot attack concurrency is Easy 1, Medium randomly 1 or 2, Hard 3, and Impossible 100. This limit is not a promise that enough valid targets exist.
Defense Posts, structures, and placement
Responsive Defense Posts
A responsive Defense Post is never the first Nation structure. Easy does not build this response.
Medium uses a 50% gate and limits the front to one. Hard and Impossible require total incoming land troops of at least 35% of the Nation's current troops.
At that threshold, the requested count is ceil(incoming / current / 0.4). Gold, valid positions, and other checks can still prevent construction.
Sea attacks do not count toward this 35% structure branch. Smaller land probes still affect relation, retaliation, and other behavior.
Regular structure targets
| Structure | Target ratio | Important boundary |
|---|---|---|
| Port | 0.75 per City | Needs a valid shared water body and buildable shoreline. |
| Factory | 0.75 per City | On a coast with Ports enabled, the ratio is multiplied by 0.33. |
| SAM | 0.15 / 0.20 / 0.25 / 0.30 per City | Easy through Impossible; placement scores protected structures. |
| Missile Silo | Normally 0.20 per City; first uses 0.40 | Hard cap of three, plus enablement, Gold, space, and saving rules. |
Targets use floor(cityCount × ratio). They are not a fixed build order or clock.
Above one structure per 1,500 tiles, the AI tends to upgrade instead of adding density. Candidate sites are sampled, then scored by terrain, inland depth, spacing, and coverage.
With at least 3,000,000 starting Gold, Hard or Impossible can try SAM first when Atom, Silo, and SAM are enabled.
At more than one Nation per 7,500 land tiles and no City, the first choice favors Port, or Factory when no shared water qualifies.
Ports, Warships, and naval counterplay
A Nation Port needs shoreline on water shared with another player. The ocean always qualifies; inland water needs another player touching the same component.
Except on Easy, an inland component below 3,000 water tiles is skipped. A visible coast therefore does not guarantee a Port.
The first regular Warship attempt also needs a 1/50 gate, a Port, no current Warship, Gold strictly above cost, and a valid water tile within 250 tiles.
Non-Easy Nations with a Port can react to a destroyed transport, captured Trade Ship, or incoming transport. The build gates are 15%, 50%, and 80% from Medium to Impossible.
A transport under 20 tiles from landing is considered too close for a new-build response. A friendly Warship or patrol within 90 tiles also suppresses another build.
Keep routes short, escort valuable transports, and watch Warship movement. None of those actions guarantees that the random build gate fails.
Alliances, embargo, and betrayal
When processing a bordering candidate, an active Nation alliance request first passes a 1/30 gate. A request created during spawn and handled on the first post-spawn tick is rejected.
Acceptance considers confusion, traitor status, threat, Team mode, relation, alliance counts, game time, and relative strength. Friendly relation alone is not a contract.
| Difficulty | Early acceptance branch | Team extra refusal |
|---|---|---|
| Easy | 90% in first 5 minutes | 25% |
| Medium | 70% in first 3 minutes | 50% |
| Hard | 50% in first 3 minutes | 75% |
| Impossible | 30% in first minute | 100% |
These values apply only if earlier checks have not returned. A traitor normally fails early, but 10% pass that rejection branch and can still fail later.
Hard and Impossible may betray an ally below 20% of its maximum troops when the ally's current troops are lower than the Nation's.
Medium may betray at 10× the ally's troops. Non-Easy may also betray a weaker traitor or its only bordering ally when the Nation has over three times the troops.
These are candidate rules inside the attack queue. Crossing one threshold does not trigger immediate betrayal.
Your embargo gives the Nation's relation toward you a one-time -20. Easy and Medium may auto-remove their embargo at Neutral, Hard at Friendly, while Impossible has no auto-remove branch.
Ordinary nukes and MIRV
Ordinary nuclear targeting can prioritize the largest incoming attacker, a crown holder, an ally-marked target, a hostile player, an FFA leader, or a strong Team.
Hard and Impossible skip candidate trajectories an enemy SAM can intercept. Impossible may instead try an Atom salvo or upgrade a useful Silo to at most level 5.
SAM coverage raises cost and changes candidate paths. SAM is not nuclear immunity.
MIRV requires an enabled weapon, a Silo, enough Gold, a target branch, and passing hesitation. Hesitation is 1/2, 1/4, 1/8, and 1/16 from Easy to Impossible.
| MIRV branch | Easy | Medium | Hard | Impossible |
|---|---|---|---|---|
| Individual land threshold | 75% | 65% | 55% | 40% |
| Team land threshold | 90% | 80% | 70% | 60% |
| City lead: minimum / ratio | 20 / 2.0× | 10 / 1.5× | 10 / 1.25× | 8 / 1.15× |
Other MIRV branches include retaliation against a MIRV sender. Staying below the land threshold does not make a player safe from every nuclear branch.
After any Nation targets the same player with MIRV, Nations share a 300-tick cooldown for that target.
Three numeric scenarios
Hard Nation beside a 400,000-troop rival
In ordinary FFA, the Hard floor keeps 75% of that rival's troops. The Nation normally preserves at least 300,000 after an attack.
If the Nation is already under attack, the response branch can raise usable troops to at least total incoming troops. The 300,000 floor is not universal.
Defense Post pressure at 1,000,000 troops
Combined land attacks of 340,000 are below the 35% Hard/Impossible threshold. At 360,000, the desired count is ceil(0.36 / 0.4) = 1.
At 850,000 incoming, the formula asks for three. The Nation can still lack Gold or a valid tile, and the branch can block another regular building for that cycle.
Hard MIRV pressure
A player at 55% of individual land qualifies for Hard's victory-prevention branch. A city leader can qualify with at least 10 more Cities and a 1.25× lead over second place.
The Hard hesitation is still 1/8, and Silo, Gold, target cooldown, and other checks remain. Qualifying is not the same as being hit immediately.
Common failures and counterplay
- “It is below trigger, so it is safe.” The Nation can pass the 1/10 continuation and retaliation has separate pressure. Keep a reserve near the shared border.
- “Small probes do nothing.” They may stay below the Defense Post threshold, but they still change relation, incoming pressure, and retaliation candidates.
- “A coast means a Port.” Check shared water and size. Deny buildable shoreline or contest the water before assuming the fleet appears.
- “Friendly means permanent alliance.” Avoid traitor state, excessive alliances, and extreme troop weakness. Keep a plan for expiry or betrayal.
- “SAM ends the nuclear threat.” Spread high-level structures, vary coverage, and expect high difficulty to seek another path or pressure the SAM.
- “Impossible is deterministic.” Its decisions are faster and stricter, but still use individual thresholds, sampling, and random gates.
Nation AI FAQ
Does a Nation always attack the weakest player?
No. Weakest is one local strategy among retaliation, Bots, ally assistance, traitors, victims, hostile players, islands, and other categories.
Can Easy attack a human?
Yes. Its general human check passes 25% of the time, and retaliation, traitor, HvN, and non-human paths have different rules.
Can I guarantee an alliance by improving relation?
No. Relation changes eligibility, while traitor status, threat, mode, alliance count, time, strength, and random gates still matter.
Will a Nation with a Port build a Warship?
Not necessarily. The regular first ship has a 1/50 gate plus Gold, Port, current-fleet, enablement, and placement requirements.
Does Impossible stop being random?
No. Its interval is shorter and its rules are stronger, but thresholds, sampling, hesitation, and build gates remain pseudo-random.
Are Nation coordinates fixed human spawns?
No. Manifest coordinates are nearby sampling anchors for Nations. Human spawning follows separate rules.
Sources and next reading
- Official OpenFront v0.33.7 Release.
- NationExecution.ts and PseudoRandom.ts.
- AiAttackBehavior.ts.
- NationStructureBehavior.ts and NationWarshipBehavior.ts.
- NationAllianceBehavior.ts and NationEmojiBehavior.ts.
- NationNukeBehavior.ts and NationMIRVBehavior.ts.
- Alliances and betrayal, nuclear weapons and SAM, and map strategy.