Skip to content

External Static Files and Exporting the Game

DesirePathGames edited this page Jun 5, 2026 · 1 revision

External Files and Exporting the Game

By default, Godot embeds all static assets within the executable, or within .pck files. This is useful for making simple self contained games that are closed source. Slay the Robot however, places a strong emphasis on externalizing static assets such as data, images, and sound, and even scripts, to allow for easy end user modding support without requiring having access to a decompiled version of the game. As such, this creates additional steps when exporting your game.

To start, follow the standard guideline for Godot exporting. This is rather simple by doing Project -> Export -> Add, and then selecting the platform. Godot will typically allow you to download the export template in editor.

Then for each export template, you must go into Features -> Custom and add a tag called "exported". This is used by the framework to crudely differentiate a debug build from a production build, since other methods don't seem to actually work as intended at the time of writing. This allows FileHandler to then check whether to use the source code directory or the exported executables's directory.

Next, build the game for each platform and place the builds in their respective folders.

Finally, you'll need to copy your static assets (the folder called "external") to the executable's folder. This may take different forms depending on how you wish to handle external assets.

If you wish to expose data files to the players for modification and support modding, you must run FileLoader.export_read_only_data(), which you can do by uncommenting it in Global._ready() after you have populated the data. This will output any loaded data files, and each will be sorted into folders indicated by Global.SCHEMA[3]. This will output the JSON files into external/data/. You must then copy the entire external folder into the directory of the executable. Note that the export process will not overwrite existing files. You may change this behavior if you wish.

Disabling External Loads

If you DO NOT want to load external data files and make the game effectively unmoddable, simply delete the mod_list.json and mod_info.json files and comment out the FileLoader.load_read_only_data() call in Global._ready(). This will prevent the framework from loading any external data on game start. You'll need to write code to generate the relevant production data, done in GlobalProdDataGenerator.

Regardless of how data files are handled, images and sounds are loaded externally. If you want to disable this and completely embed all static assets, you will have to replace FileLoader.load_x() calls with standard Godot .load() calls across the framework.

Additionally, if you want to allow the loading of external data but you're concerned with dynamic loading of scripts for the sake of security, you may wish to disable external script loading. You can do this by going to FileLoader.load_read_only_data() and commenting out the portion of code that takes over script paths. This will prevent existing scripts from being overridden, as well as prevent new scripts from loading.

Clone this wiki locally