Skip to content
Tutorials Center
My learning

Topics

Lesson 30 of 36 ยท Export and Optimization

Exporting Your Game

Ship a Godot 4 game: export templates, export presets, feature tags, Windows, Linux, macOS, Web and Android exports, PCK files, resource filters, icons and signing, with Python stand-ins.

A game nobody can run is only a project folder. Exporting turns your project into something players can install or open: a Windows .exe, a macOS app, a Linux binary, a web page, an Android .apk or .aab, or an iOS build. Godot exports from the editor, or from the command line for automated builds.

Godot (and its export templates) cannot run on this site, so commands and settings are read-only; the Python blocks are stand-ins that model package contents and size. Next: profiling and performance.

What an export contains

A Godot export is the engine runtime (a precompiled "export template", with no editor) plus your project data packed into a .pck file (or embedded in the executable). The PCK holds your scenes, scripts, textures, audio and the imported versions of assets. The source images are not shipped, only the imported .ctex and similar files, plus the stripped project.binary.

flowchart LR
    P["Your project<br/>scenes, scripts, art"] --> I["Imported assets<br/>.godot/imported"]
    I --> PCK["game.pck"]
    T["Export template<br/>engine runtime"] --> EXE["game.exe"]
    PCK --> EXE
    EXE --> Out["Player's computer"]

The runtime and the packed data together make the game.

Step by step

  1. Install export templates: Editor > Manage Export Templates > Download and Install. The version must match your editor exactly (for example 4.4.1.stable).
  2. Add a preset: Project > Export > Add... and choose a platform. Each preset stores its own options in export_presets.cfg, which you should commit to version control (keep secrets such as keystore passwords out of it; Godot stores those in .godot/export_credentials.cfg).
  3. Set a main scene (Project Settings > Application > Run > Main Scene) and an icon (Application > Config > Icon, plus platform-specific icon fields).
  4. Choose what to export: all resources, selected scenes, or "all resources except..." with filters such as *.md, docs/*. Add non-resource files (JSON, CSV) in the filter field, because Godot only exports files it knows by default.
  5. Press Export Project and run the result on a clean machine.
Text
# command-line export from a build script (read-only example)
godot --headless --export-release "Windows Desktop" build/windows/mygame.exe
godot --headless --export-pack "Windows Desktop" build/mygame.pck

Use --export-debug for debug builds with the remote debugger. The preset names must match exactly.

Platform notes

  • Windows, Linux: simplest. Optionally embed the PCK into the exe. Customize the version info and icon (Godot uses rcedit on Windows). Sign the exe to reduce SmartScreen warnings.
  • macOS: produces a .app or .dmg. Public distribution needs an Apple Developer ID, code signing and notarization.
  • Web: produces .html, .js, .wasm, .pck. Serve it over HTTPS. Godot 4.3 and later export web builds that work without threads by default; threaded builds need the headers Cross-Origin-Opener-Policy: same-origin and Cross-Origin-Embedder-Policy: require-corp. The page must be served from a web server, not opened from the disk. Web games start slower (download size matters) and have no direct file system.
  • Android: install the Android SDK, a JDK and a debug keystore, set the paths in Editor Settings, and use the Gradle build for production. Release builds need your own keystore; Play Store uploads use .aab. Use the Mobile or Compatibility renderer and touch controls.
  • iOS: needs a Mac with Xcode; Godot exports an Xcode project.

Feature tags and conditional code

Godot adds feature tags you can check at run time: OS.has_feature("web"), "mobile", "windows", "debug", "release", "editor". Use them to hide a Quit button on the web, scale UI on mobile, or enable cheats only in debug builds. Project settings can have overrides per tag (display/window/size/width.mobile).

GDSCRIPT
func _ready() -> void:
	$QuitButton.visible = not OS.has_feature("web")
	if OS.has_feature("debug"):
		$DebugOverlay.show()
	print("Running from the editor: ", OS.has_feature("editor"))
Python Stand-in (Python, not Godot): resource filters decide what is packed

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

The JSON data file is packed only because the include filter names it; the docs and the README are left out. Godot's real rules include more cases (the .import sidecar files are used by the editor and replaced by imported data in the PCK), so use this as a mental model.

Download size and patches

Size matters, particularly on the web and mobile. The big wins are compressing textures (VRAM compression, Lossy WebP), converting audio to Ogg, deleting unused assets and building a custom export template that disables modules you do not use. DLC and updates can ship as extra PCK files loaded at run time with ProjectSettings.load_resource_pack("user://dlc1.pck"), which can override or add resources.

Python Stand-in (Python, not Godot): estimate texture memory and download size

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

The compression bits-per-pixel values are standard for the formats (BC7 is 8 bits per pixel, ASTC 8x8 about 2 bits); the PNG and WebP sizes are only illustrative, since real sizes depend on the picture.

Testing your export

Always run the exported build on a clean computer or VM: missing files, a wrong working path or a missing filter show up only there. Check user:// saves, window scaling, audio and gamepads. Test the release build, not only debug, and keep the .pdb or symbols to read crash reports. On the web, test in more than one browser. Our optimization guide covers what to do when performance is poor on the target device.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. What must match exactly when you install export templates?

    Templates are built from the same engine version as the editor; a mismatch is refused or misbehaves.
  2. 2. Where does Godot store the packed scenes, scripts and imported assets of an export?

    The PCK holds the game data; the runtime executable loads it.
  3. 3. How do you hide a Quit button only on the web build?

    Feature tags are evaluated at run time and let one project behave differently per platform.
  4. 4. Why does a Web export served from a local file fail?

    Use a local web server for testing and HTTPS in production.

Summary

  • An export is a runtime template plus your project in a PCK; templates must match the editor version.
  • Presets live in export_presets.cfg; filters decide which non-resource files are packed.
  • Windows and Linux are simplest; macOS needs signing and notarization, Android needs the SDK and keystores, Web needs a server and good compression.
  • Feature tags (web, mobile, debug, release) let one project adapt to every platform.
  • Test the release build on a clean machine.

Next: Profiling and Performance