Chapter 14: Distribution
Let's package our game into a standalone executable.
The Goal
We want to create a single binary that:
- Contains all our game code
- Includes the Sigil runtime
- Runs without any external dependencies
- Can be shared with anyone
Package File
Create package.sgl in your game directory:
(package
(name "lost-key")
(version "1.0.0")
(description "A text adventure game")
(license "MIT")
(authors "Your Name <you@example.com>")
(dependencies
(package-dep (name "sigil-stdlib") (version ">= 0.0.0")))
(source-dirs '("adventure")))Building the Executable
From your project directory:
sigil buildThis compiles all sources and creates build/lost-key (or build/lost-key.exe on Windows).
Testing During Development
Use sigil run to quickly build and run your game during development:
sigil runThis automatically compiles any changed files and runs the entry point.
Testing the Release Build
After building for release, test the standalone executable:
./build/release/bin/lost-keyIt should work exactly like sigil run, but now it's self-contained.
Creating a Release Bundle
To bundle everything needed for distribution:
sigil bundleThis creates a distributable package in dist/:
- The executable
- Any required assets
- A README if present
Cross-Platform Builds
Sigil supports Linux, macOS, Windows, FreeBSD, OpenBSD, NetBSD, and Web targets.
# Linux (default)
sigil build
# Web (requires Emscripten)
sigil build --config webWeb Builds
To build for the web, you need Emscripten installed. Web builds produce .js and .wasm files that can run in any modern browser.
# Build for web
sigil build my-app --config web
# Output files in build/web/
# - my-app.js
# - my-app.wasmInclude these in an HTML page with a <script> tag to run your application in the browser.
File Size
A typical Sigil application:
- Minimal: ~400KB
- With stdlib modules: ~500-800KB
- With graphics (SDL): ~2-4MB
The resulting binary is reasonably small because:
- Code is compiled to bytecode, not linked C
- Only used modules are included
- No large runtime dependencies
Distribution Checklist
Before sharing your game:
- [ ] Test on a fresh system (no Sigil installed)
- [ ] Verify save/load works in the bundle location
- [ ] Include a README with instructions
- [ ] Add license information if distributing
Creating a README
# The Lost Key
A text adventure game.
## How to Play
Run the `lost-key` executable. Type commands to explore:
- `look` - See your surroundings
- `go north/south/east/west` - Move around
- `take <item>` - Pick something up
- `use <item>` - Use an item
- `help` - See all commands
## Story
You wake up in a strange house. The front door is locked.
Find the key and escape!
## Credits
Made with Sigil (https://sigil.dev)Sharing Your Game
Ways to distribute:
- Direct download: Host the binary on your website
- GitHub releases: Upload binaries to your repo
- itch.io: Popular for indie games
What You've Learned
Congratulations! You've completed the tutorial. You now know how to:
- Write Sigil programs
- Use the REPL for interactive development
- Work with all major data types
- Create and use modules
- Handle file I/O
- Write macros
- Handle errors gracefully
- Build and distribute standalone applications
Going Further
Continue exploring Sigil:
- Guides: Deep dives into specific topics
- Reference: Complete language documentation
- Examples: Check out
examples/in the Sigil repository
Ideas for Your Next Project
- A todo list application
- A simple chat server (see
examples/chat-server.sgl) - A file processing tool
- A small 2D game (when graphics support is ready)
Thank You
Thank you for working through this tutorial! Sigil is a young language, and your feedback helps make it better.
- Report issues on GitHub
- Share what you build
- Contribute to the documentation
Happy hacking!