Ungodly Diplomacy AI 1.0.1 and Research 1.2.0

Ungodly Diplomacy AI settings

All 42 settings live in two places that stay in sync: the in-game window on F8, and the file BepInEx\config\com.stixsworldhd.ungodlydiplomacyai.cfg. The window is the easy way; the file is handy for sharing a setup or fixing a key clash while the game is closed.

The F8 window

The Ungodly Diplomacy AI v1.0.1 settings window open over the game's main menu on the Ballistics tab, listing Lead Moving Targets, Lead Strength, Dispersion Scale, Integrator-Exact Arcs, Obstacle-Clearing Arcs and Arc Raise Attempts.View full size 1920 × 1080
Ungodly Diplomacy AI: the F8 window on its Ballistics tab, opened at the main menu. Every row shows its range, its default and a plain-language explanation.
  • Press F8, or your own menu key, to open and close it. It has eight tabs: General, AI Targeting, AI Tactics, Pathfinding, Ballistics, No-Teleport, Coroutines or Status.
  • Every row shows the setting, its current value, its range and default, and a plain-language explanation.
  • Change a value with its slider, the − and + step buttons, an ON/OFF button, or, for the menu key, by pressing the new key.
  • Default resets one row; Reset this tab to defaults resets the whole tab.
  • Changes apply instantly, even mid-battle. They're saved when you close the window, and every few seconds while it's open.

The mouse cursor

While the window is open the cursor is shown and free, and clicks and mouse-wheel zoom over the window never reach the game. When you close it, the cursor goes back exactly as the game had it: confined to the game window, or locked if you're directly controlling a unit.

The Status tab has no settings. It shows each system's live state and counters; Part 4 explains what it shows.

The config file

BepInEx writes BepInEx\config\com.stixsworldhd.ungodlydiplomacyai.cfg the first time the game starts with the mod. Above every setting it repeats the range, default and explanation from the window. This is how the file begins:

BepInEx\config\com.stixsworldhd.ungodlydiplomacyai.cfg
## Settings file was created by plugin Ungodly Diplomacy AI v1.0.1
## Plugin GUID: com.stixsworldhd.ungodlydiplomacyai

[1. General]

## Min: any single key | Max: any key plus modifier keys (Ctrl/Alt/Shift) | Default: F8
## Opens and closes the Ungodly settings window. While it is open the mouse cursor is shown and unlocked, the game ignores clicks and mouse-wheel zoom over the window, and when you close it the cursor is handed back to the game exactly as it was (confined to the game window, or locked while you directly control a unit).
# Setting type: KeyboardShortcut
# Default value: F8
Menu Key = F8

## Min: false (off) | Max: true (on) | Default: true
## Master switch. ON: the Ungodly systems replace the game's combat AI, pathfinding, ballistics and coroutines. OFF: every original system takes over again instantly, even mid-battle, with no restart needed.
# Setting type: Boolean
# Default value: true
Mod Enabled = true

…
  • Edit it with the game closed. The mod saves the file when you close the F8 window and every few seconds while it's open, so edits made while the game runs can be overwritten.
  • Use a dot for decimals, such as 0.8, whatever your Windows region settings.
  • Keep each number between the Min and Max listed above it.
  • To reset everything, delete the file while the game is closed. The next start writes a fresh one with every default.

General

4 settings on the General tab, stored under [1. General] in the config file.

SettingDefaultRangeWhat it does
Menu KeyF8Any key, optionally with Ctrl, Alt or ShiftOpens and closes the Ungodly settings window. While it is open the mouse cursor is shown and unlocked, the game ignores clicks and mouse-wheel zoom over the window, and when you close it the cursor is handed back to the game exactly as it was (confined to the game window, or locked while you directly control a unit).
Mod EnabledONON or OFFMaster switch. ON: the Ungodly systems replace the game's combat AI, pathfinding, ballistics and coroutines. OFF: every original system takes over again instantly, even mid-battle, with no restart needed.
GUI Scale10.75 to 2.5, in steps of 0.05Size of this settings window. It already grows with your screen resolution; raise this if the text is still too small (for example on a 4K screen), lower it for a more compact window.
Error Fallback Threshold251 to 500, whole numbersSafety net. If one replacement system hits this many errors inside a single half-second health check, it switches itself off and the original game system takes over, so your battle keeps running. Lower = bails out sooner; higher = tolerates rare hiccups.

AI Targeting

