Getting Started: Compile The Code & Run Samples

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:

  1. 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
  2. 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’.
  3. 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.
  4. Click ‘Generate’ and open the project.
  5. 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:

cryengine-gamelauncher

Download Samples

  1. 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.
  2. Install and run the ‘CryEngine Game Launcher’.
  3. 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.

  1. 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.
  2. 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.
  3. 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.
  4. Copy the ‘GameSDK.cryproj’ from sample’s directory to engine’s directory and rename it to ‘game.cryproj’.
  5. 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:sys_crashrpt=1
    sys_crashrpt_server=http://crashreport.cryengine.com/crashrpt/crashrpt.php
    sys_crashrpt_appname=CE53
    sys_crashrpt_privacypolicy=https://www.cryengine.com/privacy

    r_FullScreen=0
    r_Width=1280
    r_Height=800

    This will force the GameLauncher to run in non-fullscreen with resolution 1280×800.

  6. 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’.
  7. Now, if you run the GameLauncher, a black screen will appear on the screen (as before).
  8. 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:

cryengine-airfield.png

Advertisement