Exporting packs, patches, and mods

    Examples of this include…

    • Downloadable Content: the ability to add features and content to one’s game.

    • Patches: the ability to fix a bug that is present in a shipped product.

    • Mods: grant other people the ability to create content for one’s game.

    These tools help developers to extend their development beyond the initial release.

    Godot enables this via a feature called resource packs (PCK files, with extension ).

    Advantages:

    • incremental updates/patches

    • offer DLCs

    • offer mod support

    • more modular project structure

    The first part of using them involves exporting and delivering the project to players. Then, when one wants to add functionality or content later on, they just deliver the updates via PCK files to the users.

    PCK files usually contain, but are not limited to:

    • scripts

    • scenes

    • shaders

    • models

    • textures

    • sound effects

    • music

    • any other asset suitable for import into the game

    The PCK files can even be an entirely different Godot project, which the original game loads in at runtime.

    In order to pack all resources of a project into a PCK file open the project and go to Project/Export and click on “Export PCK/Zip”. Also make sure to have an export template selected while doing so.

    Another method would be to . If the output file ends with a PCK or ZIP file extension, then the export process will build that type of file for the chosen platform.

    Note

    If one wishes to support mods for their game, they will need their users to create similarly exported files. Assuming the original game expects a certain structure for the PCK’s resources and/or a certain interface for its scripts, then either…

    1. The developer must publicize documentation of these expected structures/ interfaces, expect modders to install Godot Engine, and then also expect those modders to conform to the documentation’s defined API when building mod content for the game (so that it will work). Users would then use Godot’s built in exporting tools to create a PCK file, as detailed above.

    To import a PCK file, one uses the ProjectSettings singleton. The following example expects a “mod.pck” file in the directory of the games executable. The PCK file contains a “mod_scene.tscn” test scene in its root.

    GDScript   C#

    1. private void YourFunction()
    2. {
    3. // This could fail if, for example, mod.pck cannot be found.
    4. if (success)
    5. {
    6. var importedScene = (PackedScene)ResourceLoader.Load("res://mod_scene.tscn");
    7. }
    8. }

    Warning

    By default, if you import a file with the same file path/name as one you already have in your project, the imported one will replace it. This is something to watch out for when creating DLC or mods (solved easily with a tool isolating mods to a specific mods subfolder). However, it is also a way of creating patches for one’s own game. A PCK file of this kind can fix the content of a previously loaded PCK.

    To opt out of this behavior, pass as the second argument to .

    Note

    For a C# project, you need to build the DLL and place it in the project directory first. Then, before loading the resource pack, you need to load its DLL as follows: Assembly.LoadFile("mod.dll")