Skip to content

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.

feat(gameengine): narrow the AI ladder back to three rungs

Olcay Seyganab1258f20ca0
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 9710f1c94..4b51b8260 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -47,7 +47,7 @@ found and fixed — EA's own, not port damage.**
- It never decided to expand. The machinery was all there - place a supply centre beside a pile, pick a pile worth taking, send a team to sit on it - and every piece of it only ran when a map script said so. An opponent that ran its starting piles dry simply stopped earning.
- It now goes and takes the money that is lying around, out of spare cash so the army never pays for it.
-- From Brutal up the expansion comes with a defence structure facing the enemy, placed in the same job. An undefended expansion is a gift.
+- On Brutal the expansion comes with a defence structure facing the enemy, placed in the same job. An undefended expansion is a gift.
- Measured: a third more army in the field and a quarter more money spent over the match.
## The computer spends its money
@@ -63,7 +63,7 @@ found and fixed — EA's own, not port damage.**
- Its teams fought to the last man. The word "retreat" appeared nowhere in the opponent's code - the single most visible thing that made it look stupid.
- It now measures the fight, not the health bar: how long its force lasts against how long it needs to finish yours. A unit at a fifth of its health that still out-damages what is shooting it stays; a full-health one being melted leaves. A health percentage gets both of those backwards.
-- Two levels. From Steady up, a unit that is personally finished pulls out of a fight its team is still winning. From Brutal up, the whole team breaks off when the exchange is lost. Easy never quits - that is part of what makes it easy.
+- Two levels of it. On Medium a unit that is personally finished pulls out of a fight its team is still winning. On Brutal the whole team breaks off when the exchange is lost. Easy never quits - that is part of what makes it easy.
- It only counts what it can see. An opponent that flinches from something it has not found is reading your unit list again.
- It weighs a fight by what is in it, not by who is nearby: only things that can shoot count, and buildings do not. Its own base is not a reason to feel safe and yours is not a reason to run.
- Its aircraft are left out of it. A retreat order was what took a parked jet off the runway, so while a fight raged near the airfield the whole wing took off, flew at the base, landed, and did it again every few seconds instead of ever reaching you. Aircraft already fly home on their own when the load is spent.
@@ -73,18 +73,17 @@ 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: air pushes anti-air up, stealth pushes detectors up, armour pushes anti-tank up. Its own data decides what counts as the answer to what, so a mod's units are read 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 Merciless.
+- How much that weighs depends on the level, from nothing at all on Easy - which is what the game always did - to fully on Brutal.
- Anti-air was the computer's oldest hole. It is closed.
-## Six difficulty levels, and none of them cheat
+## Three difficulty levels, and none of them cheat
-- Easy, Steady, Medium, Hard, Brutal, Merciless. Medium to Brutal used to be a cliff; the steps in between are where a player actually needs them.
+- Easy, Medium, Brutal, the three the game has always had. There were six for a while, with a rung either side of Medium and one above Brutal; they are gone again, and nothing above Brutal went with them - Brutal now plays what the top of that six-rung ladder played.
- 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.
-- Each step up switches on exactly one new thing, so you can say in a sentence what you get for climbing.
-- Measured, not asserted: Merciless beats Easy 15-0 over 32 headless matches with the seats swapped both ways, on twice the army and twice the spending.
-- The three new levels showed up in the lobby as "Closed" and lost their start position on the map every time the list refreshed. Both fixed. Easy is slow and brave. Steady saves its damaged units. Medium expands on its own. Hard counters your build. Brutal masses and commits. Merciless is the ceiling - everything on, no hesitation.
-- 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. It is Easy, Steady, Medium, Hard, Brutal, Merciless now, in the lobby, on the seat, in the game info panel and in the online browser alike.
-- All six are in the network and online lobbies too, not just skirmish. Those two only ever offered three, and a seat set to anything above Medium was sent to the other machines as Brutal - so a game meant to be played against Steady was played against Brutal by everyone at the table, host included. The seat list also drops down far enough to reach the bottom of it - it was still sized for the five entries the game shipped with, so the last levels were off the end of the list.
+- 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. Brutal 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.
+- Measured, not asserted: Brutal 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, Brutal 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.
- Making Easy easier means giving it worse decisions, never less money. That is the whole promise.
- The computer also picks a personality each match and keeps it: one plays for the attack, the other for the base. Same resources, spent differently.
@@ -522,6 +521,7 @@ found and fixed — EA's own, not port damage.**
- Every fix was proved by putting the bug back and watching the test fail.
- No debugger here: a crash symboliser, a sampling profiler, probes in live matches.
- Reverted and recorded: wide FOV, the whole group movement rework, tree shadows.
+- The six-rung difficulty ladder is back down to three. The three extra rungs were built, played and taken out again: a player picks a level once and wants to know what it means, and six names that each moved one switch was a worse answer to that than three that each describe an opponent. The machinery underneath is the same, so the levels are still tunable in the data files, and Brutal kept the top rung's numbers rather than the old Brutal ones.
- The three-piece command bar was reverted once, for having nowhere to put the painting of the bar, and is back now that the painting has been cut into three to match. Each piece is fitted by matching it against the artwork it was cut from rather than by eye: the eyeballed fit was four percent out, which nobody sees on the metal and everybody sees on the money readout.
- The opponent's decisions are argued with a number: 20 headless matches per change, same seeds, win rate and match length before and after.
- That caught two changes that looked right and measured catastrophic - a wave that waited jammed the whole production line, and a retreat rule that counted buildings as gunfire sent every attack home. Both showed up as twenty matches with zero kills.
diff --git a/GeneralsMD/Code/GameEngine/Include/Common/GameEngine.h b/GeneralsMD/Code/GameEngine/Include/Common/GameEngine.h
index dc3503417..fcf39bc8f 100644
--- a/GeneralsMD/Code/GameEngine/Include/Common/GameEngine.h
+++ b/GeneralsMD/Code/GameEngine/Include/Common/GameEngine.h
@@ -55,7 +55,7 @@ Int GameEngine_logicCatchupMaxFrames( Int logicFps );
A frame count cannot tell a cheap tick from an expensive one, and that is the whole difference
between the two situations the loop is in. Behind because the *renderer* hitched, the ticks are
- 2ms each and paying three of them costs nothing. Behind because eight Merciless AIs are all
+ 2ms each and paying three of them costs nothing. Behind because eight Brutal AIs are all
fighting at once, the ticks are 25ms each and paying three of them freezes the picture for 75ms
on top of the render - which is exactly the 91ms and 113ms frames measured on Twilight Flame.
diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/AI.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/AI.h
index d9cfb2a46..73544d64d 100644
--- a/GeneralsMD/Code/GameEngine/Include/GameLogic/AI.h
+++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/AI.h
@@ -134,21 +134,20 @@ public:
//-------------------------------------------------------------------------------------------------
-/** Six rungs of how well the AI plays. Deliberately NOT GameDifficulty, which stays at three
- * values: that enum answers "which scripts run" and is baked into every shipped map and .scb,
- * into the campaign's stat bonus tables and into network messages. This one answers "how well
- * does it play", and every rung of it plays by the player's rules - no income, build-rate, vision
- * or stat handicap at any level, in either direction. See AI-ROADMAP.md sections D6, D7 and D10.
+/** Three rungs of how well the AI plays. Deliberately NOT GameDifficulty, which carries the same
+ * three values for a different reason: that enum answers "which scripts run" and is baked into
+ * every shipped map and .scb, into the campaign's stat bonus tables and into network messages.
+ * This one answers "how well does it play", and every rung of it plays by the player's rules - no
+ * income, build-rate, vision or stat handicap at any level, in either direction. Keeping it a
+ * separate enum is what lets a rung be tuned in AI.ini without touching what a map's scripts do.
+ * See AI-ROADMAP.md sections D6, D7 and D10.
*/
//-------------------------------------------------------------------------------------------------
enum AISkillLevel
{
AISKILL_EASY = 0, ///< slow and brave: looks around, but reacts far too late
- AISKILL_STEADY, ///< + unit-level retreat, adaptive harvesters
- AISKILL_MEDIUM, ///< + closest-target focus, expands on its own
- AISKILL_HARD, ///< + counters what you field, groups fire together
- AISKILL_BRUTAL, ///< + masses before attacking, team retreat, defended expansions
- AISKILL_MERCILESS, ///< + influence-map attack lanes, no reaction delay
+ AISKILL_MEDIUM, ///< + unit retreat, closest-target focus, expands on its own
+ AISKILL_BRUTAL, ///< the baseline: counters what you field, masses, no reaction delay
AISKILL_COUNT
};
diff --git a/GeneralsMD/Code/GameEngine/Include/GameNetwork/GameInfo.h b/GeneralsMD/Code/GameEngine/Include/GameNetwork/GameInfo.h
index 5001276cc..4174838ad 100644
--- a/GeneralsMD/Code/GameEngine/Include/GameNetwork/GameInfo.h
+++ b/GeneralsMD/Code/GameEngine/Include/GameNetwork/GameInfo.h
@@ -47,15 +47,7 @@ enum SlotState
// fork: an opponent seat with nothing behind it - no AI is ever created for it and you take
// it over in game with Shift-Ctrl-T. Appended on purpose: the values above are written into
// save games and replays.
- SLOT_TAKEOVER,
-
- // fork: the three rungs that fill in the ladder between Easy, Medium and Brutal. Appended for
- // the same reason - never inserted. Each maps onto one of the three GameDifficulty values for
- // script gating (GameLogic::startNewGame); what they really select is the AISkillLevel, which is
- // what decides how well the AI plays. See AI-ROADMAP.md D6/D7.
- SLOT_STEADY_AI,
- SLOT_HARD_AI,
- SLOT_MERCILESS_AI
+ SLOT_TAKEOVER
};
enum
diff --git a/GeneralsMD/Code/GameEngine/Source/Common/CommandLine.cpp b/GeneralsMD/Code/GameEngine/Source/Common/CommandLine.cpp
index 4b28504c1..d7371a2df 100644
--- a/GeneralsMD/Code/GameEngine/Source/Common/CommandLine.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/Common/CommandLine.cpp
@@ -1033,24 +1033,16 @@ Int parseAIDifficulty(char *args[], int num)
if (TheWritableGlobalData && num > 1)
{
//
- // The six rungs of the ladder. Anything unrecognised is still the top rung, so a batch
- // script written before the ladder existed keeps meaning what it meant.
+ // The three rungs of the ladder. Anything unrecognised is still the top rung, so a batch
+ // script naming a rung that no longer exists gets the hardest AI rather than the easiest.
//
AsciiString difficulty = args[1];
if (difficulty.compareNoCase("easy") == 0)
TheWritableGlobalData->m_autoSkirmishAIState = SLOT_EASY_AI;
- else if (difficulty.compareNoCase("steady") == 0)
- TheWritableGlobalData->m_autoSkirmishAIState = SLOT_STEADY_AI;
else if (difficulty.compareNoCase("medium") == 0 || difficulty.compareNoCase("med") == 0)
TheWritableGlobalData->m_autoSkirmishAIState = SLOT_MED_AI;
- else if (difficulty.compareNoCase("hard") == 0)
- TheWritableGlobalData->m_autoSkirmishAIState = SLOT_HARD_AI;
- else if (difficulty.compareNoCase("brutal") == 0)
- TheWritableGlobalData->m_autoSkirmishAIState = SLOT_BRUTAL_AI;
- else if (difficulty.compareNoCase("merciless") == 0)
- TheWritableGlobalData->m_autoSkirmishAIState = SLOT_MERCILESS_AI;
else
- TheWritableGlobalData->m_autoSkirmishAIState = SLOT_MERCILESS_AI;
+ TheWritableGlobalData->m_autoSkirmishAIState = SLOT_BRUTAL_AI;
}
return 2;
}
@@ -1068,16 +1060,10 @@ Int parseAIDifficulty2(char *args[], int num)
AsciiString difficulty = args[1];
if (difficulty.compareNoCase("easy") == 0)
TheWritableGlobalData->m_autoSkirmishAIStateOdd = SLOT_EASY_AI;
- else if (difficulty.compareNoCase("steady") == 0)
- TheWritableGlobalData->m_autoSkirmishAIStateOdd = SLOT_STEADY_AI;
else if (difficulty.compareNoCase("medium") == 0 || difficulty.compareNoCase("med") == 0)
TheWritableGlobalData->m_autoSkirmishAIStateOdd = SLOT_MED_AI;
- else if (difficulty.compareNoCase("hard") == 0)
- TheWritableGlobalData->m_autoSkirmishAIStateOdd = SLOT_HARD_AI;
- else if (difficulty.compareNoCase("brutal") == 0)
- TheWritableGlobalData->m_autoSkirmishAIStateOdd = SLOT_BRUTAL_AI;
else
- TheWritableGlobalData->m_autoSkirmishAIStateOdd = SLOT_MERCILESS_AI;
+ TheWritableGlobalData->m_autoSkirmishAIStateOdd = SLOT_BRUTAL_AI;
}
return 2;
}
diff --git a/GeneralsMD/Code/GameEngine/Source/Common/RTS/Player.cpp b/GeneralsMD/Code/GameEngine/Source/Common/RTS/Player.cpp
index edd05882d..142944fea 100644
--- a/GeneralsMD/Code/GameEngine/Source/Common/RTS/Player.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/Common/RTS/Player.cpp
@@ -2697,7 +2697,7 @@ Bool Player::grantScience(ScienceType science)
//=============================================================================
AISkillLevel Player::getAISkillLevel(void) const
{
- return m_ai ? m_ai->getAISkillLevel() : AISKILL_MERCILESS;
+ return m_ai ? m_ai->getAISkillLevel() : AISKILL_BRUTAL;
}
AIRole Player::getAIRole(void) const
diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/ScoreScreen.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/ScoreScreen.cpp
index 208901195..fb81b99b7 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/ScoreScreen.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/ScoreScreen.cpp
@@ -1217,14 +1217,12 @@ static void updateSkirmishBattleHonors(SkirmishBattleHonors& stats)
const GameSlot *slot = TheGameInfo->getConstSlot(i);
if (slot->isAI() && !isSlotLocalAlly(TheGameInfo, slot))
{
- // the three new rungs count towards the medal of the tier they sit in, so the challenge
- // medals keep meaning what they meant before the ladder was widened
SlotState st = TheGameInfo->getConstSlot(i)->getState();
- if (st == SLOT_EASY_AI || st == SLOT_STEADY_AI)
+ if (st == SLOT_EASY_AI)
++numEasy;
- if (st == SLOT_MED_AI || st == SLOT_HARD_AI)
+ if (st == SLOT_MED_AI)
++numMedium;
- if (st == SLOT_BRUTAL_AI || st == SLOT_MERCILESS_AI)
+ if (st == SLOT_BRUTAL_AI)
++numBrutal;
}
else if (slot->isAI())
diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLLobbyMenu.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLLobbyMenu.cpp
index ef1d41bee..f959865cd 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLLobbyMenu.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLLobbyMenu.cpp
@@ -1221,8 +1221,8 @@ void WOLLobbyMenuUpdate( WindowLayout * layout, void *userData)
slot->setProfileID( resp.stagingRoom.profileID[i] );
slot->setPlayerTemplate( resp.stagingRoom.faction[i] );
slot->setColor( resp.stagingRoom.color[i] );
- // Every rung of the ladder, not the three the enum happened to start with: an online game
- // advertising a Steady or a Merciless seat used to show up in the browser as an empty one.
+ // Every AI seat the ladder has, asked in one place: an advertised seat this list did not
+ // recognise used to show up in the browser as an empty one.
if (IsAISlotState((SlotState)resp.stagingRoom.profileID[i]))
{
slot->setState((SlotState)resp.stagingRoom.profileID[i]);
diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AI.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AI.cpp
index 7fa5cff1a..2e6bbfe97 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AI.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AI.cpp
@@ -1026,9 +1026,13 @@ Real AI::getAdjustedVisionRangeForObject(const Object *object, Int factorsToCons
//-------------------------------------------------------------------------------------------------
//-------------------------------------------------------------------------------------------------
-/** The ladder, from AI-ROADMAP.md D6. Each rung switches on exactly one new capability and takes
- * one step off the reaction delay, so every rung's identity is a sentence and a rung that plays
- * wrong has exactly one new thing in it.
+/** 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.
+ *
+ * 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*.
*
* Read the columns down, not across: nothing here is money, build speed, vision or unit stats.
*
@@ -1054,11 +1058,8 @@ Real AI::getAdjustedVisionRangeForObject(const Object *object, Int factorsToCons
static const AIDifficultyProfile s_defaultSkillLadder[ AISKILL_COUNT ] =
{
/* Easy */ { 90.0f, 1, 15.0f, 10.0f, 0.00f, FALSE, 0.00f, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, 0 },
- /* Steady */ { 75.0f, 1, 10.0f, 8.0f, 0.00f, FALSE, 0.30f, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, 0 },
/* Medium */ { 60.0f, 1, 6.0f, 5.0f, 0.25f, FALSE, 0.35f, TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, 10000 },
- /* Hard */ { 45.0f, 2, 3.0f, 4.0f, 0.60f, FALSE, 0.40f, TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, 8000 },
- /* Brutal */ { 30.0f, 2, 1.0f, 2.0f, 0.85f, TRUE, 0.45f, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, 5000 },
- /* Merciless */ { 25.0f, 2, 0.0f, 1.5f, 1.00f, TRUE, 0.50f, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, 4000 }
+ /* Brutal */ { 25.0f, 2, 0.0f, 1.5f, 1.00f, TRUE, 0.50f, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, 4000 }
};
//-------------------------------------------------------------------------------------------------
@@ -1230,9 +1231,9 @@ Real aiCounterScore( const AIEnemyComposition &enemy, const AITeamCapability &te
const AIDifficultyProfile *AI::getDifficultyProfile( AISkillLevel level ) const
{
if( m_aiData == NULL )
- return &s_defaultSkillLadder[ AISKILL_MERCILESS ];
+ return &s_defaultSkillLadder[ AISKILL_BRUTAL ];
if( level < 0 || level >= AISKILL_COUNT )
- level = AISKILL_MERCILESS; // the baseline; a bad index must not read as a handicap
+ level = AISKILL_BRUTAL; // the baseline; a bad index must not read as a handicap
return &m_aiData->m_skill[ level ];
}
@@ -1264,7 +1265,7 @@ void AI::parseSkillLevel(INI *ini, void *instance, void* /*store*/, const void*
};
static const char *names[ AISKILL_COUNT ] =
- { "Easy", "Steady", "Medium", "Hard", "Brutal", "Merciless" };
+ { "Easy", "Medium", "Brutal" };
AsciiString name( ini->getNextToken() );
Int which = -1;
@@ -1274,9 +1275,8 @@ void AI::parseSkillLevel(INI *ini, void *instance, void* /*store*/, const void*
if( which < 0 )
{
- DEBUG_LOG(("AI.ini SkillLevel '%s' is not one of Easy/Steady/Medium/Hard/Brutal/Merciless\n",
- name.str()));
- which = AISKILL_MERCILESS; // parse it somewhere rather than throw the block on the floor
+ DEBUG_LOG(("AI.ini SkillLevel '%s' is not one of Easy/Medium/Brutal\n", name.str()));
+ which = AISKILL_BRUTAL; // parse it somewhere rather than throw the block on the floor
}
ini->initFromINI( &((TAiData*)instance)->m_skill[ which ], myFieldParse );
diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIPlayer.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIPlayer.cpp
index debbad728..f6eb0bd81 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIPlayer.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIPlayer.cpp
@@ -260,7 +260,7 @@ m_buildProbeOffset(0.0f),
m_scoutTimer(1),
m_retreatTimer(1),
m_expandTimer(1),
-m_skillLevel(AISKILL_MERCILESS),
+m_skillLevel(AISKILL_BRUTAL),
m_role(AIROLE_AGGRESSIVE)
{
for (Int scoutSlot = 0; scoutSlot < MAX_AI_SCOUTS; ++scoutSlot) {
@@ -327,7 +327,7 @@ m_role(AIROLE_AGGRESSIVE)
of them on the same logic frame - and kept doing so for the rest of the match, because each
re-arms with a fixed interval and so never drifts apart again.
- Measured on Twilight Flame with eight Merciless AI: doExpansion alone cost 15.4ms of a
+ Measured on Twilight Flame with eight top-rung AI: doExpansion alone cost 15.4ms of a
16.7ms frame, all of it landing on one frame a minute. Spread across the cycle it is under
6ms, and nothing runs any less often than it did. */
/* What is needed is only that the players land on *different* frames, not that they are spread
@@ -5008,7 +5008,7 @@ void AIPlayer::doScouting( void )
//
// A scout that has just been sent somewhere is left alone for this rung's scouting interval.
// This is the ladder's honest perception knob: every rung scouts, they differ in how diligently.
- // Ninety seconds between legs on Easy is a scout that wanders; twenty-five on Merciless is one
+ // Ninety seconds between legs on Easy is a scout that wanders; twenty-five on Brutal is one
// that keeps the map current.
//
if( ordered )
diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AISkirmishPlayer.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AISkirmishPlayer.cpp
index d3394f1e8..45d1846a5 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AISkirmishPlayer.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AISkirmishPlayer.cpp
@@ -500,7 +500,7 @@ Int AISkirmishPlayer::getMyEnemyPlayerIndex(void) {
* are. Fog-masked, so it is somewhere this AI has actually seen; FALSE means it has not looked
* yet and the caller keeps the old aim point.
*
- * Off below the top rung: this is what Merciless adds.
+ * Off on every rung, deliberately - see the note on useInfluenceMapForAttackLane in AI.cpp.
*/
//----------------------------------------------------------------------------------------------------------
Bool AISkirmishPlayer::influenceMapAttackGoal( Coord3D *goal )
diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp
index 3f102b994..500d9f4c3 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp
@@ -1425,30 +1425,21 @@ void GameLogic::startNewGame( Bool loadingSaveGame )
{
d.setBool(TheKey_playerIsSkirmish, true);
//
- // Two answers from one seat. skirmishDifficulty stays a GameDifficulty, because that
- // is what gates the scripts baked into every shipped map and .scb; skirmishAISkill is
- // the rung of the six-step ladder, which is what decides how well the AI plays.
- // See AI-ROADMAP.md D7.
+ // Two answers from one seat. skirmishDifficulty is a GameDifficulty, because that is
+ // what gates the scripts baked into every shipped map and .scb; skirmishAISkill is
+ // the ladder rung, which is what decides how well the AI plays. The two carry the
+ // same three steps and are still not the same question. See AI-ROADMAP.md D7.
//
switch (slot->getState()) {
case SLOT_EASY_AI:
d.setInt(TheKey_skirmishDifficulty, DIFFICULTY_EASY);
d.setInt(TheKey_skirmishAISkill, AISKILL_EASY); break;
- case SLOT_STEADY_AI:
- d.setInt(TheKey_skirmishDifficulty, DIFFICULTY_EASY);
- d.setInt(TheKey_skirmishAISkill, AISKILL_STEADY); break;
case SLOT_MED_AI:
d.setInt(TheKey_skirmishDifficulty, DIFFICULTY_NORMAL);
d.setInt(TheKey_skirmishAISkill, AISKILL_MEDIUM); break;
- case SLOT_HARD_AI:
- d.setInt(TheKey_skirmishDifficulty, DIFFICULTY_NORMAL);
- d.setInt(TheKey_skirmishAISkill, AISKILL_HARD); break;
case SLOT_BRUTAL_AI:
d.setInt(TheKey_skirmishDifficulty, DIFFICULTY_HARD);
d.setInt(TheKey_skirmishAISkill, AISKILL_BRUTAL); break;
- case SLOT_MERCILESS_AI:
- d.setInt(TheKey_skirmishDifficulty, DIFFICULTY_HARD);
- d.setInt(TheKey_skirmishAISkill, AISKILL_MERCILESS); break;
default: break; // no setting.
}
}
diff --git a/GeneralsMD/Code/GameEngine/Source/GameNetwork/GUIUtil.cpp b/GeneralsMD/Code/GameEngine/Source/GameNetwork/GUIUtil.cpp
index 3f9dec400..94ace1ae1 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameNetwork/GUIUtil.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameNetwork/GUIUtil.cpp
@@ -189,10 +189,9 @@ void ShowUnderlyingGUIElements( Bool show, const char *layoutFilename, const cha
/** Fill a lobby's player slot combo box with every seat it can offer.
*
* All three lobbies used to keep their own list. The LAN and online ones held five entries in
- * SlotState order and read the choice back as SlotState(position), so the ladder's three added
- * rungs - appended to the enum, hence out of that order - could not be offered there at all: a
- * network game had Easy, Medium and Brutal and nothing else. Every entry now carries the state
- * it stands for and the position it sits at means nothing. */
+ * SlotState order and read the choice back as SlotState(position), so a seat appended to the enum
+ * - the takeover seat - could not be offered there at all. Every entry now carries the state it
+ * stands for and the position it sits at means nothing. */
void PopulatePlayerSlotComboBox(GameWindow *comboBox, Int color, Bool allowTakeover)
{
if (!comboBox)
@@ -205,11 +204,8 @@ void PopulatePlayerSlotComboBox(GameWindow *comboBox, Int color, Bool allowTakeo
SLOT_CLOSED,
SLOT_TAKEOVER,
SLOT_EASY_AI,
- SLOT_STEADY_AI,
SLOT_MED_AI,
- SLOT_HARD_AI,
SLOT_BRUTAL_AI,
- SLOT_MERCILESS_AI,
};
// The combo box only grows its listbox when an add crosses the current length, and both
diff --git a/GeneralsMD/Code/GameEngine/Source/GameNetwork/GameInfo.cpp b/GeneralsMD/Code/GameEngine/Source/GameNetwork/GameInfo.cpp
index 61e89826b..0b649b80a 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameNetwork/GameInfo.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameNetwork/GameInfo.cpp
@@ -202,10 +202,10 @@ void GameSlot::setMapAvailability( Bool hasMap )
/** Which slot states are an opponent seat.
*
- * This used to be written out as a list in three places, and appending the ladder's three rungs to
- * the enum broke two of them: the seat came back named "Closed" because setState's name switch
- * had no case for it, and its start position was wiped on every menu refresh because the guard
- * below did not recognise it as still being the same kind of seat. One function, three callers.
+ * This used to be written out as a list in three places and no two of them agreed, which cost a
+ * seat its name (it came back "Closed") and its start position (wiped on every menu refresh,
+ * because the guard below did not recognise it as still being the same kind of seat). One
+ * function, three callers.
*
* SLOT_TAKEOVER counts here on purpose: to the lobby it is an ordinary opponent seat that the
* host owns and that no network peer is expected to check in from. It differs in one place only
@@ -215,11 +215,8 @@ Bool IsAISlotState( SlotState state )
switch( state )
{
case SLOT_EASY_AI:
- case SLOT_STEADY_AI:
case SLOT_MED_AI:
- case SLOT_HARD_AI:
case SLOT_BRUTAL_AI:
- case SLOT_MERCILESS_AI:
case SLOT_TAKEOVER:
return TRUE;
default:
@@ -229,18 +226,15 @@ Bool IsAISlotState( SlotState state )
/** The one letter an AI seat is written as in the options string the host sends round.
*
- * 'E', 'M', 'H' and 'P' are what shipped, so they keep their meaning - 'H' is Brutal, from when
- * Brutal was the top rung and the menu called it Hard. The three rungs the ladder added take
- * free letters. Every seat that was none of the four went out as 'H', which is why picking
- * Steady or Merciless in the LAN or online lobby handed everybody a Brutal opponent instead. */
+ * 'E', 'M' and 'H' are EA's own and keep their meaning - 'H' is Brutal, from when the menu called
+ * that rung Hard. The takeover seat took a free letter. This is the whole table: a seat the
+ * host cannot write a letter for used to go out as 'H', which handed everybody at the table a
+ * Brutal opponent regardless of what the host had picked. */
static const struct { SlotState state; char code; } theAISlotCodes[] =
{
{ SLOT_EASY_AI, 'E' },
- { SLOT_STEADY_AI, 'S' },
{ SLOT_MED_AI, 'M' },
- { SLOT_HARD_AI, 'D' },
{ SLOT_BRUTAL_AI, 'H' },
- { SLOT_MERCILESS_AI, 'X' },
{ SLOT_TAKEOVER, 'P' },
};
@@ -271,14 +265,12 @@ Bool OptionsCharToSlotState( char c, SlotState *state )
/** What a seat is called wherever one is listed: the lobby's drop-down, the seat itself, the game
* info panel, the online browser's tooltip. Four switch statements used to answer this and no
- * two of them agreed - EA's shipped strings read "Easy Army" and "Medium Army" next to the
- * ladder's own "Steady AI" and "Merciless AI", so one drop-down offered both namings at once,
- * and "GUI:HardAI" sat on the Brutal rung in one file and on the Hard rung in another.
+ * two of them agreed, so the same rung read "Easy Army" in one list and "Easy AI" in the next,
+ * and "GUI:HardAI" sat on the Brutal rung in one file and somewhere else in another.
*
- * So the six rungs are named here, in one style, and none of them goes through the shipped
- * strings any more: three of the six never had one, and a ladder that reads half in EA's words
- * and half in ours reads like two different lists. Open, Closed and the takeover seat are not
- * rungs and keep their localised strings. */
+ * So the three rungs are named here, in one style, and none of them goes through the shipped
+ * strings any more. Open, Closed and the takeover seat are not rungs and keep their localised
+ * strings. */
UnicodeString SlotStateName( SlotState state )
{
switch( state )
@@ -286,11 +278,8 @@ UnicodeString SlotStateName( SlotState state )
case SLOT_OPEN: return TheGameText->fetch("GUI:Open");
case SLOT_TAKEOVER: return TheGameText->fetch("GUI:HumanSlot");
case SLOT_EASY_AI: return UnicodeString( L"Easy AI" );
- case SLOT_STEADY_AI: return UnicodeString( L"Steady AI" );
case SLOT_MED_AI: return UnicodeString( L"Medium AI" );
- case SLOT_HARD_AI: return UnicodeString( L"Hard AI" );
case SLOT_BRUTAL_AI: return UnicodeString( L"Brutal AI" );
- case SLOT_MERCILESS_AI: return UnicodeString( L"Merciless AI" );
case SLOT_CLOSED:
default: return TheGameText->fetch("GUI:Closed");
}
diff --git a/GeneralsMD/Code/GameEngine/Source/GameNetwork/GameSpy/PeerDefs.cpp b/GeneralsMD/Code/GameEngine/Source/GameNetwork/GameSpy/PeerDefs.cpp
index 1d02ce1b5..c4a94f92f 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameNetwork/GameSpy/PeerDefs.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameNetwork/GameSpy/PeerDefs.cpp
@@ -249,15 +249,6 @@ void GameSpyInfo::setGameOptions( void )
case SLOT_MED_AI:
playerName = "CM";
break;
- case SLOT_STEADY_AI:
- playerName = "CS";
- break;
- case SLOT_HARD_AI:
- playerName = "CD";
- break;
- case SLOT_MERCILESS_AI:
- playerName = "CX";
- break;
case SLOT_BRUTAL_AI:
playerName = "CH";
break;
diff --git a/GeneralsMD/Code/GameEngine/Source/GameNetwork/LANAPI.cpp b/GeneralsMD/Code/GameEngine/Source/GameNetwork/LANAPI.cpp
index 98ec707c2..a7ee326c4 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameNetwork/LANAPI.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameNetwork/LANAPI.cpp
@@ -988,14 +988,8 @@ AsciiString LANAPI::createSlotString( void )
//
if (slot->getState() == SLOT_EASY_AI)
str = "CE,";
- else if (slot->getState() == SLOT_STEADY_AI)
- str = "CS,";
else if (slot->getState() == SLOT_MED_AI)
str = "CM,";
- else if (slot->getState() == SLOT_HARD_AI)
- str = "CH,";
- else if (slot->getState() == SLOT_MERCILESS_AI)
- str = "CX,";
else
str = "CB,";
}
diff --git a/GeneralsMD/Code/Tests/test_gameengine.cpp b/GeneralsMD/Code/Tests/test_gameengine.cpp
index 61a7bcc53..989150fe7 100644
--- a/GeneralsMD/Code/Tests/test_gameengine.cpp
+++ b/GeneralsMD/Code/Tests/test_gameengine.cpp
@@ -759,7 +759,7 @@ TEST(logic_tick_is_wall_clock_paced_not_render_paced)
/* The count above cannot tell a cheap logic tick from an expensive one, and that is the whole
difference between the two situations the catch-up loop is ever in. Measured on Twilight Flame
- with eight Merciless AI: three 25ms ticks back to back with no picture in between is where the
+ with eight Brutal AI: three 25ms ticks back to back with no picture in between is where the
91ms and 113ms frames came from. So the loop is bounded by a clock as well. */
extern Bool GameEngine_mayStartAnotherCatchupTick( Int ticksSoFar, Int maxTicks, Real elapsedMsInLoop );
@@ -6616,10 +6616,11 @@ TEST(the_difficulty_ladder_climbs_in_every_direction_it_should)
CHECK( upper.m_defendExpansions >= lower.m_defendExpansions );
}
- // the ends of the ladder are what they say they are
+ // the ends of the ladder are what they say they are: Easy ignores what it is facing and Brutal
+ // is the baseline, which means it counters fully and answers the moment it sees something
CHECK_EQ( 0.0f, data.m_skill[ AISKILL_EASY ].m_counterCompositionWeight );
- CHECK_EQ( 1.0f, data.m_skill[ AISKILL_MERCILESS ].m_counterCompositionWeight );
- CHECK_EQ( 0.0f, data.m_skill[ AISKILL_MERCILESS ].m_reactionDelaySeconds );
+ CHECK_EQ( 1.0f, data.m_skill[ AISKILL_BRUTAL ].m_counterCompositionWeight );
+ CHECK_EQ( 0.0f, data.m_skill[ AISKILL_BRUTAL ].m_reactionDelaySeconds );
// every rung scouts. An AI that never looks reads as broken, not as easy.
for( Int i = 0; i < AISKILL_COUNT; ++i )
@@ -6715,8 +6716,8 @@ TEST(retreat_ratio_measures_the_exchange_not_the_health_bar)
//
// The ladder's thresholds mean what they say, and where they sit was measured rather than
- // guessed: at the roadmap's 0.8 a force quit a fight it was very nearly winning, and Merciless
- // lost 4-7 to Easy - which does not know how to retreat and simply kept shooting. They are
+ // guessed: at the roadmap's 0.8 a force quit a fight it was very nearly winning, and the top
+ // rung lost 4-7 to Easy - which does not know how to retreat and simply kept shooting. They are
// "clearly losing" numbers now. A force that lasts a third as long as the one it faces breaks
// off at every rung that retreats at all; one at parity never does.
//
@@ -6890,9 +6891,9 @@ TEST(massing_waits_for_a_force_but_never_waits_for_ever)
// the ladder turns it on at Brutal, which is the rung the roadmap puts it at
TAiData data;
- CHECK( !data.m_skill[ AISKILL_HARD ].m_massBeforeAttacking );
+ CHECK( !data.m_skill[ AISKILL_EASY ].m_massBeforeAttacking );
+ CHECK( !data.m_skill[ AISKILL_MEDIUM ].m_massBeforeAttacking );
CHECK( data.m_skill[ AISKILL_BRUTAL ].m_massBeforeAttacking );
- CHECK( data.m_skill[ AISKILL_MERCILESS ].m_massBeforeAttacking );
}
@@ -6958,7 +6959,7 @@ TEST(a_cash_hoard_shortens_the_wait_but_only_so_far)
CHECK_EQ( 75, aiHoardAdjustedDelay( 300, 200000, 5000 ) );
CHECK_EQ( 75, aiHoardAdjustedDelay( 300, 2000000, 5000 ) );
- // no threshold is the bottom two rungs, and is EA's behaviour: never hurry
+ // no threshold is the bottom rung, and is EA's behaviour: never hurry
CHECK_EQ( 300, aiHoardAdjustedDelay( 300, 999999, 0 ) );
// a delay never goes to zero, or the AI would try to build on every frame
@@ -6968,9 +6969,8 @@ TEST(a_cash_hoard_shortens_the_wait_but_only_so_far)
// the ladder switches it on at Medium and tightens it as you climb
TAiData data;
CHECK_EQ( 0, data.m_skill[ AISKILL_EASY ].m_cashHoardThreshold );
- CHECK_EQ( 0, data.m_skill[ AISKILL_STEADY ].m_cashHoardThreshold );
CHECK( data.m_skill[ AISKILL_MEDIUM ].m_cashHoardThreshold > 0 );
- CHECK( data.m_skill[ AISKILL_MERCILESS ].m_cashHoardThreshold <
+ CHECK( data.m_skill[ AISKILL_BRUTAL ].m_cashHoardThreshold <
data.m_skill[ AISKILL_MEDIUM ].m_cashHoardThreshold );
}
@@ -7038,16 +7038,14 @@ TEST(walking_away_breaks_a_capture_but_turning_towards_it_does_not)
/* Every AI seat a lobby offers has to survive the trip to the other machines. The host writes the
slot list into one options string and every client reads it back; an AI seat is one letter in
- there, and the writer used to have four - E, M, P and "everything else is H" - while the enum had
- grown to seven states. Steady, Hard and Merciless all went out as H, so a LAN or online game
- that was set up against the rungs in between was played against Brutal on every machine, the
- host's included. These two functions are the one place the letters live now. */
+ there, and the writer used to be three letters plus "everything else is H", so any seat the
+ table did not name went out as Brutal on every machine, the host's included. These two
+ functions are the one place the letters live now, and this asserts the table is whole. */
TEST(every_ai_seat_survives_the_options_string_the_host_sends_round)
{
static const SlotState aiStates[] =
{
- SLOT_EASY_AI, SLOT_STEADY_AI, SLOT_MED_AI, SLOT_HARD_AI, SLOT_BRUTAL_AI, SLOT_MERCILESS_AI,
- SLOT_TAKEOVER
+ SLOT_EASY_AI, SLOT_MED_AI, SLOT_BRUTAL_AI, SLOT_TAKEOVER
};
const Int numAIStates = sizeof(aiStates)/sizeof(aiStates[0]);
@@ -7060,7 +7058,7 @@ TEST(every_ai_seat_survives_the_options_string_the_host_sends_round)
CHECK_EQ( (Int)aiStates[i], (Int)readBack );
}
- // and no two of them share one - the bug was six rungs sharing three letters
+ // and no two of them share one - the bug was several seats sharing one letter
for (Int a = 0; a < numAIStates; ++a)
for (Int b = a + 1; b < numAIStates; ++b)
CHECK_NE( SlotStateToOptionsChar( aiStates[a] ), SlotStateToOptionsChar( aiStates[b] ) );
@@ -7114,16 +7112,15 @@ TEST(text_keeps_growing_with_the_screen_instead_of_stopping_at_twice)
}
/* The lobby, the seat itself, the game info panel and the online browser's tooltip each carried
their own switch over the slot states, and no two agreed: EA's shipped strings read "Easy Army"
- and "Medium Army" while the rungs the ladder added were written "Steady AI" and "Merciless AI",
- so one drop-down offered a ladder named half one way and half the other - and "GUI:HardAI" sat
- on the Brutal rung in one file and on the Hard rung in another. SlotStateName is the only list
- now. (Only the AI rungs are checked here: Open, Closed and the takeover seat go through
- TheGameText, which no test has.) */
+ and "Medium Army" where another list wrote "Easy AI", so one drop-down offered a ladder named
+ half one way and half the other - and "GUI:HardAI" sat on the Brutal rung in one file and
+ somewhere else in another. SlotStateName is the only list now. (Only the AI rungs are checked
+ here: Open, Closed and the takeover seat go through TheGameText, which no test has.) */
TEST(every_ai_rung_is_named_the_same_way_as_every_other)
{
static const SlotState rungs[] =
{
- SLOT_EASY_AI, SLOT_STEADY_AI, SLOT_MED_AI, SLOT_HARD_AI, SLOT_BRUTAL_AI, SLOT_MERCILESS_AI
+ SLOT_EASY_AI, SLOT_MED_AI, SLOT_BRUTAL_AI
};
const Int numRungs = sizeof(rungs)/sizeof(rungs[0]);
@@ -7134,7 +7131,7 @@ TEST(every_ai_rung_is_named_the_same_way_as_every_other)
// a rung with no case of its own used to come back named "Closed"
CHECK( name.getLength() > 3 );
- // and one style for the lot: "Easy Army" beside "Steady AI" is what this is here to stop
+ // and one style for the lot: "Easy Army" beside "Medium AI" is what this is here to stop
// (CHECK_STR is narrow-char, and casting a WideChar* into it compares one byte and passes)
CHECK( wcscmp( name.str() + name.getLength() - 3, L" AI" ) == 0 );
}
diff --git a/ai-batch.ps1 b/ai-batch.ps1
index 8c9ce16cd..4c2f5c8b4 100644
--- a/ai-batch.ps1
+++ b/ai-batch.ps1
@@ -21,7 +21,7 @@
... then compare the two win rates.
.EXAMPLE
- .\ai-batch.ps1 -Runs 8 -Map "Twilight Flame" -Difficulty merciless -Exe generals_perf.exe
+ .\ai-batch.ps1 -Runs 8 -Map "Twilight Flame" -Difficulty brutal -Exe generals_perf.exe
A fixed map instead of a generated one, so the terrain and the unit load are the same in every
batch, and the PERF_TIMERS exe, so the run also prints where the frame went. That is the pair
of switches THREADING-ROADMAP.md section 0 is measured with.