I prepared the following post to give some information on how to compile and run the CryEngine.
Compile The Code
In this step, we want to get the code from the repository, compile, and run it. To be able to go through the following steps, you need to download and install:
- An IDE (I use Visual Studio 2017 Community which is free to use)
- Get the latest code from GitHub. There are several branches on GitHub repository. I recommend you to get the ‘stabilisation’ branch to do bug fixes and add new features.
git clone -b stabilisation https://github.com/CRYTEK/CRYENGINE.git
- Run CMake GUI. Point the source code to where the code is cloned (I call this $CLONED_REPO_DIR$). Point the build binaries to ‘$CLONED_REPO_DIR$/Solution64’ and press ‘Configure’. A menu will pop up and ask about target generator (generator in cmake terminology is identical to targeting IDE). I pick ‘Visual Studio 15 2017 Win64’.
- The default configuration is almost acceptable for the first build. We just need to add ResourceCompiler which is one of the options. Enable OPTION_RC to add this to the solution.
- Click ‘Generate’ and open the project.
- Build the project.
Now, we have the compiled version of CryEngine. GameLauncher is the only executable that the solution generates. The GameLauncher is able to launch cryprojects as a game. If the GameLauncher is set as the startup project and be started, a black screen will appear on the screen with some information about the performance and so on.
The resources for the engine are not yet in the format which it expects. We have to use the resource compiler to compile them. Open a command prompt and go to ‘$CLONED_REPO_DIR/Engine/EngineAssets$ directory. Run the following command to convert all the engine resources to (*.dds) format which engine expects it to be:
../../Tools/rc/rc.exe /recursive .
Now, you should be able to run the GameLauncher. It looks like the following image:
- Download CryEngine Launcher from https://www.cryengine.com/get-cryengine.
We mainly use the CryEngine launcher to get access to the store and download the samples.
- Install and run the ‘CryEngine Game Launcher’.
- Download CryEngine GameSDK Sample Project
Run The Samples with binaries
To run the samples, they need to be copied in ‘$CLONED_REPO_DIR$’ but as the samples may need lots space, I highly recommend you to use Hard Link Shell Extension to put junction or symbolic links.
To make sample loading and running, it is easier to get an already running engine using the CryEngine launcher and replace the files in the engine with the compiled version. To get a version of the engine, you can either get a stable version using CRYENGINE Launcher or you can download it from engine’s GitHub release page. After downloading either of them, you can open the samples with Sandbox in ‘bin’ folder but our goal is to run the projects with the GameLauncher that we compiled by yourself.
- Go to your CryEngine’s folder. Rename the bin to bin(org), and engine to engine(org). We’ll replace them with junctions to our compiled ones.
- Go to ‘$CLONED_REPO_DIR$’, right click on ‘bin’ and ‘engine’. Pick link source using hard link shell extension. Drop them as a junction in CryEngine’s folder.
- Now, it is time to add the assets of download samples to CryEngine’s folder. Similarly, pick link source of ‘Assets’ folder from the samples directory and drop it as a junction in CryEngine’s folder.
- Copy the ‘GameSDK.cryproj’ from sample’s directory to engine’s directory and rename it to ‘game.cryproj’.
- Create a new file in engine’s folder and call it ‘system.cfg’ (if it doesn’t exist) and copy the following text into it:
This will force the GameLauncher to run in non-fullscreen with resolution 1280×800.
- Right click on ‘GameLauncher’ project in visual studio. Go to Properties > Debugging and set the Command to ‘$ENGINE_DIRECTORY/bin/win_x64/GameLauncher.exe$’ and working directory to ‘$ENGINE_DIRECTORY/bin/win_x64’.
- Now, if you run the GameLauncher, a black screen will appear on the screen (as before).
- Press ` to open the console and write ‘map’ and press tab to see all the available maps. In GameSDK, there are four different maps: Airfield, Woodland, particles_showcase, and vr_demo. I usually use Airfield and Woodland for development. Type in ‘map airfield’ to open it. This will take a few minutes to load the level and compile the shaders. When the level is loaded, you will see updates to the scene while shaders are being compiled. When all the shaders are compiled, you should get a picture as follows: