Skip to content

Commit 42bc6b0

Browse files
authored
feat(gamelod): Implement 'Very High' system spec (#1629)
1 parent 9e42e59 commit 42bc6b0

File tree

10 files changed

+107
-13
lines changed

10 files changed

+107
-13
lines changed

Core/GameEngine/Include/Common/GameDefines.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,11 @@
8181
#endif
8282
#endif
8383

84+
// Overwrite window settings until wnd data files are adapted or fixed.
85+
#ifndef ENABLE_GUI_HACKS
86+
#define ENABLE_GUI_HACKS (1)
87+
#endif
88+
8489
#define MIN_DISPLAY_BIT_DEPTH 16
8590
#define DEFAULT_DISPLAY_BIT_DEPTH 32
8691
#define DEFAULT_DISPLAY_WIDTH 800 // The standard resolution this game was designed for

Generals/Code/GameEngine/Include/Common/GameLOD.h

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,18 +38,24 @@
3838

3939
enum ParticlePriorityType CPP_11(: Int);
4040

41-
#define MAX_LOD_PRESETS_PER_LEVEL 32 //number of hardware configs preset for each low,medium,high
41+
#define MAX_LOD_PRESETS_PER_LEVEL 32 //number of hardware configs preset for each low,medium,high,veryhigh
4242
#define MAX_BENCH_PROFILES 16
4343

4444
//Make sure this enum stays in sync with GameLODNames[]
4545
enum StaticGameLODLevel CPP_11(: Int)
4646
{
4747
STATIC_GAME_LOD_UNKNOWN=-1,
48+
4849
STATIC_GAME_LOD_LOW,
4950
STATIC_GAME_LOD_MEDIUM,
5051
STATIC_GAME_LOD_HIGH,
52+
STATIC_GAME_LOD_VERY_HIGH,
53+
5154
STATIC_GAME_LOD_CUSTOM, //make sure this remains last!
52-
STATIC_GAME_LOD_COUNT
55+
56+
STATIC_GAME_LOD_COUNT,
57+
STATIC_GAME_LOD_FIRST = 0,
58+
STATIC_GAME_LOD_LAST = STATIC_GAME_LOD_CUSTOM - 1,
5359
};
5460

5561
enum DynamicGameLODLevel CPP_11(: Int)
@@ -193,6 +199,7 @@ class GameLODManager
193199
BenchProfile m_benchProfiles[MAX_BENCH_PROFILES];
194200

195201
protected:
202+
void initStaticLODLevels();
196203
void applyStaticLODLevel(StaticGameLODLevel level);
197204
void applyDynamicLODLevel(DynamicGameLODLevel level);
198205
void refreshCustomStaticLODLevel(void); ///<grabs current globaldata values and makes them the custom detail setting.

Generals/Code/GameEngine/Source/Common/GameLOD.cpp

Lines changed: 33 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ static const char *const StaticGameLODNames[]=
7676
"Low",
7777
"Medium",
7878
"High",
79+
"VeryHigh",
7980
"Custom"
8081
};
8182
static_assert(ARRAY_SIZE(StaticGameLODNames) == STATIC_GAME_LOD_COUNT, "Incorrect array size");
@@ -231,13 +232,43 @@ GameLODManager::GameLODManager(void)
231232

232233
for (Int i=0; i<STATIC_GAME_LOD_CUSTOM; i++)
233234
m_numLevelPresets[i]=0;
235+
236+
initStaticLODLevels();
234237
};
235238

236239
GameLODManager::~GameLODManager()
237240
{
238241

239242
}
240243

