Dynamic Diplomacy Overflow Fix
О материале
«Dynamic Diplomacy Overflow Fix» — материал мастерской RimWorld. Моды для колонии: новые возможности, предметы и удобство игры. Для установки откройте оригинал в Steam Workshop, проверьте требования автора и подпишитесь. Совместимость с версией игры редакцией не проверена.
Описание автора
Unofficial fix for Dynamic Diplomacy - Continued.
1) OverflowException in NPC conquest battles
Fixes this error:
System.OverflowException: Value was either too large or too small for an Int32.
at DynamicDiplomacy.IncidentWorker_NPCConquest.InitArenaMap
Cause: InitArenaMap builds a raid seed with int.Parse(tickCreated.ToString() + map.uniqueID). In long-running saves the concatenated number exceeds Int32.MaxValue, so roughly 37.5% of NPC conquest battles throw before any AI is assigned. Both armies then spawn without orders and wander off the map, and the battle is resolved by auto-calc after timeout (in semi-simulation mode, the arena retries and keeps spawning more pawns).
Fix: A Harmony transpiler replaces that single int.Parse call. Values that fit in Int32 are unchanged; larger values are folded deterministically into range.
2) Better "basic AI" for arena battles
In the original basic AI branch, both sides are ordered to defend the map center, which turns every fight into a melee brawl and cripples ranged / high-tech factions. With this patch:
-
Attacker hunts down and engages the nearest defenders (using Dynamic Diplomacy's own raid AI).
-
Defender holds a position near its own entry, at least 14 cells away from the map edge (same position finder the siege/shelling AI uses).
Shelling AI and Factional War AI branches are unchanged. If anything fails, it falls back to the original behavior.
Notes
-
Safe to add to an existing save. To remove it, do so when no NPC arena battle is in progress.
-
Load after Harmony and Dynamic Diplomacy - Continued.
-
If the original mod fixes the overflow, a warning appears in the log.
Dev tools
With Development mode on, Debug actions > "Dynamic Diplomacy Fix" can trigger a conquest arena with a forced AI branch (basic / factional war / shelling / random) for quick testing.
This mod was developed with the help of AI coding tools (Claude Code). Full source code is included in the Source folder for review.
Как установить и запустить
Откройте оригинальную страницу в Steam Workshop, проверьте версию игры, зависимости и порядок загрузки в описании автора. Нажмите «Подписаться» и дождитесь загрузки Steam. Включите материал в меню модификаций или контента игры, если это требуется. Совместимость и запуск редакцией не проверены.