Player guide · Administrator guide

BSD Empire 1.1 combat source audit — v0.9.16

The original empire-1.1.tar.gz supplied by the player was read and inspected; it is not redistributed in this game ZIP. SHA-256: d705b9c8e77e6001f01c5f9feb39ce8d722964fbb99271e810d806ec4e4546ee. This source distribution contains original C implementations with RCS history dating to 1989–1990; the archive itself carries a later gzip modification timestamp.

Directly verified source formulas

BehaviorHistorical sourceImplemented in C#
Round-by-round land casualties: odds = attacker strength/(attacker + defender strength); one casualty per random roundEMP/player/commands/atta.c, lines 215–247, 349–378LandCombatRules.Resolve, BsdCombatMath.Odds
Strength factor = 1 + (designation rating / 2 − 1) × sector efficiency / 100EMP/player/commands/atta.c, 354–371; EMP/lib/global/sect.c, 15–47BsdCombatMath.OffensiveFactor/DefensiveFactor
At 100% efficiency, fortress defense rating 8 = 4×; capital rating 4 = 2×; bank rating 3 = 1.5×EMP/lib/global/sect.c, 21, 36, 45Defense reporting and ground odds
Successful attack with surviving MIL places about half in the captured sector; empty defenders may be captured without occupationEMP/player/commands/atta.c, 219–220, 249–310Return-and-occupation split; no forced-survivor capture veto
Attack mobility cost: (source movement rating + 2 × target rating) × committed troops / 24, truncated to integerEMP/player/commands/atta.c, 112–145BsdCombatMath.AttackMobilityCostMilli
Land gun effectiveness = 20 + (random%10) × 0.01 × efficiencyEMP/player/subs/landgun.c, 18–23BsdCombatMath.LandGun
Land shell armor = 320 for banks; 160 for other sectors; shell damage = int(guneff × 100 / (armor + guneff + 1))EMP/player/subs/landgun.c, 41–61BsdCombatMath.LandArmor/ShellDamage
Fortress defensive shot consumes one shell; seven guns cap range; technology factor = (50 + tech)/(200 + tech)EMP/player/subs/fortdef.c, 107–160; EMP/player/subs/tfact.c, 18–39FortArtilleryRules
Direct FIRE has wind deflection and no +1 range bonus at 60% efficiencyEMP/player/commands/fire.c, 187–259LandArtilleryRules uses C-based damage/deflection

v0.9.33 — land-combat contagion and event persistence

The original EMP/player/commands/atta.c, lines 97–98, 150–151, 293–295, 322 and 340–342, accumulates infectious participants and transmits plague when an attack captures the destination. A healthy attacked sector becomes exposed, and healthy source sectors can become exposed when surviving troops return. Defeat clears the C infection accumulator. The original returning-source write references V_PTIME rather than V_PSTAGE; the C# implementation deliberately tests the actual plague stage rather than copying that apparent bug. Attack and artillery notices use the existing nation-private EVENTS infrastructure and are recorded atomically with the battle or strike. This is not a full recreation of the BSD wu telegram and nreport news subsystems.

Original ship contact rules were also reviewed: player/commands/buil.c exposes newly built ships in infected sectors; load.c transfers plague on load and unload; tend.c and boar.c propagate ship-to-ship exposure; and update/ship.c advances ship epidemics and mortality without spontaneous ship outbreaks. No ships or naval commands exist in this game yet, so those source-verified interactions remain future work.

Remaining known differences

The current ATTACK API supports up to six neighboring source sectors, matching atta.c; the original can optionally leave captured sectors unoccupied. Defensive artillery damages one randomly selected attacking source sector as a whole, including its noncommitted military, population, efficiency, and stockpiles. Combat uses seeded injectable randomness in tests; original C uses its global random generator. Some damage-rounding and inventory edge cases differ, although direct fire now reduces commodity inventories and mobility as well as population and efficiency.

At the time of the v0.9.16 audit, original ownership, loyalty, guerrillas and plague had not yet been reproduced. v0.9.24 adds persistent initial takeover state; v0.9.27 adds source-derived hourly guerrilla, rebellion and loyalty effects with a deterministic elapsed-time clock. v0.9.31 adds source-derived sector plague stages, direct-delivery exposure, and private milestone event history. Ship epidemics, historical mailboxes/public news and configurable ETUs remain unfinished; v0.9.33 adds captured-sector and returning-source land combat contagion plus nation-private combat/fire notices. BTU costs still follow our prototype's 1-BTU-per-command rule rather than the casualty-sensitive original attack charge. Because these differences can change outcomes, v0.9.14 is a source-verified core combat implementation, not a claim of total gameplay equivalence.

Migration snapshot verification

As of v0.9.16 the persistence regression suite compares the battle and direct-fire snapshot property names and CLR types to the live EF Core model. Coordinated attacks added SourceContributions and CollateralMilitaryLosses, increasing the battle entity property count from 17 to 19. Fixed property-count assertions are no longer used, while the foreign-key relationship to the named GameEntity is still checked. This is a test-only correction, not a migration or gameplay adjustment.

Regression evidence

Smoke tests assert the original odds, sector efficiencies, 1.5× bank defense, technology-factor range, one-shell fort shots, original mobility arithmetic, seeded reproducibility, occupation split, and capture without surviving occupiers. Optional PostgreSQL integration tests check transactional capture, military conservation, artillery spending and BTU rollback.

Reference command: COMBATRULES or COMB. Local archive inspection tools remain in scripts/, but the historical archive is never bundled in this release.

Empire v0.9.39 · HTML-only documentation · original archive SHA-256 recorded for reproducibility

v0.9.14 coordinated attack fidelity

The original EMP/player/commands/atta.c accepts 1–6 sources surrounding a target. Its calcodds() sums offensive strength across contributing sectors; losing attacker MIL are removed round-robin. Before the battle, defdef() damages a randomly selected attacking sector with sectdamage(), and the attack recalculates strength. On victory, the source-specific occupying fraction is max(1/(nsect+1), 1/totalSurvivors) with per-source rounding and a 999-MIL occupation cap.

The current C# implementation applies those rules, limits the whole attack to one PostgreSQL transaction, and records source-by-source commitments, casualties, returns and occupiers. The accompanying C source is deliberately not repackaged. Remaining gaps include treaties, ship epidemics, original ETU scaling and historical casualty-based BTU charging. Existing battles created before v0.9.14 have no per-source breakdown.

v0.9.24 source-verified takeover state

The original EMP/player/subs/takeover.c was reread from the previously supplied source archive (SHA-256 above). It resets sct_avail, recruits guerrillas from civilians using an existing owner/oldowner test, preserves original ownership and sets conquered loyalty to 50, or zero on recapture or depopulation. PostgreSQL now stores original owner, loyalty, guerrilla count and guerrilla target. GARRISON displays the saved state. The 8-bit guerrilla count is clamped at 255 to avoid overflow, one intentional safety divergence from the original packed V_CHE representation.

In v0.9.27, the update-cycle implementation follows EMP/update/revolt.c, EMP/update/populace.c, and the order established in EMP/update/sect.c. Each elapsed hour is processed exactly once with deterministic game/coordinate/tick random rolls. Guerrillas can fight, recruit, sabotage or move to an adjacent targeted nation; loyalty can change, and an under-defended occupied sector can revert to its prior allegiance. The original adjustable ETUs, work-percentage persistence, ship epidemics, and complete historic news/notification output remain differences.