Building the Engine from Source Code

Overview

This guide aims to aid developers downloading the CRYENGINE source code from GitHub with getting set up and compiling the engine.

Prerequisites

This article assumes that you have the main CRYENGINE programming prerequisites referenced in Getting Started__.

While the engine itself can be built without any manual downloads, the Sandbox editor requires additional Proprietary Third-Party SDKs to be downloaded and made present in the Code/SDKs directory.

Downloading the Engine

If the associated engine version of the project between the original engine and custom engine differs, or, there have been significant changes to the code base of the custom engine, your project may fail to compile.

The CRYENGINE source code is hosted on GitHub - allowing anyone to access the source for the triple-A engine for free, and providing the ability for users to send improvements back to Crytek and the community.

To get started, open the repository in your web browser by clicking this link. Once open, click Clone or Download and then Open in Desktop to open the repository in the GitHub Desktop client.

The GitHub Desktop client should then pop up asking where you want to store your repository. Choose an appropriate location and wait for the download to finish.

Once finished, you should see the CRYENGINE repository in the GitHub Desktop client as pictured below.

As you may notice in the screenshot above, the default CRYENGINE branch is release. This branch represents the latest stable release of the engine. In total we currently have three branches:

  • release - Latest version
  • stabilisation - Feature locked version of the next update, once we enter the bug fixing phase
  • main - The main development branch, this is where daily changes are checked in as work on the next update progresses. This branch can be very unstable at times and is not recommended for use in production.

If you are looking for a specific revision, such as the latest preview release for example, you can choose this within the GitHub Desktop Client. Know that when changing the branch, you may need to clean your build directory before compiling again as the new files will not be tracked by Git.

Installing the latest Project Management System

Once you have successfully cloned the CRYENGINE repository you can then begin the installation process.

First we will want to install the latest project management system CryVersionSelector, this is recommended so that we can be sure we have the most up-to-date options and routines when, for example, right-clicking a project file. You can do this by executing the following file from your cloned repository: Tools/CryVersionSelector/Install.bat

Generating the Visual Studio solution

By running cry_cmake.exe file we will first download the required Third-Party SDKs for the engine and then proceed to configure, generate and then open the Visual Studio solution file seamlessly.

Begin by running the mentioned cry_cmake.exe file in the root directory of your cloned CRYENGINE repository and select Download SDKs.

Once the download is finished you will be presented with a choice of which solution configuration to build. It is recommended to choose the 64bit (x64) configuration of whichever version you wish to use.

Once the next step is completed you should be presented with the CMake Configuration GUI. Here you can simply select Configure until there are no more red-highlighted options, then Generate and finally Open Project. Feel free to select the options you wish once you are more familiar with what they are.

You should now be able to compile the engine source code and run directly from within Visual Studio.

Registering your custom engine

It is a good idea to register this engine with the project manage system with a unique identifier. This will allow projects to be assigned to use this particular engine installation. The unique identifier should be unique for every unique file path you want to register with an engine.

To do this we will modify the cryengine.cryengine file in the CRYENGINE root directory.

You may open this file with your preferred Text editor. Notice at the top of this file there are default values defined for the id, name and version properties. For now we are only interested in the id and name properties.

For more information on the structure of this file, please refer to the Projects & Plugins document.

For our purposes we will add 'github' as a suffix to both values.

Simply save and close this file. Now we can easily register this engine in the project system by executing the cryengine.cryengine file. Alternatively you can right-click the modified file and choose Register engine. This will allow you to choose this engine in the drop-down menu displayed when using the Switch engine version option on a project.

Engine compilation notes

Notes:

  • Sandbox source code cannot be built in the release build configuration. This limitation only applies to the Sandbox project and related plugins.
  • Make sure that projects you run using your custom engine are designed for the version you are developing on. Interface changes between versions could cause compilation or runtime errors if there is a version mis-match.
  • Make sure when choosing certain options (ex. DX12) that you machine is compatible and required SDKs are installed correctly.