Repository navigation
Merge Generals and Zero Hour code into one #555
Copy link
Copy link
Open
Labels
BuildAnything related to building, compilingAnything related to building, compilingUnifyUnifies code between Generals and Zero HourUnifies code between Generals and Zero Hour
Milestone
Description
Generals and Zero Hour share the vast majority of code, but do have functional differences. It would be great if we can unite both games into one code base, while still building two distinct executables off of it with the original functionalities for the respective games.
Move Game
- GameEngine file [CORE] Unify File System code and move files to Core #1279
- GameEngine xfer [CORE] Unify and move GameEngine's Xfer files to Core #821
- GameEngine string [CORE] Move AsciiString, UnicodeString files to Core #1328
- GameEngine bezier
- GameEngine video
- GameEngine audio [GEN][ZH] Unify and move Audio files to Core #1330
- GameEngine input
- GameEngine randnum unify(common): Move RandomValue files to Core #1388
- debug [CORE] Move debug and profile libraries from Zero Hour to Core #819
- profile [CORE] Move debug and profile libraries from Zero Hour to Core #819
Move WWVegas
- WW3D2 [CORE] Move many unified WW3D2 library files to Core #814
- WWAudio [CORE] Move WWAudio library files to Core #802
- WWDebug [CMAKE][CORE] Move WWLib and WWDebug to Core #663
- WWDownload Unify code of WWDownload library and move its files to Core #785
- WWLib [CMAKE][CORE] Move WWLib and WWDebug to Core #663
- WWMath [CMAKE][CORE] Move WWSaveLoad and most of WWMath to Core #694 [CORE] Unify remaining WWMath #745
- WWSaveLoad [CMAKE][CORE] Move WWSaveLoad and most of WWMath to Core #694
- wwshade (delete) [ZH] Remove the unused WWShade library #596
- Wwutil (delete) [GEN][ZH] Remove the unused Wwutil library #786
Move Tools
- assetcull [CORE] Move assetcull, mangler, wolSetup tools to Core #721
- Autorun Unify Autorun tool and move its files to Core #739
- Babylon [CORE] Move Babylon tool to Core #720
- buildVersionUpdate [CORE] Move buildversionUpdate, textureCompress, timingTest, versionUpdate tools to Core #707
- Compress [CMAKE][CORE] Move compression library and compress tool to Core #649
- CRCDiff [CMAKE][CORE] Move CRCDiff tool to Core #684
- DebugWindow [CORE] Move DebugWindow tool to Core #748
- GUIEdit
- ImagePacker [CORE] Move ImagePacker tool files to Core #747
- Launcher + DatGen Unify Launcher, DatGen tool and move their files to Core #741
- mangler [CORE] Move assetcull, mangler, wolSetup tools to Core #721
- MapCacheBuilder [CORE] Move MapCacheBuilder tool files to Core #749
- matchbot [CORE] Move matchbot tool to Core #706
- ParticleEditor unify(particlesys): Move ParticleSys and ParticleEditor files to Core #2212
- PATCHGET Unify PATCHGET tool and move its files to Core #746
- textureCompress [CORE] Move buildversionUpdate, textureCompress, timingTest, versionUpdate tools to Core #707
- timingTest [CORE] Move buildversionUpdate, textureCompress, timingTest, versionUpdate tools to Core #707
- versionUpdate [CORE] Move buildversionUpdate, textureCompress, timingTest, versionUpdate tools to Core #707
- W3DView [CORE][GEN] Sync WWAudio with Zero Hour, move w3dview files to Core and prepare w3dview target for Generals #709
- wdump
- wolSetup [CORE] Move assetcull, mangler, wolSetup tools to Core #721
- WorldBuilder
- WW3D (max2w3d, pluglib) [CMAKE][CORE] Move max2w3d to Core #696
Reactions are currently unavailable
Metadata
Metadata
Labels
BuildAnything related to building, compilingAnything related to building, compilingUnifyUnifies code between Generals and Zero HourUnifies code between Generals and Zero Hour
Activity
xezon commentedon Mar 31, 2025
Relevant chat Notes.
feliwir:
tomsons26:
tomsons26 commentedon Mar 31, 2025
GUIEdit - ZH's seems like a no compromise better version so Gen version can just be scrapped
Compression - has no diffs between the two so thats movable to common
WWAudio - the same in Gen and ZH
WWDownload - string differences need to be handled, otherwise same code in both
matchbot - use ZH's
MapCacheBuilder - use ZH's
mangler - use ZH's
launcher - code is same, just strings differ
ImagePacker - use ZH's
DebugWindow - use ZH's
CRCDiff - use ZH's
buildversionupdate - use ZH's
Autorun - code about same, resolve strings, use ZH's
andrew-2e128 commentedon Apr 1, 2025
Tested against VS2022,
here is a list of files that can be removed from
Code/Libraries/WWVegas/WWLibas they are not really used by the game:if anything complains about them, remove the include, and sometimes it keeps complaining in such a case it mostly wants a windows.h include (included it via win.h)
this list applies to GeneralsMD too (except
mixfile.cppandmixfile.h)also in ww3d2 remove the following 2 files :
txt.cpptxt.hthere is actually a lot more files that can be removed if we removed referenced code that is never actually called, but this will be a lot more work (I think there are a couple of big files like that)
note, I only focused on wwlib as it is where most of unused code is, most other modules are either mostly needed or completely unused; or might make sense to keep them for now until completely replaced (like wwmath)
xezon commentedon Apr 11, 2025
tomsons26:
tomsons26 commentedon Apr 14, 2025
Things that seem to be possible to make into libs of their own
xezon commentedon Apr 15, 2025
feliwir:
tomsons26:
xezon:
w3d_generals_zerohour_differences.txt
tomsons26:
OmniBlade:
tomsons26:
xezon commentedon Apr 15, 2025
If we want to commit to unifying the games, then I do think we need to merge as much as possible, even if that means changing a few things in Generals. Reason being, if the diff remains large and we touch classes and functions in Core, then the divergences of both Generals and Zero Hour would need to be accommodated for those Core changes, which could be a substantial amount of work forever going forward. Ideally only game specific components, like the Spectre Gunship, would be unique on one side.
But there is another problem. If data requirements for Zero Hour eventually diverge from Generals, then everything needs to be built to always keep supporting the legacy Generals data, for all eternity. But perhaps that needs to be done anyway, because of Community Mods. Aka we would not want to break some formats because it would break Mod compatibility. Otherwise, we would also need to maintain Generals data to migrate it to new code requirements and all customer Mods would need to do the same. That to say, maintaining compatibility to more than just pure Zero Hour will take way more effort now and in the long run. Are we ok with this?
xezon commentedon Apr 16, 2025
tomsons26:
xezon commentedon Apr 18, 2025
tomsons26
tecno14 commentedon Jun 8, 2025
I made a try to merge two game versions, I start from the original games files, upgrading dsp and dsw into vcxproj and sln, then using C# scripts merged the code in steps, I used variable definition to check if this compile is for Original (OG) or Zero Hour (ZH), used in code different only, like:
(some files have to be done manual (about 80 files) so I just repeated the full code to support the versions.
You can check the code after merge here:
https://github.com/tecno14/CnC_Generals_Zero_Hour
and tools that used here:
https://github.com/tecno14/CnC_Generals_Zero_Hour/tree/tools
Note:
All updated code meant : *.c, *.cpp and *.h files mainly and some other code files.
other type of files like bmp's, added manually (changed files only) and ZH version specified files changed the use of them in the code like the use of icon files.
I analyzed the files programmetly, to make sure no file or change get lost (but "dsp" and "dsw" just duplicate for now; ZH has it's own files in same OG folders).
TBH, some #ifdef location was inside multiline command, so needed to change manually, since I don't have build ready source code, I couldn't check if all done or still there left.
I used C# because I'm C# developer.
@xezon
yandi-banyu commentedon Nov 18, 2025
That's honestly one too many config to add. Either it needs a launcher or separate executable. Going by the original code, it already has separate exe, so maybe in the long run it could be unified with a launcher
stephanmeesters commentedon Jul 1, 2026
To estimate priority for unification, these are statistics of the most changed unmerged files over the last 1000 commits.
git_histograms.py