An open source re-implementation of Stronghold Crusader 1. The beloved Castle Building, Real Time Strategy, and Simulation game remastered.
This reimplementation requires you to own a legal copy of the original Stronghold Crusader game from Firefly Studios.
The current method of installation is via the Unofficial Crusader Patch. Make sure to set that up first.
- Set up the Unofficial Crusader Patch.
- Download the latest release of the reimplementation from the Releases page of this repo.
- Launch the GUI from the Unofficial Crusader Patch.
- Drag and drop the zip file unto your open UCP3 GUI, or manually move the zip file into the
ucp/modulesfolder inside your game folder. - Reload the UCP3 GUI and activate the module.
- Disable Security in the Launch tab of the GUI.
- Launch the game!
Note that the goal is to recreate the game. So if there are no changes compared to vanilla, then it is exactly like intended.
Raise an issue here on GitHub to receive support. Or visit the Discord server.
The development of this reimplementation is a stepwise process. All developers are welcome to contribute.
The development of this reimplementation primarily focuses on reimplementing functions and data structures of the original game. The game 1.41 Latin version of the Stronghold Crusader executable serves as the reference point (SHA hash: 012E9D55DAC04B23ED9A334C975D3A5B6287020B). To achieve this, a combination approach is used. The code has mechanisms in place to allow a compilation to both and executable and a DLL. The DLL is meant to be loaded by the UCP and only replace certain functions, while other calls would call into the games executable. This allows to reimplement one function after the other while still maintaining a runnable game.
We use reccmp to verify compatibility of reimplemented code and the original game.
Because the original game was compiled using an old compiler, you have to compile it using this compiler, which is included in the repository via a submodule.
- Stronghold Crusader 1.41 Latin. The Steam version is the easiest one to get, but any patched version will do. Make sure the installation uses a Latin version (English, German, etc).
- CMake with the minimum version 3.24.
- Python3
- A way to execute
clang-format - (Recommended) An IDE with CMake integration. The repository has been optimized for Visual Studio Code using the Microsoft C/C++ Extension Pack.
-
Clone the repository. Make sure to also pull the submodules to have the compiler included:
git clone --recursive https://github.com/sourcehold/OpenSHC.git
- Should NET Framework 3.5 be required, it can be easily installed on Windows 11 by running
mt.exe(from the MSVC1400 repo), Windows 11 will ask to install the right version.
- Should NET Framework 3.5 be required, it can be easily installed on Windows 11 by running
-
Create a softlink to the original game executable with the name
_originalby running softlink.bat. It will request the full path to the game folder. -
Setup the needed Python environment to run
reccmpfor binary comparison by running setup.bat in the reccmp/dll folder (or thesetup.batin the reccmp/exe folder if binary comparison on the reimplemented .exe file is preferred)
The build can be run using the dev tools of the preferred IDE or via the build scripts. Regardless, a CMake installation is required.
Visual Studio Code with the proper extensions only needs to open the folder and the targets can be chosen in the "CMake" menu. Additionally, it configures format-on-save and a debug target for the UCP3.
If the scripts are preferred, the following triggers a build using the scripts:
- Open a terminal.
- Navigate to this project folder
- Execute build.bat:
build.bat RelWithDebInfo
- Compare a function byte by byte to the OpenSHC.dll to check compilation:
reccmp/dll/run reccmp-reccmp --target STRONGHOLDCRUSADER --verbose 0x401000
If CMake is installed and not in PATH, for example if installed via Visual Studio, cmakew.bat can be used instead. It tries to detect a CMake installation and uses it.
Note that any code needs to be formatted properly using the provided clang-format. The way to do so it up to the developer. Many IDEs support it out of the box.
If any .cpp or .c files are added to the source code, they should be listed in one of the txt files in cmake/:
cmake/core-sources.txtcontaining the core sources to compile the project.cmake/pklib-sources.txtcontaining the source files for compiling the pklib dependency.cmake/openshc-sources.txtcontaining the files with reimplementations of the original game's functions.
You can also create a local only cmake/openshc-sources.txt.local file, which will be used instead of cmake/openshc-sources.txt if it exists, to allow faster tests.
Extending this files name in any way, like openshc-sources.txt.local.bak, will prevent it from being used, but it is still ignored by git. This allows to keep small local file lists.
The file build.bat exists for convenience. If you want more control, you can specify the following cmake options.
Build using cmake --build --preset RelWithDebInfo --target OpenSHC.dll will create the dll in build-RelWithDebInfo/DLL.
Build using cmake --build --preset RelWithDebInfo --target OpenSHC.exe will create the exe in build-RelWithDebInfo/EXE.
Build using cmake --build --preset RelWithDebInfo --target OpenSHC.dll.deploy will prepare the modules folder in the UCP setup of the bound SHC.
Build using cmake --build --preset RelWithDebInfo --target OpenSHC.exe.runnable will prepare the runtime folder of the exe to make it runnable.