Setting up Cryptography key(s)
Open a command prompt, and make
<root>/Tools/PakEncrypt the current directory.
This should create a
In your favorite C++ IDE open the generated
key.h file, and also the
<root>/Code/GameSDK/GameDll/GameStartup.cpp (or the same file in your game DLL).
Now find this line in the GameStartup file:
Make sure that
USE_RSA_KEY is set to 1.
Replace the key in
GameStartup.cpp with the key from the generated
Setting up CVar Whitelist
In the file
<root>/Code/GameSDK/GameDll/GameStartup.cpp there is a function:
Here, you can add/remove CVars that may be modified by the end-user (or via system.cfg etc).
Any CVar that is not listed will be fixed in it's default value when in Release mode.
To prevent trivial cheats, it may help to keep this list as small as possible.
However, think of the target machines of end-users and don't freeze quality CVars at too high quality levels.
Creating a Release Build
You should compile your code in the release configuration for your target platforms.
The files will be output to
Assets required by the game must be packaged into appropriate .pak files. In the simplest case, this can be achieved by zipping them and then changing the file extension. For more control over the process see Compiling Assets for Multiple Platforms.
After a release build, all assets must be inside a signed or encrypted .pakfiles.
The first test to see if your .pak files are satisfactory would be to run the non-release game after deleting all non-.pak files.
Collecting Files into Staging
ONLY copy the following files to a new folder that will contain all the files for the final version of your project (i.e. the distribution)
Files and folders marked in red should NOT be copied, they are provided just for completeness.
For the sake of an example, this will only show binaries for 64-bit Windows support. For 32-bit Windows and Linux support, substitute the appropriate platform instead of "win_x64" in the folder names below, e.g. win_x86 for 32-bit Windows or linux_x64_clang for Linux using Clang as the compiler. On Linux, note that some files will be named slightly differently (e.g. libXXX.so instead of XXX.dll).
|bin\win_x64_release\*||Exclude: *.pdb||Compiled from your game code|
|NEVER copy these folders!|
These files are debug/profile builds and not suitable for release.
Additionally, the Editor is included in bin\win_x64, which you cannot redistribute to end-users according to the EULA
|Shipped by Crytek in the Launcher package|
The exact list of .pak files will depend on how you organize your assets.
|<||Each level folder (e.g. Singleplayer/Woodland) may have:|
<LoadingScreen>.dds (if you have defined one)
Your exported levels
|The supported languages for which your project is localized|
|<all files and sub-folders>||These folders contain no end-user usable files, save some space by not shipping them|
The user folder should only have user-specific settings and will be regenerated automatically by the end-user
If you have settings that you expect all users to have, it is best to set them in code rather than ship a system.cfg.
|Do not ship these files: it will make it harder to identify if a log-file was user generated or not|
Additional files that are specific to your project may have to be added as well, in this case you must ensure they are added in the correct location and are loadable.
Consider putting those files inside a custom .pak file, this will allow you to leverage the existing signing/encryption features.
On re-distribution - Carefully consider any legal obligations that may apply on software and assets and make sure to read license agreements etc.
Signing/Encryption of Assets
Once you have your staging folder setup you need to either sign OR encrypt your asset .pak files.
Depending on your project you should therefore pick one of the following:
- Signed assets can be loaded by your project from the .pak files, and can also be opened with other tools (as a ZIP file)
However, the .pak file cannot be modified after it is signed (or the Engine will refuse to load the files)
- Encrypted assets can be loaded by your project from the .pak files, but cannot be opened with other tools.
Assets inside the .pak cannot easily be accessed because they are encrypted (but can be decrypted at run-time by the Engine)
Once you have decided what level of security you want:
- Pick an output folder for this project build.
- Open a command prompt and make
<root>/Tools/PakEncryptthe current directory (the same folder that has the
key.datfrom the one-time setup).
- Now run:
dist/ParseBuild/ParseBuild.exe <verb> "<full path to your staging folder>" "<full path to an output folder>"
- verb can be
encrypt, depending on the method that you picked.
- verb can be
Now the files from the staging folder will be copied from the staging folder to the output folder.
You can now delete the staging folder to recover some disk space.
Test and Redistribute
Now you can take the contents of the output folder and test or redistribute it.
You should in general make sure that your entire project works when you directly run any of the .exe that are in the output folder and without adding any additional files.
Testing this ensures that all your code and assets are present and functional for end-users.
Try to run the project on a variety of hardware configurations to find out the quality settings for your minimum advertised hardware specifications.
Sometimes it's hard to debug issues with Release builds, because code is optimized and assets may not be easily accessible.
Here are some pointers to isolate problems:
My Game doesn't run in Release Mode
Make sure that:
- You have your .pak files signed or encrypted
- You have the correct key set in the code
- The profile/debug version of the game runs with the same assets (and the same key)
My CVars don't work in Release Mode
Make sure that:
- The CVar in question is white-listed in your code
My Assets cannot be found in Release Mode
Make sure that:
- The asset exists in a .pak file, and the .pak file is in the list of .pak files to load in the code
- The .pak file containing the asset is signed or encrypted with the correct key
I get a lot of Warnings about "Non binary XML found"
This is not a fatal error. However, you can convert your XML files to binary XML using RC, see also Binary XML conversion
The conversion is recommended for an end-user distribution
I cannot Connect to a Dedicated Server
Please note that you should connect release clients with release servers. (Also, you should connect profile/debug clients with profile/debug servers)
I have some other Problem
The default value of log_severity in release builds are set quite low. Hence, to debug an issue, then it might make sense to set the default value to 3 or 4 to get more information and messages.
Note that unless you whitelist this CVar, then setting it in system.cfg will not actually work.