Skip to content

sourcehold/OpenSHC

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

71 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

OpenSHC

An open source re-implementation of Stronghold Crusader 1. The beloved Castle Building, Real Time Strategy, and Simulation game remastered.

Usage

Download and Install

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.

  1. Set up the Unofficial Crusader Patch.
  2. Download the latest release of the reimplementation from the Releases page of this repo.
  3. Launch the GUI from the Unofficial Crusader Patch.
  4. Drag and drop the zip file unto your open UCP3 GUI, or manually move the zip file into the ucp/modules folder inside your game folder.
  5. Reload the UCP3 GUI and activate the module.
  6. Disable Security in the Launch tab of the GUI.
  7. 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.

Help

Raise an issue here on GitHub to receive support. Or visit the Discord server.

Contribute

The development of this reimplementation is a stepwise process. All developers are welcome to contribute.

Approach

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.

Prerequisites

  1. 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).
  2. CMake with the minimum version defined in the CMakeLists.txt.
  3. Python3
  4. A way to execute clang-format
  5. (Recommended) An IDE with CMake integration. The repository has been optimized for Visual Studio Code using the Microsoft C/C++ Extension Pack.

Setup

  1. 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.
  2. Install the needed Python dependencies, mainly reccmp for binary comparison
    python -m pip install -r requirements.txt
  3. Create a softlink to the original game executable with the name _original by running softlink.bat. It will request the full path to the game folder.

Development

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:

  1. Open a terminal. If the Visual Studio CMake version is used, it needs to be the CMD developer command prompt.
  2. Navigate to this project folder
  3. Invoke vsvars32-portable.bat from the MSVC1400 in the developer command prompt session. Check with where cl.exe to see if it was successful: cl.exe and link.exe are supposed to be executed from your MSVC1400 folder. where cmake should point to your CMake installation.
  4. Execute build.bat:
    build.bat RelWithDebInfo
  5. Compare a function byte by byte to check compilation:
    reccmp-reccmp --target STRONGHOLDCRUSADER --verbose 0x401000

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.

Should any files be added to the source code in src/core or the ucp files in ucp, the cmake script create-include-lists.cmake needs to be rerun and the changed list files need to be committed.

About

An open source re-implementation of Stronghold Crusader

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published