Overview
The init-exe command generates Docker-based build configuration files that enable you to compile your Talon game into native executables for Linux and Windows. This allows you to distribute your game as standalone binaries that users can run without installing Talon.
Syntax
talon init-exe <file.wren>
Path to your main Wren script file. This will be used as the entry point for the compiled executable.
What It Creates
Running init-exe generates two files in your current directory:
1. Dockerfile
A multi-stage Docker configuration that:
- Sets up cross-compilation environments for Linux and Windows
- Compiles your Talon game into native binaries
- Packages all dependencies
- Outputs executables to the
dist/ directory
2. docker-compose.yml
A Docker Compose file that:
- Defines the build service
- Configures volume mounts
- Sets up output directories
- Uses your project directory name as the service name
Generated Files
Both files are customized with:
- Project Name: Extracted from your current directory name
- Main File: The
.wren file you specified as the entry point
Build Process
Step 1: Initialize
Generate the Docker configuration:
talon init-exe index.wren
This creates:
Dockerfile
docker-compose.yml
Step 2: Build
Compile the executables using Docker Compose:
docker compose up --build -d
This will:
- Build the Docker image
- Compile your game for Linux (x86_64)
- Compile your game for Windows (x86_64)
- Output binaries to
dist/ folder
Step 3: Distribute
Find your executables in the dist/ directory:
dist/
├── linux/
│ └── game-name
└── windows/
└── game-name.exe
Complete Example
Project Structure
my-game/
├── main.wren
├── game.wren
└── utils.wren
Initialize Build Configuration
cd my-game
talon init-exe main.wren
Output:
my-game/
├── main.wren
├── game.wren
├── utils.wren
├── Dockerfile ← Generated
└── docker-compose.yml ← Generated
Build Executables
docker compose up --build -d
Output:
[+] Building 145.2s
[+] Running 1/1
✔ Container my-game-build-1 Started
Check Results
my-game/
├── main.wren
├── game.wren
├── utils.wren
├── Dockerfile
├── docker-compose.yml
└── dist/ ← Build output
├── linux/
│ └── my-game
└── windows/
└── my-game.exe
Distribution
Linux Executable
Distribute dist/linux/my-game:
./my-game # Users run this directly
Windows Executable
Distribute dist/windows/my-game.exe:
my-game.exe # Users run this directly
Requirements
Docker
You must have Docker installed and running:
docker --version # Should show Docker version
If Docker is not installed:
Docker Compose
Modern Docker installations include Docker Compose v2:
File Templates
The generated files use templates with placeholders:
{{{ PROJECT_NAME }}} - Replaced with your directory name
{{{ MAIN_FILE }}} - Replaced with your specified .wren file
Advanced Usage
Custom Build Configuration
After generating the files, you can customize:
Dockerfile:
- Add additional dependencies
- Modify compiler flags
- Include assets or resources
- Change output paths
docker-compose.yml:
- Add environment variables
- Configure build arguments
- Modify volume mounts
Including Assets
To include game assets (images, sounds, etc.) in your build:
- Modify the
Dockerfile to copy asset directories
- Ensure assets are in the correct relative paths
- Rebuild with
docker compose up --build
Troubleshooting
Docker Not Found
bash: docker: command not found
Solution: Install Docker Desktop or Docker Engine.
Permission Denied
permission denied while trying to connect to the Docker daemon socket
Solution: Add your user to the docker group:
sudo usermod -aG docker $USER
newgrp docker
Build Fails
Check Docker logs:
Common issues:
- Syntax errors in Wren code
- Missing module imports
- Invalid file paths
Executables Not Created
Verify the build completed:
docker compose ps # Check container status
ls -la dist/ # Check output directory
Build Time
First build may take several minutes:
- Docker image download: ~1-2 minutes
- Compilation: ~2-5 minutes
- Total: ~3-7 minutes
Subsequent builds are faster due to Docker layer caching.
| Target Platform | Architecture | Output |
|---|
| Linux | x86_64 | ELF binary |
| Windows | x86_64 | PE executable (.exe) |
Comparison with WASM
| Feature | init-exe | init-wasm |
|---|
| Output | Native binaries | HTML + WASM |
| Performance | Native speed | Near-native speed |
| Distribution | Download & run | Web browser |
| File size | Larger | Smaller |
| Platform support | Linux, Windows | Any modern browser |
Best Practices
- Test Before Building: Ensure your game runs correctly with
talon main.wren
- Version Control: Add
Dockerfile and docker-compose.yml to Git
- Ignore Build Output: Add
dist/ to .gitignore
- Clean Builds: Remove
dist/ between builds for clean output
- Asset Management: Plan asset inclusion in your Dockerfile
Next Steps
After building executables:
- Test: Run the executables on target platforms
- Package: Create installation packages or ZIP archives
- Distribute: Upload to itch.io, Steam, or your website
- Document: Provide README with system requirements