Skip to content

Packaging and Distribution

Wayward Crown offers two packaging methods to compile the game into directly distributable executables.


Method Comparison

Item PyInstaller Nuitka
Build speed Fast (seconds to minutes) Slow (5–15 minutes)
Runtime speed Same as Python Slightly faster (+5%–30%)
Source code protection .pyc can be decompiled Compiled to C, extremely hard to reverse
Distribution size Smaller Larger
C compiler required No Yes
Recommended use Development and testing Production releases

Prerequisites

pip install -r requirements.txt
python setup_ext.py build_ext --inplace   # Produces game/_ccore.*.pyd

The C extension must be compiled first; otherwise the game will fall back to a pure Python path (lower performance).


PyInstaller

Installation

pip install pyinstaller

Build Command

pyinstaller --noconfirm --clean --name WaywardCrown ^
    --noconsole ^
    --icon "assets/Icons/WaywardCrown.ico" ^
    --add-data "assets;assets" ^
    --add-data "game/content;game/content" ^
    --add-data "game/lang;game/lang" ^
    --add-data "plugins;plugins" ^
    --add-data "campaigns;campaigns" ^
    --add-data "maps;maps" ^
    --add-data "steam_sdk;steam_sdk" ^
    --add-data "THIRD_PARTY_LICENSES.md;." ^
    --add-data "LGPL-3.0.txt;." ^
    --add-data "GPL-3.0.txt;." ^
    --add-binary "game/_ccore.cp314-win_amd64.pyd;game" ^
    --hidden-import PySide6.QtWidgets ^
    --hidden-import PySide6.QtCore ^
    --hidden-import PySide6.QtGui ^
    --hidden-import PySide6.QtOpenGLWidgets ^
    --hidden-import PySide6.QtMultimedia ^
    --hidden-import OpenGL.GL ^
    main.py

Output

dist/WaywardCrown/
├── WaywardCrown.exe
└── _internal/
    ├── assets/
    ├── game/
    │   ├── _ccore.cp314-win_amd64.pyd
    │   ├── content/
    │   └── lang/
    ├── campaigns/
    ├── maps/
    └── plugins/

Nuitka

Installation

pip install nuitka zstandard ordered-set

Requires a C compiler (Visual Studio Build Tools or MinGW64).

Build Command

python -m nuitka ^
    --standalone ^
    --plugin-enable=pyside6 ^
    --include-data-dir=assets=assets ^
    --include-data-dir=game/content=game/content ^
    --include-data-dir=game/lang=game/lang ^
    --include-data-dir=plugins=plugins ^
    --include-data-dir=campaigns=campaigns ^
    --include-data-dir=maps=maps ^
    --include-data-dir=steam_sdk=steam_sdk ^
    --include-data-files=steam_sdk/steam_api.dll=steam_sdk/steam_api.dll ^
    --include-data-files=steam_sdk/win64/steam_api64.dll=steam_sdk/win64/steam_api64.dll ^
    --include-data-files=game/_ccore.cp314-win_amd64.pyd=game/_ccore.cp314-win_amd64.pyd ^
    --include-data-files=THIRD_PARTY_LICENSES.md=THIRD_PARTY_LICENSES.md ^
    --include-data-files=LGPL-3.0.txt=LGPL-3.0.txt ^
    --include-data-files=GPL-3.0.txt=GPL-3.0.txt ^
    --include-qt-plugins=multimedia ^
    --include-package=OpenGL ^
    --include-module=PySide6.QtOpenGLWidgets ^
    --include-module=PySide6.QtMultimedia ^
    --windows-console-mode=disable ^
    --windows-icon-from-ico=assets/Icons/WaywardCrown.ico ^
    --output-filename=WaywardCrown.exe ^
    --output-dir=dist ^
    --lto=yes ^
    --jobs=8 ^
    main.py

Required Files

Type Path Description
C extension game/_ccore.cp3XX-*.pyd Core acceleration for A* pathfinding, spatial hashing, etc.
Game content game/content/*.json Class, enemy, and building definitions
Language packs game/lang/*.json 15 language translations
Art assets assets/ All images, music, and sound effects
Campaigns campaigns/ Built-in tutorial campaign
Custom maps maps/ User maps
Plugins plugins/ Third-party extensions
Steam SDK steam_sdk/ Steamworks DLL
Licenses THIRD_PARTY_LICENSES.md etc. LGPLv3 compliance documents

Python Version

The .pyd filename includes the Python version (e.g., cp314). After switching Python versions, you must recompile the C extension and update the filename in the build command.