12 settings on the AI Targeting tab, stored under [2. AI Targeting] in the config file.

SettingDefaultRangeWhat it does
Replace Vanilla Combat AIONON or OFFON: every soldier, archer, tower crew, caster and enemy uses the Ungodly target-acquisition brain. All original behaviours are kept: casting order, forced attacks and casts, Hold, Patrol, Defend, attack-move, towers, gates, sieges and kamikaze units. OFF: the original AI runs.
Utility TargetingONON or OFFON: units weigh every valid target (distance, wounded enemies, dangerous enemies, armour counters, overkill and high-value units) and attack the smartest choice. OFF: units pick the closest valid target like the original game, still inside the Ungodly system.
Proximity Weight10 to 3, in steps of 0.05How much being close matters when choosing a target. Higher = units stick to nearby enemies and waste less time walking; lower = they reach further for a better target. 0 ignores distance completely.
Finish-Off Weight0.80 to 3, in steps of 0.05How much units prefer badly wounded targets. Higher = more enemies are finished off quickly, so their numbers drop faster; lower = damage is spread more evenly. 0 ignores target health.
Threat Weight0.70 to 3, in steps of 0.05How much units prefer targets that deal a lot of damage. Higher = your archers delete enemy damage-dealers and heavy hitters first; lower = they ignore how dangerous a target is. 0 turns this off.
Armour Counter Weight0.90 to 3, in steps of 0.05How much units prefer targets their weapon is strong against, using the game's own armour-versus-weapon damage table. Higher = every weapon seeks the armour it beats and avoids wasted hits; 0 ignores armour.
Overkill Avoidance Weight0.80 to 3, in steps of 0.05How much units avoid piling onto a target that other attackers are already about to kill. Higher = volleys spread across more enemies with less wasted damage; 0 lets everyone hit the same target.
Priority Target Weight0.50 to 3, in steps of 0.05How much units prefer high power-level units such as heroes, champions and elite troops. Higher = elites get focused down; 0 treats every unit the same. Your 'defend priority' orders are always respected.
Target Stickiness0.250 to 1, in steps of 0.05Bonus for the target a unit is already fighting, so it does not flip between targets every second. Higher = more committed to the current fight; lower = switches as soon as something better shows up.
Extra Search Rings10 to 3, whole numbersHow many extra rings of the game's search grid a unit examines after the first ring that contains an enemy. 0 = nearest ring only (fastest); higher = a wider choice of targets for a little more CPU.
Max Candidates Per Search244 to 96, whole numbersHard cap on how many enemies one unit scores in a single search. Higher = better choices in huge battles; lower = lighter CPU load when thousands of units are fighting.
Search Interval Scale10.25 to 3, in steps of 0.05How often idle units look for new targets. 1.0 = the original rhythm (every 0.8 to 1.2 seconds). Lower = sharper reactions but more CPU; higher = lazier units and more FPS.

AI Tactics

5 settings on the AI Tactics tab, stored under [3. AI Tactics] in the config file.

