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(gameengine): medium ai spends its income and attacks smaller
Olcay Seygan35a2a15635ff
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 7ba0bbee3..d0e960999 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -207,7 +207,8 @@ found and fixed — EA's own, not port damage.**- The USA computer stops calling its wounded out of a firefight. A soldier still being shot at stays put, and one who has had two seconds' peace walks over from up to twice as far as before, since the hurt men who live through a fight end up well behind the Ambulance's old reach. In six Hard and six Medium matches between two USA computers on Twilight Flame, 14 were called in and none died within three seconds of the call, where 17 of 23 had; six were healed and walked out whole, three died on the walk four to nine seconds later, and four gave up the walk for a reason not yet known. Replays recorded before this change play out differently.- It comes at you from two sides. An attack big enough to be two sends a third of its strength down the second-quietest road, so you cannot meet the whole thing in one place.- It holds ground between attacks. Hard gathers its next wave a third of the way along the road to you, not in front of its own base, as long as nothing it has seen can shoot at that spot; otherwise it gathers at home.-- It builds its economy before it comes for you. No attack leaves a computer base in the opening minutes: six on Easy, five on Medium, four on Hard, and on Medium and Hard not before its first supply drop zone or black market stands, when it can build one. Medium and Easy now put that drop zone or black market up in the opening too, where only Hard did before. And it stops sending you two tanks at a time. A group too small to matter waits at home until enough has gathered to be an attack, about two tanks' worth on Easy, three and a half on Medium and five on Hard, even when the computer thinks it is winning. In one Hard against Hard match on Twilight Flame, the USA side's first attack left at six minutes instead of three and a quarter, after its drop zone, and the two sides sent 24 attacks instead of 47, 12 of them one to four units where 43 had been. Medium sent 9 instead of 19. Replays recorded before this change play out differently.+- It builds its economy before it comes for you. No attack leaves a computer base in the opening minutes: six on Easy, five on Medium, four on Hard, and on Medium and Hard not before its first supply drop zone or black market stands, when it can build one. Medium and Easy now put that drop zone or black market up in the opening too, where only Hard did before. And it stops sending you two tanks at a time. A group too small to matter waits at home until enough has gathered to be an attack, about two tanks' worth on Easy, two and a half on Medium and five on Hard, even when the computer thinks it is winning. In one Hard against Hard match on Twilight Flame, the USA side's first attack left at six minutes instead of three and a quarter, after its drop zone, and the two sides sent 24 attacks instead of 47, 12 of them one to four units where 43 had been. Medium sent 9 instead of 19. Replays recorded before this change play out differently.+- Medium spends what it earns. On a map with plenty of supplies its five supply centres bring in 300 a second by the middle of a match, and its plan's three factories spent a sliver of that: six Medium China games against Easy on Twilight Flame ended with 125,000 to 230,000 unspent, and Medium won one of the six inside 25 minutes. Medium now puts a quarter of its spare income into extra units, adds factories up to five once its bank passes three times what it means to keep, and sends a smaller group out on its own. The same six games went to Medium, all six.- Its artillery stays behind its tanks. Tomahawks, SCUD Launchers, Nuke and Inferno Cannons and Rocket Buggies walked in the same crowd as the rest of an attack, and the one that came round the corner first died to the first tank it met before its long gun was any use. Each one now keeps a little behind the attack's leading unit, farther on Hard than on Easy, and still fires at whatever comes into reach on the way. Replays recorded before this change play out differently.## The computer picks its fightsdiff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AI.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AI.cppindex d4c6a32d3..b6ed86532 100644--- a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AI.cpp+++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AI.cpp@@ -1140,11 +1140,20 @@ Real AI::getAdjustedVisionRangeForObject(const Object *object, Int factorsToCons* it. Against Medium it ended on 12,300 on average before and 1,600 after. HEADLESS BANK prints the* bank itself now.*+ * Medium's own hoard was real. On Twilight Flame its five supply centres earn 300 a second and more+ * by the middle of the match, and the plan's three factories with a tenth of it as surplus spent+ * little of that: six Medium China matches against Easy to frame 45,000 ended on 125,000 to 230,000+ * in the bank and Medium won one, the rest unfinished. So Medium now takes a quarter of its surplus,+ * puts up factories to five once the bank is past three times its target, and its minimum wave is+ * 2,000 rather than 3,000. The same six matches went 6-0 to Medium. Hard against Medium stayed+ * mostly unfinished at 45,000 on both builds, 1-0 with 5 draws before and 0-1 with 5 after, so a+ * Hard that cannot close out Medium is still open.+ ** scoutS maxSc decis cntr mass ttk indiv team infl focus save harv expand guard hoard econ micro gate answer massU bankS floor payoff upgr nonc share maxF fMult */static const AIDifficultyProfile s_defaultSkillLadder[ AISKILL_COUNT ] ={/* Easy */ { 75.0f, 1, 7.0f, 0.00f, FALSE, 0.00f, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, 0, FALSE, FALSE, FALSE, FALSE, FALSE, 120.0f, 6000, 4.0f, 720.0f, 0.05f, 0.05f, 3, 0.0f, 360.0f, 1500.0f, 80.0f, 0.00f },- /* Medium */ { 45.0f, 1, 3.0f, 0.50f, FALSE, 0.35f, TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, 6000, FALSE, FALSE, FALSE, FALSE, FALSE, 60.0f, 5000, 2.5f, 420.0f, 0.05f, 0.10f, 3, 0.0f, 300.0f, 3000.0f, 120.0f, 1.00f },+ /* Medium */ { 45.0f, 1, 3.0f, 0.50f, FALSE, 0.35f, TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, 6000, FALSE, FALSE, FALSE, FALSE, FALSE, 60.0f, 5000, 2.5f, 420.0f, 0.05f, 0.25f, 5, 3.0f, 300.0f, 2000.0f, 120.0f, 1.00f },/* Hard */ { 25.0f, 2, 1.5f, 1.00f, TRUE, 0.50f, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, 4000, TRUE, TRUE, TRUE, TRUE, FALSE, 30.0f, 4000, 1.5f, 180.0f, 0.05f, 1.00f, 8, 2.0f, 240.0f, 4500.0f, 160.0f, 0.25f }};diff --git a/GeneralsMD/Code/Tests/test_gameengine.cpp b/GeneralsMD/Code/Tests/test_gameengine.cppindex 9499ca19d..29eb53c60 100644--- a/GeneralsMD/Code/Tests/test_gameengine.cpp+++ b/GeneralsMD/Code/Tests/test_gameengine.cpp@@ -11887,13 +11887,14 @@ TEST(the_bank_target_and_the_upgrade_the_army_pays_for)CHECK( upper.m_minAttackPower > lower.m_minAttackPower && lower.m_minAttackPower > 0.0f );CHECK( upper.m_siegeTrail > lower.m_siegeTrail && lower.m_siegeTrail > 0.0f );}- // Hard alone builds past its plan, and with a bank past twice its target; Medium out-armies Easy and- // Hard out-armies Medium, which an equal share and cap for the two lower rungs had undone+ // Hard builds past its plan with a bank past twice its target, Medium only past a bigger multiple and+ // to a lower cap, Easy never; Medium out-armies Easy and Hard out-armies Medium, which an equal share+ // and cap for the two lower rungs had undoneCHECK( data.m_skill[ AISKILL_BRUTAL ].m_maxProduction > data.m_skill[ AISKILL_MEDIUM ].m_maxProduction );CHECK( data.m_skill[ AISKILL_BRUTAL ].m_factoryBankMultiple > 0.0f );- CHECK_EQ( 0.0f, data.m_skill[ AISKILL_MEDIUM ].m_factoryBankMultiple );+ CHECK( data.m_skill[ AISKILL_MEDIUM ].m_factoryBankMultiple > data.m_skill[ AISKILL_BRUTAL ].m_factoryBankMultiple );CHECK_EQ( 0.0f, data.m_skill[ AISKILL_EASY ].m_factoryBankMultiple );- CHECK( data.m_skill[ AISKILL_BRUTAL ].m_surplusShare >= 5.0f * data.m_skill[ AISKILL_MEDIUM ].m_surplusShare );+ CHECK( data.m_skill[ AISKILL_BRUTAL ].m_surplusShare >= 4.0f * data.m_skill[ AISKILL_MEDIUM ].m_surplusShare );// Easy fires the retail S curve; Medium drives the Particle Cannon's beam at walking pace, Hard// steers it often enough to count as the double click that drives it fastCHECK_EQ( 0.0f, data.m_skill[ AISKILL_EASY ].m_beamSteerSeconds );