Na początku, Godot nie posiadał możliwości eksportowania projektów. Deweloperzy musieli sami skompilować kod i zbudować program na każdą platformę osobno.
Kiedy coraz więcej programistów(a nawet nie-programistów) zaczęło z niego korzystać, nasza firma zaczęła realizować równocześnie więcej projektów, stało się jasne, że jest to wąskie gardło.
Distributing a game project on PC with Godot is rather easy. Drop
the Godot binary in the same directory as the
then compress the project directory and you are done.
It sounds simple, but there are probably a few reasons why the developer may not want to do this. The first one is that it may not be desirable to distribute loads of files. Some developers may not like curious users peeking at how the game was made, others may find it inelegant, and so on. Another reason is that the developer might prefer a specially-compiled binary, which is smaller in size, more optimized and does not include tools like the editor and debugger.
Finally, Godot has a simple but efficient system for creating DLCs as extra package files.
The same scenario on mobile platforms is a little worse. To distribute a project on those devices, a binary for each of those platforms is built, then added to a native project together with the game data.
This can be troublesome because it means that the developer must be familiarized with the SDK of each platform before even being able to export. While learning each SDK is always encouraged, it can be frustrating to be forced to do it at an undesired time.
There is also another problem with this approach: different devices prefer some data in different formats to run. The main example of this is texture compression. All PC hardware uses S3TC (BC) compression and that has been standardized for more than a decade, but mobile devices use different formats for texture compression, such as PVRTC (iOS) or ETC (Android).
Exporting from the command line¶
In production, it is useful to automate builds, and Godot supports this
--export-debug command line parameters.
Exporting from the command line still requires an export preset to define
the export parameters. A basic invocation of the command would be:
godot --export "Windows Desktop" some_name.exe
This will export to
some_name.exe, assuming there is a preset
called "Windows Desktop" and the template can be found. (The export preset name
must be written within quotes if it contains spaces or special characters.)
The output path is relative to the project path or absolute;
it does not respect the directory the command was invoked from.
The output file extension should match the one used by the Godot export process:
.zip(from all platforms) or
.dmg(only when exporting from macOS).
.appis not supported directly, although the generated ZIP archive contains an
Linux: Any extension (including none).
.x86_64is typically used for 64-bit x86 binaries.
You can also configure it to export only the PCK or ZIP file, allowing a single exported main pack file to be used with multiple Godot executables. When doing so, the export preset name must still be specified on the command line:
godot --export-pack "Windows Desktop" some_name.pck
It is often useful to combine the
--export flag with the
flag, so that you do not need to
cd to the project folder before running
godot --path /path/to/project --export "Windows Desktop" some_name.exe
See Samouczek wiersza poleceń for more information about using Godot from the command line.
PCK versus ZIP pack file formats¶
Each format has its upsides and downsides. PCK is the default and recommended format for most use cases, but you may want to use a ZIP archive instead depending on your needs.
Uncompressed format. Larger file size, but faster to read/write.
Not readable and writable using tools normally present on the user's operating system, even though there are third-party tools to extract and create PCK files.
Compressed format. Smaller file size, but slower to read/write.
Readable and writable using tools normally present on the user's operating system. This can be useful to make modding easier (see also Exporting packs, patches, and mods).
Due to a known bug, when using a ZIP file as a pack file, the exported binary will not try to use it automatically. Therefore, you have to create a launcher script that the player can double-click or run from a terminal to launch the project:
:: launch.bat (Windows) @echo off my_project.exe --main-pack my_project.zip # launch.sh (Linux) ./my_project.x86_64 --main-pack my_project.zip
Save the launcher script and place it in the same folder as the exported binary.
On Linux, make sure to give executable permissions to the launcher script using
chmod +x launch.sh.