Skip to content

Repository files navigation

AoH2 Diplomacy Fix — Relations Stuck at 0 Bug

Tests Python License

Fix for the Age of History II diplomacy bug (also known as Age of Civilizations II / AoH2 / AoC2) where all country relations are permanently stuck at 0 and cannot be changed, improved, or used for alliances. Works on any save file, any scenario, any campaign length.

Quick answer: Your AoH2 save has NaN (Not a Number) values in the diplomacy relation files. This happens after many turns and makes every country show 0 relations. This tool automatically finds the broken values, backs up your save, and fixes them. No hex editor needed.


Tools

Tool What it does When to use
aoh2_diplomacy_fix.exe Run once to fix a corrupted save (+10.0) You already have the bug
aoh2_smart_watcher.exe Runs in background, restores exact original values on NaN Prevention — protect future saves

Download

Option A — Windows .exe (no Python needed)

Download from the Releases page:

  • aoh2_diplomacy_fix.exe — one-time fix
  • aoh2_smart_watcher.exe — background protection

Option B — Python script

Requires Python 3.10+.

git clone https://github.com/Bat0oo/aoh2-diplomacy-fix.git
cd aoh2-diplomacy-fix
pip install watchdog pystray Pillow plyer javaobj-py3

What causes the bug?

After many turns, AoH2 sets diplomatic relation values to NaN (Not a Number) — an invalid IEEE 754 float. Because NaN has special mathematical properties, all relation values appear as 0 and no longer respond to diplomacy actions. This is a known, unpatched bug.


aoh2_diplomacy_fix — One-time fix

Step 1 — Check if affected

python aoh2_diplomacy_fix.py --save-path "D:\Steam\...\YOUR_SAVE" --scan

Step 2 — Preview (optional)

python aoh2_diplomacy_fix.py --save-path "D:\Steam\...\YOUR_SAVE" --dry-run

Step 3 — Fix

python aoh2_diplomacy_fix.py --save-path "D:\Steam\...\YOUR_SAVE"

Or just double-click the .exe for an interactive menu.

All options

Argument Description Default
--save-path Direct path to save folder
--saves-root Path to saves/games to list all saves Auto-detect
--value Replace NaN with 10 (+10.0) or 0 (neutral) 10
--scan Check if affected, no changes off
--dry-run Preview what would change, no changes off

aoh2_smart_watcher — Background protection

Runs while you play. On every clean save it records your exact diplomacy values. If NaN appears, it restores those exact values automatically.

How snapshots work

Clean save detected:
  → Reads lRelation float values for each civilization
  → Saves to WATCHER_SNAPSHOT/relations_snapshot.json
  → Notification: "Save clean ✓ — snapshot saved"

NaN detected:
  → Creates backup first (always)
  → Reads NaN positions from corrupted file
  → Restores exact original values from JSON snapshot
  → Notification: "4780 NaN restored from snapshot ✓"

No snapshot yet (first session):
  → Falls back to +10.0
  → Notification: "Fixed ✓ — no snapshot yet, used +10.0"

Running the watcher

Tray mode (recommended) — double-click aoh2_smart_watcher.exe:

  • Gold shield icon appears in system tray
  • Right-click → Show status / Exit

CLI mode:

python aoh2_smart_watcher.py --cli
python aoh2_smart_watcher.py --cli --confirm   # ask before fixing

What gets created in your save folder

your_save/
  WATCHER_SNAPSHOT/
    relations_snapshot.json   ← exact diplomacy values
    _2X, _2X1 ...             ← binary backup copies
  BACKUP_20260528_.../        ← backup before any fix
  _2X, _2X1 ...               ← AoH2 files

Save file location

Windows (Steam):

D:\Steam\steamapps\common\AoCII\saves\games\<Scenario>\<SaveName>\

Android:

/Android/data/age.of.civilizations2.lukasz.jakowski/files/saves/games/

Transfer to PC, run fix, copy back. See Android section below.


Android

The fix works on Android saves — identical file format.

  1. Connect phone via USB → enable File Transfer (MTP)
  2. Navigate to /Android/data/age.of.civilizations2.lukasz.jakowski/files/saves/games/
  3. Copy save folder to PC
  4. Run aoh2_diplomacy_fix.exe
  5. Copy fixed files back

Android 11+: The /Android/data/ folder may be restricted. Use MiXplorer or Total Commander.


FAQ

All my country relations are 0 in AoH2 — how do I fix it? Download aoh2_diplomacy_fix.exe from the Releases page, run it, select your save, and click Fix. Takes under 10 seconds.

Why are all relations stuck at 0 in Age of History 2? After many turns, AoH2 corrupts the relation values to NaN (Not a Number). The game then displays NaN as 0 and diplomacy stops working. This is a known unpatched bug in AoH2 / Age of Civilizations II.

I can't improve relations, form alliances or request unions in AoH2 — why? This is the NaN diplomacy bug. Run the fix tool to restore your relations.

Will this corrupt my save? No. A timestamped backup is always created before any file is touched. If anything goes wrong, copy the files from the BACKUP_ folder back.

My relations go back to 0 after a few turns — why? The bug can re-occur in very long campaigns. Run the tool again, or use aoh2_smart_watcher.exe for automatic background protection.

Does this work on Android? Yes — transfer your save folder to a PC, run the fix, copy back. See the Android section above.

What does +10 mean? A slightly positive base relation. Use --value 0 for strict neutral.

What's the difference between the fix and the watcher? The fix replaces NaN with +10.0 (one-time, manual). The watcher runs in the background and restores your actual original values from a snapshot taken before the bug appeared.

Does it work on iOS? The file format is identical but iOS files require iTunes backup extraction. Same fix logic applies once you have the files.

I don't have Python — can I still use it? Yes. Download the .exe from the Releases page. No Python or installation needed.


Technical details

AoH2 saves use Java ObjectOutputStream serialization. Each _2X file contains an ArrayList<Save_Civ_GameData> where each object has lRelation: ArrayList<Float> — the diplomacy relation scores.

Bytes Value
7F C0 00 00 NaN (broken — this is the bug)
41 20 00 00 +10.0 (default replacement)
00 00 00 00 0.0

You can verify with any IEEE 754 converter.


Building .exe yourself

If you don't trust the pre-built release:

pip install pyinstaller watchdog pystray Pillow plyer javaobj-py3
build.bat

Both .exe files will be in dist/.


Transparency

Not sure what the scripts do? Read the full explanations:


Contributing

Found a bug or want to add a feature? See CONTRIBUTING.md.


License

MIT — Bat0oo

About

Fix for Age of History II (AoH II) diplomacy bug — all country relations stuck at 0 (NaN bug). Works on any save, any scenario.

Topics

Resources

Contributing

Stars

6 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages