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
fix(gameengine): pull Easy and Normal a step toward Hard
Olcay Seygan35cb4208a1a3
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex d8f4feb07..e26d00ca2 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -129,14 +129,14 @@ found and fixed — EA's own, not port damage.**- Which unit it trained next was a coin flip. It gathered the teams sharing the highest priority number in its data and picked one at random - not one line looked at what it was fighting. An opponent facing nothing but aircraft went on building tanks.- Now the priority is the start of a score, not the whole of it. What it can *see* you fielding weights the choice, and the weighing is the game's own arithmetic: for every unit it could build and every unit it sees you with, how many shots each needs to kill the other through its armour, how long it waits between them, and what each one costs. A Crusader shell does a tenth of its damage to a rifleman, so your Rebels get Gattlings and your Overlords get Tank Hunters, not whatever the script listed first. Stealth still pushes detectors up. It reads the same unit data the game fights with, so a mod's units are weighed correctly too.-- How much that weighs depends on the level, from nothing at all on Easy - which is what the game always did - to fully on Hard.+- How much that weighs depends on the level: nothing on Easy, which is what the game always did, about half on Normal, and the full weight on Hard.- Anti-air was the computer's oldest hole. It is closed.## Three difficulty levels, and none of them cheat- 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.-- Easy looks around and answers far too late. Medium reacts in time, saves its damaged units and goes out to take a second supply pile. 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.+- 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.- All three are in the network and online lobbies as well as skirmish, and the level the host picks is the level every machine at the table plays. A seat also keeps its name, its colour and its start position when the list refreshes, which it did not.diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/AI.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/AI.hindex 922faad36..a05f17ecb 100644--- a/GeneralsMD/Code/GameEngine/Include/GameLogic/AI.h+++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/AI.h@@ -146,8 +146,8 @@ public://-------------------------------------------------------------------------------------------------enum AISkillLevel{- AISKILL_EASY = 0, ///< slow and brave: looks around, but reacts far too late- AISKILL_MEDIUM, ///< + unit retreat, closest-target focus, expands on its own+ AISKILL_EASY = 0, ///< slow and brave: looks around, answers late, never retreats or counters+ AISKILL_MEDIUM, ///< half a counter, spends past 6000, unit retreat, expands on its ownAISKILL_BRUTAL, ///< the baseline: counters what you field, masses, no reaction delayAISKILL_COUNTdiff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AI.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AI.cppindex b2f530ee4..995c8294c 100644--- a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AI.cpp+++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AI.cpp@@ -1065,9 +1065,9 @@ Real AI::getAdjustedVisionRangeForObject(const Object *object, Int factorsToCons//-------------------------------------------------------------------------------------------------//-------------------------------------------------------------------------------------------------/** The ladder, from AI-ROADMAP.md D6. Three rungs, and each one is a sentence: Easy looks around- * and answers far too late, Medium reacts in time and expands on its own, Brutal is the AI played- * as well as it has been programmed to play. A rung that plays wrong is read as a column here- * rather than hunted through a switch(difficulty) somewhere.+ * and answers late, Medium reacts in time and expands on its own, Brutal is the AI played as well+ * as it has been programmed to play. A rung that plays wrong is read as a column here rather+ * than hunted through a switch(difficulty) somewhere.** Brutal is the baseline, not a bonus: every number in its row is what the code does when nothing* is held back, and the two rungs below it are handicaps on the AI's *decisions*.@@ -1089,11 +1089,19 @@ Real AI::getAdjustedVisionRangeForObject(const Object *object, Int factorsToCons* again for the roadmap's actual proposal, AIPlayer::chooseApproachLabel: of Center, Flank and* Backdoor, the approach with the least firepower this AI has seen along it.*- * scoutS maxSc react decis cntr mass ttk indiv team infl focus save harv expand guard hoard econ */+ * Easy and Medium were stepped toward that baseline on 2026-09-29, after Hard's extra buildings+ * opened a gap the two lower rungs could not cross. Easy looks every 75 seconds and re-decides+ * every 7, and its trucks follow the piles; it still never retreats, never counters and never+ * hurries a spend. Medium looks every 45 and re-decides every 3, counters at half weight, and+ * starts spending past 6000 instead of 10000. Massing, team retreat, the influence map, defended+ * expansions, extra buildings and tactical fighting stay on Hard, and the two measured columns+ * above were left where the matches put them.+ *+ * scoutS maxSc decis cntr mass ttk indiv team infl focus save harv expand guard hoard econ micro */static const AIDifficultyProfile s_defaultSkillLadder[ AISKILL_COUNT ] ={- /* Easy */ { 90.0f, 1, 10.0f, 0.00f, FALSE, 0.00f, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, 0, FALSE, FALSE },- /* Medium */ { 60.0f, 1, 5.0f, 0.25f, FALSE, 0.35f, TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, 10000, FALSE, FALSE },+ /* Easy */ { 75.0f, 1, 7.0f, 0.00f, FALSE, 0.00f, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, 0, FALSE, FALSE },+ /* Medium */ { 45.0f, 1, 3.0f, 0.50f, FALSE, 0.35f, TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, 6000, FALSE, FALSE },/* Brutal */ { 25.0f, 2, 1.5f, 1.00f, TRUE, 0.50f, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, 4000, TRUE, TRUE }};diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIPlayer.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIPlayer.cppindex 8077896a1..f7bbb835d 100644--- a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIPlayer.cpp+++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIPlayer.cpp@@ -2658,8 +2658,8 @@ Bool AIPlayer::selectTeamToBuild( void )// terms ride on top://// - how well the team answers what this AI can *see* the enemy fielding (B1), scaled by the- // rung's counterCompositionWeight - zero on the bottom two rungs, which is EA's behaviour- // exactly, up to one at the top;+ // rung's counterCompositionWeight - zero on Easy, which is EA's behaviour exactly, half+ // on Normal, and one on Hard;// - what this AI is trying to do (D8): an aggressive one leans towards attack teams, a// defensive one towards the teams the data flags as base or perimeter defence. A// preference, not a bonus - both spend the same money.