DPS PolyItch / PolyGlot
A downloadable tool
POLYITCH
Ship a browser game that is genuinely written in nine languages.
================================================================
WHAT IT IS
================================================================
polyitch is a command-line tool. You point it at a web game you
already have, and it compiles Rust, Zig, Go, D, Grain, Odin,
AssemblyScript, C and hand-written WebAssembly into .wasm modules,
then grafts them into your existing page without replacing it.
Your game stays your game. The extra languages ride alongside it.
It is not a framework, not an engine, and not a rewrite. If you
delete it tomorrow your game still runs, because every module it
builds is optional by design.
================================================================
WHY YOU MIGHT WANT IT
================================================================
Because "written in nine languages" is only interesting if each
language is doing a job you can point at on screen.
That is the rule the tool is built around. A language earns its
place by owning one visible rule in your game:
Rust wrapping arithmetic, so a score that would silently
overflow in C is a compile-time decision instead
Zig no allocator, no hidden control flow - good for the
per-frame question "does this entity get full AI?"
D compile-time tables (CTFE). A rule the compiler already
knows is not a branch your game has to discover
Grain a ruleset the code reading it cannot mutate
Odin plain data layout, good for registries and grids
Go hashing and name tables, via TinyGo
AS typed integers for HUD numbers, no GC pause
WAT hand-written Wasm as the reference implementation
the others are checked against
C the dual-path kernel you also link natively
If you cannot say what a language does in your game, polyitch's
own doctrine says do not add it. The tool will happily build a
module nobody calls; the playbook that ships with it will tell
you that is a failure.
================================================================
FAIL-SOFT IS THE WHOLE DESIGN
================================================================
Every module gets a JavaScript twin - a plain-JS implementation
of the same rule. If a .wasm 404s, arrives late, or throws, the
twin answers and the game keeps playing.
This is not a fallback bolted on afterwards. It is the reason
the approach is safe to ship: you are never one failed fetch
away from a blank canvas.
================================================================
USAGE
================================================================
polyitch doctor
Check your toolchains and project layout. Run this first.
It tells you which of the nine languages you can actually
build on this machine, and does not pretend about the rest.
polyitch build --graft
Compile every language it finds and inject the modules
into your existing index.html. Your HTML is not replaced -
a script tag is added.
polyitch build --graft --zip
The same, plus an itch.io-ready zip: index.html at the
archive root, forward-slash paths, Kind = HTML.
polyitch serve --open
Serve the packaged folder locally with the correct MIME
types. A .wasm served as text/plain fails to instantiate
and looks like a bug in your game; this avoids that.
polyitch check
Validate layout and crate types without building.
polyitch backends
List the language backends and what each needs installed.
polyitch brag
Measure the result honestly: lines per grafted language,
and a verdict on whether the volume is EARNED. It will
tell you when it is not.
================================================================
WHAT YOU NEED
================================================================
The tool builds whatever toolchains you have and skips the rest.
Nothing is mandatory except the ones you want to use:
Rust + wasm32-unknown-unknown target ...... rust
Zig ....................................... zig
TinyGo + Go ............................... go
LDC (D compiler) .......................... d
Grain ..................................... grain
Odin ...................................... odin
Node + AssemblyScript ..................... as
LLVM/clang (wasm32 target) ................ c, kernels
wabt (wat2wasm) ........................... wat
binaryen (wasm-opt), optional ............. size optimisation
Run `polyitch doctor` and it will tell you exactly which of
these it found.
================================================================
THE ITCH.IO PART
================================================================
Uploading a web game to itch means Kind = HTML, index.html at
the zip root, forward slashes, and a file/size budget. polyitch
knows those constraints and packages to them, including:
- correct Wasm MIME types when serving locally
- a glue loader using new URL(..., import.meta.url) so paths
survive being served from a subfolder
- a WASI shim for the languages that need one (Grain imports
fd_write even when it never prints; Odin's js_wasm32 target
imports odin_env even when nothing calls out)
Those two shims are the kind of thing that costs an evening the
first time. They are handled.
================================================================
LICENCE
================================================================
MIT OR Apache-2.0.
Built alongside a real shipped game rather than in the abstract,
which is why the doctrine files are opinionated about what
counts as earning your place.
Download
Click download now to get access to the following files:
Leave a comment
Log in with itch.io to leave a comment.