Zero Hour rebuilt from EA's source: x64, Direct3D 11, VS2022/CMake, ~60 original bugs fixed, an AI that builds a base. Bring your own game.
C++ cmakecnccommand-and-conquercppdirectx11game-enginegame-preservationgeneralsrtssage-enginex64zero-hour
feat(scripts): switch off the hard skirmish ai's free cash bonus
Olcay Seygandf8158949ea8
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 09ee105be..360d7f526 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -236,6 +236,7 @@ found and fixed — EA's own, not port damage.**- Easy, Medium, Hard, the three the game has always had. There were six for a while, with a rung either side of Medium and one above the top; they are gone again, and nothing above the top went with them - Hard now plays what the top of that six-rung ladder played. For a while the top rung was called Brutal on the seat list; it is Hard again, the name the box always printed.- Every level plays by your rules. No level gets extra money, cheaper units, faster building, longer vision or tougher units - in either direction. What changes is what the computer is allowed to decide: how often it looks at the map, how long it takes to react, whether it counters what you field, whether it masses before attacking, whether it pulls damaged units out.+- Hard used to break that promise without saying so. EA's skirmish scripts handed a Hard computer four free cash drops as the match went on, 10,000 early (5,000 for the GLA), another 10,000, then 15,000 and 20,000 late: up to 55,000 a game that no truck ever hauled. Every general had them. They are switched off, so Hard's bank is what its trucks and oil derricks bring in. The other grants in those scripts, the ones that pay for its first buildings, are untouched.- Easy looks around and answers late, a little sooner than it used to, and it sends its supply trucks to fit the piles. It never pulls a unit out, never builds against what you field, and stops once the opening base is up. Normal reacts a bit sooner, starts spending once the bank passes 6,000, where it used to wait for 10,000, and answers about half of what you field. A unit that is personally finished still leaves, and it still goes out for a second supply pile. Factories past the opening list stay a Hard behaviour. Hard is the opponent with nothing held back: no reaction delay at all, it builds against what it can see you fielding, it gathers an army before it commits it, and it takes a losing team off the field. Replays recorded before this change play out differently.- Measured, not asserted: Hard beats Easy 15-0 over 32 headless matches with the seats swapped both ways, on twice the army and twice the spending.- The ladder reads as one ladder wherever a seat is listed. Half of it was named in EA's old words - "Easy Army", "Medium Army" - and half in ours, in the same drop-down, because four separate lists answered "what is this seat called" and no two of them agreed. Every one of them says Easy AI, Medium AI, Hard AI now: the lobby, the seat itself, the game info panel and the online browser.diff --git a/GeneralsMD/Code/Data/Scripts/SkirmishScripts.scb b/GeneralsMD/Code/Data/Scripts/SkirmishScripts.scbindex 04875d423..331bd0892 100644Binary files a/GeneralsMD/Code/Data/Scripts/SkirmishScripts.scb and b/GeneralsMD/Code/Data/Scripts/SkirmishScripts.scb differdiff --git a/Tools/ScbTool/ai_bonus.py b/Tools/ScbTool/ai_bonus.pynew file mode 100644index 000000000..6520bb3ac--- /dev/null+++ b/Tools/ScbTool/ai_bonus.py@@ -0,0 +1,51 @@+"""Switch off the Hard skirmish AI's free "AI Bonus" cash.++Every player list in the retail file has four scripts in its "<Side> World State Detection" group,+"<Side> AI Bonus Early", "Mid", "Late" and "Really Late", Hard only, that wait for the _ESCALATION+counter to pass a threshold and then hand the AI 5,000 to 20,000 with PLAYER_GIVE_MONEY. This marks+all of them inactive. Nothing enables a script by those names, so they never run. The other grants+(base building, "Give AI money to cover bug") stay as they are.++usage: ai_bonus.py <in.scb> <out.scb>++The master is the retail file through opening.py H 1 4 5 6, then infantry_drop.py, then this.+"""+import sys++import scbtool++GROUP_SUFFIX = " World State Detection"+STAGES = ("Early", "Mid", "Late", "Really Late")+ACTIVE = 4+EXPECTED = 48+++def is_bonus(group, script):+ side = group[:-len(GROUP_SUFFIX)]+ return group.endswith(GROUP_SUFFIX) and script.fields[0] in [f"{side} AI Bonus {stage}" for stage in STAGES]+++def main():+ source, target = sys.argv[1], sys.argv[2]+ table, chunks = scbtool.load(source)+ list_chunk = next(chunk for chunk in chunks if chunk.name == "PlayerScriptsList")+ count = 0+ for index, script_list in enumerate(list_chunk.children):+ for group, script in scbtool.walk_scripts(script_list.children):+ if not is_bonus(group, script):+ continue+ actions = [child.fields[1] for child in script.children if child.name != "OrCondition"]+ if actions != ["PLAYER_GIVE_MONEY"]:+ raise SystemExit(f"[{index}] {script.fields[0]!r} does {actions}, not one PLAYER_GIVE_MONEY")+ if not script.fields[ACTIVE]:+ raise SystemExit(f"[{index}] {script.fields[0]!r} is already inactive; run this on infantry_drop.py's output")+ script.fields[ACTIVE] = 0+ count += 1+ if count != EXPECTED:+ raise SystemExit(f"found {count} AI Bonus scripts, expected {EXPECTED}")+ print(f"{count} AI Bonus scripts switched off")+ scbtool.save(target, table, chunks)+++if __name__ == "__main__":+ main()diff --git a/Tools/ScbTool/infantry_drop.py b/Tools/ScbTool/infantry_drop.pyindex 637206b98..bd08d1ac3 100644--- a/Tools/ScbTool/infantry_drop.py+++ b/Tools/ScbTool/infantry_drop.py@@ -10,7 +10,7 @@ disable renamed to match.usage: infantry_drop.py <in.scb> <out.scb>-The master is the retail file through opening.py H 1 4 5 6, then through this.+The master is the retail file through opening.py H 1 4 5 6, then through this, then ai_bonus.py."""import copyimport sys