RobZ AI Overhaul (RobZ 1.30.x)

Replaces RobZ's stock bot spawn and targeting logic. If you've noticed the AI dumping its whole army at once, ignoring artillery, or leaving squads idle at base while the front collapses, this is a rewrite aimed at those specific problems.

WHAT IT DOES

Wave spawning
Manpower is banked and released in waves instead of spent the instant it is earned. Spawns are spread across ticks so the engine does not reject a burst. The interval between waves and the per-wave budget both react to how the match is going: losing the flag count shortens the gap and raises the budget (up to 2.5x).

Group targeting
Groups push toward the frontier instead of routing past your lines to a deep, unsupported flag. There is a short grace period after capturing a flag before the bot will abandon it again.

Phase-based composition
Infantry and light armor early, mediums by mid-game, heavies late, timed against each faction's actual RobZ unlock schedule rather than a flat clock.

Faction bias
Each faction keeps a guaranteed minimum of its signature unit category on the field (German medium armor, US/British artillery, Soviet SMG infantry, Japanese mortars, and so on), on top of the normal composition ratio.

Best-gun selection
When the enemy fields armor, the picker weights toward the highest armor-penetration unit unlocked in the chosen tier, so the main push carries a gun that can punch through instead of feeding out-gunned light vehicles into enemy tanks. Penetration values are extracted from RobZ's own gun data.

Support unit trickles
Assault guns and tank destroyers escort the main push and follow its target instead of parking at a backline flag. Halftracks, scout cars, mortars, AT guns, and snipers each get a dedicated keep-alive slot instead of competing in one shared pool where a few unit types crowd everyone else out.

Late-game manpower guard
If a heavy tank repeatedly fails to spawn for lack of manpower, spawn cadence slows down so manpower can accumulate, rather than continuing to burn it on cheaper units while the heavy never lands.

Unit cap
MoWAS2's engine is 32-bit and will OOM crash if the field gets flooded with squads in a large team game. Each bot enforces a live-squad ceiling to stay under that limit, so 2v2/3v3 with AI on every side stays stable.

COMPATIBILITY

- Lua only, no entity assets. Safe alongside content mods.
- Requires RobZ Realism Mod 1.30.10 (older RobZ versions not supported). Load this mod after RobZ so its bot overrides take effect.
- Game version 3.262.
- RobZ maps and units only. Targeting relies on precalculated flag-sector data for RobZ's map pool (54 of 57 1v1/2v2/3v3 maps) and this mod's own unit roster and unlock data. Maps outside that set fall back to degraded targeting. Not tested with vanilla maps or other mods.

TESTING

Changes are covered by an offline test suite and unit IDs are checked against RobZ's actual game data before release.

SOURCE

GitHub: https://github.com/marcohwlam/ai-spawn-improved-robz

CHANGE LOG

v1.3.0
- New AI faction: Axis Minor. The bot now fields RobZ's six-nation Axis coalition (Bulgarian, Hungarian, Romanian, Finnish, Italian, plus captured German heavies) at full parity with the other factions, with its own phase timing and doctrine. Infantry-heavy with late, tank-destroyer-led armor; the late-game heavy tier is dropped since its only heavies are two rare captured vehicles.
- Recomputed every unit's unlock time directly from RobZ's own cooldown/fore fields instead of the drift-prone hand-written comments, so spawn timing tracks the real data.
- Fixed the SS Panther and Tiger unlock times, which were transposed (Panther was arriving too early, Tiger too late).

v1.2.0
- Tank destroyers now escort the main assault group and follow its target instead of overwatching a rear flag.
- Obsolete tank destroyers (open-top or gun-superseded) retire from the spawn pool when their armored or better-gunned successor unlocks, extending the existing weak-gun medium-tank retirement.
- Losing-side manpower discipline: when behind on flags the bot banks manpower for real armor instead of downgrading to cheap tanks that die, and cuts artillery upkeep.
- Fixed 9 more ger_ss vehicle IDs (Panzer IV, Panther, Tiger, StuG III/IV and light vehicles) that silently failed to spawn, which had frozen the SS main assault group mid-match.
- Best-gun selection: when the enemy fields tanks, the spawn picker weights toward the highest-penetration unit available in the current tier, drawn from RobZ's own gun-penetration data.
- Added the SdKfz 234/2 Puma (5cm) to the German and Waffen-SS rosters to close the mid-game anti-armor gap before the Panzer III/IV 5cm unlocks.

v1.1.0
- Added faction composition bias: each faction guarantees a minimum field count for a signature unit category, layered on top of the existing composition ratio.
- Fixed a spawn-confirmation desync that could misattribute one squad's confirmation to a different in-flight spawn and corrupt tier-ratio accounting.
- Fixed a freshly-created group being deleted instead of retried after a failed first fill, which could strand the bot on capper trickle alone for up to about 90s at match start.
- Fixed a pending-spawn-count leak on lost spawn confirmations that could wedge a group's fill slot.
- Corrected several ger_ss support-vehicle IDs that silently failed to spawn (100% failure), added the missing SdKfz 251/10 and LSSAH mechanized infantry entry.
- Mortars now have their own dedicated keep-alive trickle instead of competing untracked in the shared support pool.

v1.0.0
- Initial release: phase-based wave spawning, frontier-first group targeting, dedicated keep-alive trickles for support units/assault guns/artillery, late-game heavy-tank affordability guard, crash-safe unit cap.

Built on cbyyy2013's Better AI and frontlines AI concepts.
