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): keep measurement switches out of network games
Olcay Seygan8eeac2209c95
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 619adef19..30143475e 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -845,6 +845,8 @@ found and fixed — EA's own, not port damage.**- The four together, on the same four battles: the average logic frame is a fifth shorter, the worst frame of a match went from 38.6 milliseconds to 16.0, frames over a sixtieth of a second went from 2 to none at all, and the number of frames costing more than 3 milliseconds fell from 14,105 to 3,360. In an eight-player 4v4 the average frame is a tenth shorter and the worst one went from 26.7 milliseconds to 17.9.- Putting a building on uneven ground froze the picture for a sixteenth of a second. Levelling the dirt under a foundation asked the game to re-light every blade of grass on the map - sixty-one milliseconds, measured, for a patch a few paces wide. It now redoes the patch. Over a seven-minute four-way battle that took the worst frame of the match from 82 milliseconds down to 19, and left nothing at all above a thirtieth of a second.+- The rest of the same mob. A mob is a leader and ten rioters, and a rioter only reconsiders where it is standing once every sixteen frames - but it was woken on all sixteen anyway, just to be sent back to sleep, and every mob on the map is eleven of those. EA left a note in the code asking for exactly this and never came back to it. The rioters sleep properly now, and one whose mob is dead stops being woken at all. Eight mobs on the field is eighty rioters: where all eighty were woken every frame, five are.+## Sound, video, and getting it to start at all- Audio is real, through the audio library the retail game ships with.@@ -886,6 +888,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.- A graphics fix is argued with pixels: an unattended match can now be told where to point the camera and which frame to photograph, so the two builds are compared by counting the pixels between them. The river above changed 126,535 of them and the eye had been calling it "about the same".+- A unit's cost is argued with the same army twice. An unattended match can now take its army from a text file - spawn eight of that unit there on frame thirty, send them across the map on frame six hundred, stop them on frame nine hundred - and be told which faction each seat plays and to leave every seat without a computer player behind it. Before that, whatever was on the field came out of the seed: measuring what angry mobs cost meant waiting for a match that happened to build some, and two runs that drew different sides were never comparable in the first place.- Reverted and recorded: wide FOV, the whole group movement rework, tree shadows out of a stencilvolume. That last one was a day spent proving the models cannot do it: a tree is a flat two-sidedsheet with no closed silhouette, so a palm threw its trunk and a leafy tree threw nothing. The@@ -953,6 +956,7 @@ found and fixed — EA's own, not port damage.**- A group is now as wide as the road it is on, and it works that out the whole way rather than once. The number of lanes was decided at the moment the order was given, from two measurements taken where the selection happened to be standing - so a dozen tanks leaving a base through a gate were handed one lane and drove the next thousand feet of open ground in single file, because nothing asked the question a second time. What the order hands out now is a place in the rank: which vehicle you are from the left, out of how many, at what spacing. How many of those ranks fit is answered every frame against the ground beside that vehicle. The column closes to single file in the gate, opens to six abreast on the far side, and closes again at the next gate, and none of it is a decision anybody makes. Widening asks for half a lane of room to spare before it takes a rank, which matters more than it sounds: the raw count is a floor of a measurement that wanders, a stretch of road a hair over five lanes wide reads five, four, five, four, and every flip renumbers the whole group and sends half of it half a lane sideways and back for the length of the road. Narrowing is immediate - when the ground is gone it is gone. The ceiling on how much road can be seen either side went up with it, from a hundred feet to a hundred and sixty, which is what every other width measurement in the game already used. Measured over thirty-eight battles: units left properly stuck fell from 6.0 a match to 1.3, and time spent standing still fell 2.4% with it.- None of the crowd was being measured, and the numbers written here for it were another rule's. A unit steers as part of a crowd only if it was handed a line across the road, a line is handed out only by the order a player gives to a selection, and a computer opponent never gives that order: it moves its teams one vehicle at a time. So every self-play batch run to argue about the crowd was driving the two rules that live in the collision code and none of the steering. The harness now has a switch that hands every army on the map one group order every twenty seconds, to alternating corners. The match it produces is nonsense and its result says nothing, but it multiplies the time units spend standing still by fourteen, from around 300 unit-frames a match to 4,200, which is the proof it is finally creating the traffic the crowd was written for.- With the traffic there, the crowd steering does not pay for itself. Thirty-nine battles paired map by map: time spent standing behind another unit 4,444 unit-frames a match with the rules off against 4,787 with them on, 7.7% worse, eleven maps better and twenty worse. The middle map moved by 19 unit-frames either way, so that average is four bad maps carrying thirty-five that barely noticed. What it does fix is the thing it was asked to fix. Units left properly stuck fell from 3.0 a match to 1.4, and the maps that moved are the pathological ones: 62 units wedged for good down to none, 35 down to none, 7 down to none. It creates new ones elsewhere, one map going from 5 to 34. The switch stays off, and what needs explaining now is the four maps, not the average.+- A network game now runs the shipped rules no matter what was typed to start it. Half a dozen switches exist so that the same build can be run twice and the two compared, and every one of them changes what a unit or the computer opponent decides: the crowd model, the three that put a piece of the movement back the way it shipped in 2003, how often a unit thinks, and the truce clock. Two players deciding differently is a match that comes apart on the first order rather than one that refuses the join, so online they are all off and the host's lobby settings are the only settings. Anyone who turned one on to look at it can still play with anyone who did not. A replay keeps whatever it was recorded with.- Since the first attempt at the band failed silently and passed every test it had, the band can now be drawn. A switch puts each moving unit's route on the ground in blue, the line it holds as a yellow mark sideways from the unit, and the offset that survived as a green mark from the route out to where the unit is actually aiming. The three failures that look identical from the camera - a line never given out, a line given out and dropped on the way, a line applied but too small to see - are three different pictures under it, and the same run writes them to the log as well.---diff --git a/GeneralsMD/Code/CMakeLists.txt b/GeneralsMD/Code/CMakeLists.txtindex 7a79d063f..1fb19f6b5 100644--- a/GeneralsMD/Code/CMakeLists.txt+++ b/GeneralsMD/Code/CMakeLists.txt@@ -449,10 +449,10 @@ target_link_libraries(gameenginedevice PUBLIC gameengine ww3d2 milesstub binkstuset(GENERATED ${CMAKE_CURRENT_BINARY_DIR}/generated)file(WRITE ${GENERATED}/BuildVersion.h"// Generated by CMake, standing in for Tools/buildVersionUpdate.\n"-"#define VERSION_STRING \"v0.1.0-alpha\"\n"+"#define VERSION_STRING \"v0.1.1-alpha\"\n""#define VERSION_MAJOR 0\n""#define VERSION_MINOR 1\n"-"#define VERSION_BUILDNUM 0\n")+"#define VERSION_BUILDNUM 1\n")file(WRITE ${GENERATED}/GeneratedVersion.h"// Generated by CMake, standing in for Tools/versionUpdate.\n""#define LOCAL_BUILD_STRING \"0\"\n"diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogic.cppindex 4bfdfe7f9..c29456d2c 100644--- a/GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp+++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp@@ -1151,6 +1151,24 @@ void GameLogic::startNewGame( Bool loadingSaveGame )TheWritableGlobalData->m_loadScreenRender = TRUE; ///< mark it so only a few select things are rendered during loadTheWritableGlobalData->m_TiVOFastMode = FALSE; //always disable the TIVO fast-forward mode at the start of a new game.+ /* Every switch below changes what a unit or the AI decides, and a decision that differs between+ two machines is a desync. None of them is in the INI checksum, so a player who types one joins+ a lobby like anyone else and the match comes apart on the first order instead of being refused+ at the door. They are measurement tools - the point of each is to run the same exe twice and+ compare - so a network game runs the shipped rules whatever the command line said. Replays are+ left alone: a replay recorded with a flag needs that flag to play back. Anything new that+ reaches GameLogic from the command line belongs in this list on the day it is written. */+ if (isInMultiplayerGame())+ {+ TheWritableGlobalData->m_crowdModel = FALSE; // -crowd+ TheWritableGlobalData->m_noFlowPath = FALSE; // -noflowpath+ TheWritableGlobalData->m_noLanePath = FALSE; // -nolanes+ TheWritableGlobalData->m_noMomentumPath = FALSE; // -nomomentum+ TheWritableGlobalData->m_aiSliceFrames = 1; // -aislice+ TheWritableGlobalData->m_groupDrill = 0; // -groupdrill+ TheWritableGlobalData->m_peaceTime = 0; // -peacetime, and the host's options string is read below+ }+m_showBehindBuildingMarkers = TRUE;m_drawIconUI = TRUE;m_showDynamicLOD = TRUE;