SettingDefaultRangeWhat it does
Healer TriageONON or OFFON: healers choose who to heal by how hurt they are, whether they are fighting right now, how close they are and how valuable they are. OFF: the original 'lowest health in range' rule.
Nearest Corpse ResurrectionONON or OFFON: resurrectors (yours and the enemy's) raise the nearest corpse in range. OFF: the original rule, which takes whichever corpse the search grid returns first.
Ranged Kiting (Enemies)ONON or OFFON: enemy archers and ranged casters that get rushed inside their minimum range step back to a safe distance and keep shooting, instead of dropping their target. OFF: original behaviour.
Ranged Kiting (Your Units)OFFON or OFFSame as above for your own free-moving ranged units. Units on Hold, Defend or Patrol, and units with a forced target, never kite, so your orders always win. OFF by default.
Kite Distance Margin20.5 to 8, in steps of 0.25Extra distance, in map cells, that a kiting unit puts between itself and a rushing enemy beyond its minimum range. Higher = safer but more walking; lower = tighter footwork.

Pathfinding

7 settings on the Pathfinding tab, stored under [4. Pathfinding] in the config file.

SettingDefaultRangeWhat it does
Replace Vanilla PathfindingONON or OFFON: the Ungodly pathfinder builds every route and flow field for all units, citizens and enemies. OFF: the original pathfinder.
Distance-Weighted RoutingONON or OFFON: routes between map regions are chosen by real walking distance. The original only counts how many regions a route crosses, which can send armies the long way round. OFF: original hop-count routing.
8-Direction Flow FieldsONON or OFFON: flow fields use true 8-direction shortest paths that never cut wall corners, which removes the zig-zag 'staircase' walking. OFF: the original 4-direction fields.
Congestion Avoidance0.350 to 2, in steps of 0.05How strongly new routes avoid map regions already packed with units of the same side, so reinforcements flow around traffic jams. 0 = off; higher = stronger detours around crowds.
New Paths Per Frame25025 to 1000, whole numbersMaximum number of brand-new routes solved per frame across both sides (the original uses 250). Higher = huge orders resolve faster; lower = smoother FPS when thousands of units are ordered at once.
Path Time Budget (ms)40.5 to 20, in steps of 0.5Time the pathfinder may spend per frame on new routes. It runs on a worker thread; requests over budget simply wait for the next frame. Higher = faster orders; lower = steadier frame times.
Path Cache Cleanup Interval81 to 60, whole numbersEvery how many frames unused routes and flow fields are cleaned out of memory. 1 = every frame (like the original); higher = less CPU work for slightly more memory.

Ballistics

8 settings on the Ballistics tab, stored under [5. Ballistics] in the config file.

SettingDefaultRangeWhat it does
Replace Vanilla BallisticsONON or OFFON: every arrow, bolt, stone and tower shot fired at a unit gets a new trajectory solved at the moment it leaves the weapon. OFF: the original aiming.
Lead Moving TargetsONON or OFFON: shots are aimed where a moving target will be when the projectile arrives (a true intercept). The original freezes its aim point when the draw animation starts. OFF: aim at the target's current position.
Lead Strength10 to 1.5, in steps of 0.05How much of the target's movement is predicted. 1.0 = full prediction; below 1 = partial lead; above 1 = over-lead. 0 disables leading.
Dispersion Scale10 to 3, in steps of 0.05Size of the natural round scatter around the aim point, growing with distance like the original. The original uses a square scatter that misses more toward the corners. 1.0 = original spread size; 0 = pin-point; 3 = very inaccurate.
Integrator-Exact ArcsONON or OFFON: arcs are corrected for the game's own 60-steps-per-second projectile physics, so shots land exactly where aimed instead of slightly long. OFF: uncorrected arcs.
Obstacle-Clearing ArcsONON or OFFON: if a shot's arc would clip a wall, gate or palisade on the way, the arc is raised until it clears. Tower shots already use the game's high tower arc and are left as they are. OFF: shots may hit obstacles in the way.
Arc Raise Attempts30 to 6, whole numbersHow many times an arc may be raised to clear an obstacle. Each attempt lifts the arc peak by 30 percent. 0 disables raising.
Preserve Multishot PatternONON or OFFON: extra projectiles from multishot skills keep their spread pattern around the new aim point. OFF: every projectile uses the round scatter.

No-Teleport

4 settings on the No-Teleport tab, stored under [6. No-Teleport] in the config file.

SettingDefaultRangeWhat it does
Block TeleportsONON or OFFON: units never jump. The game's collision and movement code sometimes snaps a stuck unit several cells in one frame, even through walls. With this ON they walk there at a believable speed instead, and snaps through walls are refused. OFF: original snapping.
Speed Tolerance62 to 20, in steps of 0.5How many times a unit's own top speed a single frame of movement may reach before it counts as a teleport. Higher = allows faster legitimate bursts (charges, fear, speed skills); lower = stricter.
Minimum Step0.350.05 to 3, in steps of 0.05Extra distance, in map cells, allowed per frame on top of the speed limit, so crowd shoves and tiny corrections are never blocked.
Guard Citizens & WorkersONON or OFFON: villagers, workers and caravans are protected from teleports too. OFF: only soldiers and enemies are guarded.

Coroutines

2 settings on the Coroutines tab, stored under [7. Coroutines (MEC Pro)] in the config file.

SettingDefaultRangeWhat it does
Run Game Coroutines On MEC ProONON or OFFON: the game's own coroutines (music fades, window moves and timed UI tasks) run on More Effective Coroutines Pro instead of Unity's coroutine scheduler. They behave identically, including stopping when the game stops them or disables their object. OFF: Unity coroutines.
Log Coroutine RedirectsOFFON or OFFON: writes a line to the BepInEx log every time a game coroutine is moved onto MEC Pro. Useful for troubleshooting; leave OFF normally.