Menu
Lumberyard
Developer Guide (Version 1.11)

CryPak Details

Initialization

To ensure that .pak files can be accessed from game code at anytime, the CrySystem module initializes CryPak in CSystem::Init by calling the following functions:

  • InitFileSystem(startupParams.pGameStartup);

  • InitFileSystem_LoadEngineFolders();

Tip

A good spot to test game initialization is in inside Game.cpp at the beginning of CGame::Init.

Pak file type priorities

Whether CryPak processes files in the file system first, or files in .pak files first, depends on the value of pakPriority. The default value of pakPriority depends on the configuration settings of your build, but it can also manually be changed by assigning the cvar sys_PakPriority the values 0, 1, 2 or 3. The meaning of these values is show in the enum EPakPriority:

PakVars.h

Copy
enum EPakPriority { ePakPriorityFileFirst = 0, ePakPriorityPakFirst = 1, ePakPriorityPakOnly = 2, ePakPriorityFileFirstModsOnly = 3, };

The reason for adding the new pak file to the GameSDK folder in this example is because .pak files are loaded from the GameSDK path first. The loading order and search order of .pak file folders are as follows. Note that the loading order and the search order are the reverse of each other.

.pak file load order

  1. GameSDK: <root>\GameSDK\*.pak

  2. Engine: <root>\Engine\

    1. Engine.pak

    2. ShaderCache.pak

    3. ShaderCacheStartup.pak

    4. Shaders.pak

    5. ShadersBin.pak

  3. Mods: root\Mods\MyMod\GameSDK\*.pak (this assumes that you run the game with the command argument -mod "MyMod")

.pak file search order

  1. Mods If more than one mod folder exists, they will be checked in the reverse order in which they were added.

  2. Engine

  3. GameSDK