244+
void GameLODManager::initStaticLODLevels()
245+
{
246+
// TheSuperHackers @info Initialize new system specs in this function when we cannot rely on new edits to GameLOD.ini.
247+
248+
StaticGameLODInfo& veryhigh = m_staticGameLODInfo[STATIC_GAME_LOD_VERY_HIGH];
249+
veryhigh.m_minFPS = 55;
250+
veryhigh.m_minProcessorFPS = 59;
251+
veryhigh.m_sampleCount2D = 6;
252+
veryhigh.m_sampleCount3D = 24;
253+
veryhigh.m_streamCount = 2;
254+
veryhigh.m_maxParticleCount = 5000;
255+
veryhigh.m_useShadowVolumes = TRUE;
256+
veryhigh.m_useShadowDecals = TRUE;
257+
veryhigh.m_useCloudMap = TRUE;
258+
veryhigh.m_useLightMap = TRUE;
259+
veryhigh.m_showSoftWaterEdge = TRUE;
260+
veryhigh.m_maxTankTrackEdges = 100;
261+
veryhigh.m_maxTankTrackOpaqueEdges = 25;
262+
veryhigh.m_maxTankTrackFadeDelay = 60000;
263+
veryhigh.m_useBuildupScaffolds = TRUE;
264+
veryhigh.m_useTreeSway = TRUE;
265+
veryhigh.m_useEmissiveNightMaterials = TRUE;
266+
veryhigh.m_textureReduction = 0;
267+
veryhigh.m_useFpsLimit = TRUE;
268+
veryhigh.m_enableDynamicLOD = TRUE;
269+
veryhigh.m_useTrees = TRUE;
270+
}
271+
241272
BenchProfile *GameLODManager::newBenchProfile(void)
242273
{
243274
if (m_numBenchProfiles < MAX_BENCH_PROFILES)
@@ -320,7 +351,7 @@ void GameLODManager::init(void)
320351
//Check if we're within 5% of the performance of this cpu profile.
321352
if (m_intBenchIndex/prof->m_intBenchIndex >= PROFILE_ERROR_LIMIT && m_floatBenchIndex/prof->m_floatBenchIndex >= PROFILE_ERROR_LIMIT && m_memBenchIndex/prof->m_memBenchIndex >= PROFILE_ERROR_LIMIT)
322353
{
323-
for (Int i=STATIC_GAME_LOD_HIGH; i >= STATIC_GAME_LOD_LOW; i--)
354+
for (Int i=STATIC_GAME_LOD_LAST; i >= STATIC_GAME_LOD_FIRST; i--)
324355
{
325356
LODPresetInfo *preset=&m_lodPresets[i][0]; //pointer to first preset at this LOD level.
326357
for (Int j=0; j<m_numLevelPresets[i]; j++)
@@ -456,7 +487,7 @@ StaticGameLODLevel GameLODManager::getRecommendedStaticLODLevel(void)
456487

457488
Int numMBRam=m_numRAM/(1024*1024);
458489

459-
for (Int i=STATIC_GAME_LOD_HIGH; i >= STATIC_GAME_LOD_LOW; i--)
490+
for (Int i=STATIC_GAME_LOD_LAST; i >= STATIC_GAME_LOD_FIRST; i--)
460491
{
461492
LODPresetInfo *preset=&m_lodPresets[i][0]; //pointer to first preset at this LOD level.
462493
for (Int j=0; j<m_numLevelPresets[i]; j++)

Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1836,12 +1836,18 @@ void OptionsMenuInit( WindowLayout *layout, void *userData )
18361836

18371837
// set the display detail
18381838
// TheSuperHackers @tweak xezon 24/09/2025 The Detail Combo Box now has the same value order as StaticGameLODLevel for simplicity.
1839+
// TheSuperHackers @feature xezon 24/09/2025 The Detail Combo Box now has a new options for "Very High".
18391840
GadgetComboBoxReset(comboBoxDetail);
1841+
#if ENABLE_GUI_HACKS
1842+
// TheSuperHackers @tweak xezon 24/09/2025 Show max 4 rows because with the original layout it cannot possibly show 5.
1843+
GadgetComboBoxSetMaxDisplay(comboBoxDetail, 4);
1844+
#endif
18401845
GadgetComboBoxAddEntry(comboBoxDetail, TheGameText->fetch("GUI:Low"), color);
18411846
GadgetComboBoxAddEntry(comboBoxDetail, TheGameText->fetch("GUI:Medium"), color);
18421847
GadgetComboBoxAddEntry(comboBoxDetail, TheGameText->fetch("GUI:High"), color);
1848+
GadgetComboBoxAddEntry(comboBoxDetail, TheGameText->FETCH_OR_SUBSTITUTE("GUI:VeryHigh", L"Very High"), color);
18431849
GadgetComboBoxAddEntry(comboBoxDetail, TheGameText->fetch("GUI:Custom"), color);
1844-
static_assert(STATIC_GAME_LOD_COUNT == 4, "Wrong combo box count");
1850+
static_assert(STATIC_GAME_LOD_COUNT == 5, "Wrong combo box count");
18451851

18461852
//Check if level was never set and default to setting most suitable for system.
18471853
if (TheGameLODManager->getStaticLODLevel() == STATIC_GAME_LOD_UNKNOWN)

Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DShaderManager.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2855,7 +2855,7 @@ StaticGameLODLevel W3DShaderManager::getGPUPerformanceIndex(void)
28552855
if (chipType >= DC_GEFORCE2)
28562856
detailSetting=STATIC_GAME_LOD_LOW; //these cards need multiple terrain passes.
28572857
if (chipType >= DC_GENERIC_PIXEL_SHADER_1_1) //these cards can do terrain in single pass.
2858-
detailSetting=STATIC_GAME_LOD_HIGH;
2858+
detailSetting=STATIC_GAME_LOD_VERY_HIGH;
28592859
}
28602860

28612861
return detailSetting;

GeneralsMD/Code/GameEngine/Include/Common/GameLOD.h

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,18 +38,24 @@
3838

3939
enum ParticlePriorityType CPP_11(: Int);
4040

41-
#define MAX_LOD_PRESETS_PER_LEVEL 32 //number of hardware configs preset for each low,medium,high
41+
#define MAX_LOD_PRESETS_PER_LEVEL 32 //number of hardware configs preset for each low,medium,high,veryhigh
4242
#define MAX_BENCH_PROFILES 16
4343

4444
//Make sure this enum stays in sync with GameLODNames[]
4545
enum StaticGameLODLevel CPP_11(: Int)
4646
{
4747
STATIC_GAME_LOD_UNKNOWN=-1,
48+
4849
STATIC_GAME_LOD_LOW,
4950
STATIC_GAME_LOD_MEDIUM,
5051
STATIC_GAME_LOD_HIGH,
52+
STATIC_GAME_LOD_VERY_HIGH,
53+
5154
STATIC_GAME_LOD_CUSTOM, //make sure this remains last!
52-
STATIC_GAME_LOD_COUNT
55+
56+
STATIC_GAME_LOD_COUNT,
57+
STATIC_GAME_LOD_FIRST = 0,
58+
STATIC_GAME_LOD_LAST = STATIC_GAME_LOD_CUSTOM - 1,
5359
};
5460

5561
enum DynamicGameLODLevel CPP_11(: Int)
@@ -194,6 +200,7 @@ class GameLODManager
194200
BenchProfile m_benchProfiles[MAX_BENCH_PROFILES];
195201

196202
protected:
203+
void initStaticLODLevels();
197204
void applyStaticLODLevel(StaticGameLODLevel level);
198205
void applyDynamicLODLevel(DynamicGameLODLevel level);
199206
void refreshCustomStaticLODLevel(void); ///<grabs current globaldata values and makes them the custom detail setting.

GeneralsMD/Code/GameEngine/Source/Common/GameLOD.cpp

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ static const char *const StaticGameLODNames[]=
7777
"Low",
7878
"Medium",
7979
"High",
80+
"VeryHigh",
8081
"Custom"
8182
};
8283
static_assert(ARRAY_SIZE(StaticGameLODNames) == STATIC_GAME_LOD_COUNT, "Incorrect array size");
@@ -233,13 +234,44 @@ GameLODManager::GameLODManager(void)
233234

234235
for (Int i=0; i<STATIC_GAME_LOD_CUSTOM; i++)
235236
m_numLevelPresets[i]=0;
237+
238+
initStaticLODLevels();
236239
};
237240

238241
GameLODManager::~GameLODManager()
239242
{
240243

241244
}
242245

246+
void GameLODManager::initStaticLODLevels()
247+
{
248+
// TheSuperHackers @info Initialize new system specs in this function when we cannot rely on new edits to GameLOD.ini.
249+
250+
StaticGameLODInfo& veryhigh = m_staticGameLODInfo[STATIC_GAME_LOD_VERY_HIGH];
251+
veryhigh.m_minFPS = 55;
252+
veryhigh.m_minProcessorFPS = 59;
253+
veryhigh.m_sampleCount2D = 6;
254+
veryhigh.m_sampleCount3D = 24;
255+
veryhigh.m_streamCount = 2;
256+
veryhigh.m_maxParticleCount = 5000;
257+
veryhigh.m_useShadowVolumes = TRUE;
258+
veryhigh.m_useShadowDecals = TRUE;
259+
veryhigh.m_useCloudMap = TRUE;
260+
veryhigh.m_useLightMap = TRUE;
261+
veryhigh.m_showSoftWaterEdge = TRUE;
262+
veryhigh.m_maxTankTrackEdges = 100;
263+
veryhigh.m_maxTankTrackOpaqueEdges = 25;
264+
veryhigh.m_maxTankTrackFadeDelay = 60000;
265+
veryhigh.m_useBuildupScaffolds = TRUE;
266+
veryhigh.m_useTreeSway = TRUE;
267+
veryhigh.m_useEmissiveNightMaterials = TRUE;
268+
veryhigh.m_useHeatEffects = TRUE;
269+
veryhigh.m_textureReduction = 0;
270+
veryhigh.m_useFpsLimit = TRUE;
271+
veryhigh.m_enableDynamicLOD = TRUE;
272+
veryhigh.m_useTrees = TRUE;
273+
}
274+
243275
BenchProfile *GameLODManager::newBenchProfile(void)
244276
{
245277
if (m_numBenchProfiles < MAX_BENCH_PROFILES)
@@ -322,7 +354,7 @@ void GameLODManager::init(void)
322354
//Check if we're within 5% of the performance of this cpu profile.
323355
if (m_intBenchIndex/prof->m_intBenchIndex >= PROFILE_ERROR_LIMIT && m_floatBenchIndex/prof->m_floatBenchIndex >= PROFILE_ERROR_LIMIT && m_memBenchIndex/prof->m_memBenchIndex >= PROFILE_ERROR_LIMIT)
324356
{
325-
for (Int i=STATIC_GAME_LOD_HIGH; i >= STATIC_GAME_LOD_LOW; i--)
357+
for (Int i=STATIC_GAME_LOD_LAST; i >= STATIC_GAME_LOD_FIRST; i--)
326358
{
327359
LODPresetInfo *preset=&m_lodPresets[i][0]; //pointer to first preset at this LOD level.
328360
for (Int j=0; j<m_numLevelPresets[i]; j++)
@@ -460,7 +492,7 @@ StaticGameLODLevel GameLODManager::getRecommendedStaticLODLevel(void)
460492

461493
Int numMBRam=m_numRAM/(1024*1024);
462494

463-
for (Int i=STATIC_GAME_LOD_HIGH; i >= STATIC_GAME_LOD_LOW; i--)
495+
for (Int i=STATIC_GAME_LOD_LAST; i >= STATIC_GAME_LOD_FIRST; i--)
464496
{
465497
LODPresetInfo *preset=&m_lodPresets[i][0]; //pointer to first preset at this LOD level.
466498
for (Int j=0; j<m_numLevelPresets[i]; j++)

GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1903,12 +1903,18 @@ void OptionsMenuInit( WindowLayout *layout, void *userData )
19031903

19041904
// set the display detail
19051905
// TheSuperHackers @tweak xezon 24/09/2025 The Detail Combo Box now has the same value order as StaticGameLODLevel for simplicity.
1906+
// TheSuperHackers @feature xezon 24/09/2025 The Detail Combo Box now has a new options for "Very High".
19061907
GadgetComboBoxReset(comboBoxDetail);
1908+
#if ENABLE_GUI_HACKS
1909+
// TheSuperHackers @tweak xezon 24/09/2025 Show max 4 rows because with the original layout it cannot possibly show 5.
1910+
GadgetComboBoxSetMaxDisplay(comboBoxDetail, 4);
1911+
#endif
19071912
GadgetComboBoxAddEntry(comboBoxDetail, TheGameText->fetch("GUI:Low"), color);
19081913
GadgetComboBoxAddEntry(comboBoxDetail, TheGameText->fetch("GUI:Medium"), color);
19091914
GadgetComboBoxAddEntry(comboBoxDetail, TheGameText->fetch("GUI:High"), color);
1915+
GadgetComboBoxAddEntry(comboBoxDetail, TheGameText->FETCH_OR_SUBSTITUTE("GUI:VeryHigh", L"Very High"), color);
19101916
GadgetComboBoxAddEntry(comboBoxDetail, TheGameText->fetch("GUI:Custom"), color);
1911-
static_assert(STATIC_GAME_LOD_COUNT == 4, "Wrong combo box count");
1917+
static_assert(STATIC_GAME_LOD_COUNT == 5, "Wrong combo box count");
19121918

19131919
//Check if level was never set and default to setting most suitable for system.
19141920
if (TheGameLODManager->getStaticLODLevel() == STATIC_GAME_LOD_UNKNOWN)

GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1813,7 +1813,7 @@ void GameLogic::startNewGame( Bool loadingSaveGame )
18131813

18141814
// If forceFluffToProp == true, removable objects get created on client only. [7/14/2003]
18151815
// If static lod is HIGH, we don't do force fluff to client side only (create logic side props, more expensive. jba)
1816-
Bool forceFluffToProp = TheGameLODManager->getStaticLODLevel() != STATIC_GAME_LOD_HIGH;
1816+
Bool forceFluffToProp = TheGameLODManager->getStaticLODLevel() < STATIC_GAME_LOD_HIGH;
18171817
if (TheGameLODManager->getStaticLODLevel() == STATIC_GAME_LOD_CUSTOM &&
18181818
TheGlobalData->m_useShadowVolumes) {
18191819
// Custom LOD, and volumetric shadows turned on - very high detail. So use logic props too. jba. [7/14/2003]

GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DShaderManager.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3125,7 +3125,7 @@ StaticGameLODLevel W3DShaderManager::getGPUPerformanceIndex(void)
31253125
if (chipType >= DC_GEFORCE2)
31263126
detailSetting=STATIC_GAME_LOD_LOW; //these cards need multiple terrain passes.
31273127
if (chipType >= DC_GENERIC_PIXEL_SHADER_1_1) //these cards can do terrain in single pass.
3128-
detailSetting=STATIC_GAME_LOD_HIGH;
3128+
detailSetting=STATIC_GAME_LOD_VERY_HIGH;
31293129
}
31303130

31313131
return detailSetting;

0 commit comments

Comments
 (0)