Put a Godot 4 web game on Khan Academy.
It takes your Godot HTML5 export, uploads it to GitHub, and generates a single HTML file you paste into a KA webpage program. The heavy files (engine, game data) are served from GitHub via jsDelivr — Khan Academy itself only ever holds the small loader file.
Requires Python 3.10+.
pip install git+https://github.com/SwankyMan88/godot2ka.gitProject → Export → Web, with:
- Thread Support: OFF (required — threaded builds cannot run on KA)
- Extensions Support: OFF (unless you specifically need GDExtension)
- Export mode: Release (Debug builds are much larger and slower to load)
Go to https://github.com/new.
- Public (required — jsDelivr can't read private repos)
- No README, no
.gitignore- This is optional. It doesn't really matter.
godot2ka-wizardIt walks you through everything and asks before doing anything public:
- Where your export is
- What to call the game
- Which GitHub repo to use
- How much of the game should be visible on screen
- A version tag for this build
- Whether to push now
Accept the default for any prompt by pressing Enter. Ctrl+C cancels safely
at any point.
- Go to https://www.khanacademy.org/computer-programming/new/webpage
- Select all the starter code and delete it
- Paste the contents of the
program.htmlthe wizard made - Save
That's it — the program is playable.
Made changes in Godot? Re-export, then run godot2ka-wizard again and give it
a new version tag (it'll suggest one). Push, then paste the new program.html
into your existing KA program.
Always use a new tag for an update — reusing the old one can serve players a broken mix of old and new game files for several hours.
The wizard asks for a "render scale." Above 1, the game draws more of the world so you can see farther; below 1, it draws less. You can also change this after publishing without rebuilding anything, by adding to the program's URL:
?scale=1.5
This only works if your project's stretch mode is set to disabled
(Project Settings → Display → Window → Stretch → Mode). With other stretch
modes, this setting only affects sharpness, not how much you can see.
| Problem | Fix |
|---|---|
| "Wrong window size" | Add ?width=1066 to the end of the KA program's URL (try 1067 if that doesn't work) |
| Loading gets stuck partway | Wait a minute and reload — a freshly pushed version can take a moment to become available |
SharedArrayBuffer is not defined |
Re-export with Thread Support off |
| Game is silent | Click the Start game button that appears once loading finishes — browsers block sound until you interact with the page |
| Game renders small in a corner | In Godot: Project Settings → Display → Window → Stretch → Mode → canvas_items, Aspect → keep |
If something else goes wrong, open the browser's developer console (F12) and check for red error text — that's the fastest way to find out what happened.
Run the packer directly instead of the wizard, for scripting or CI:
godot2ka path/to/export --repo YOURUSER/my-game-files --title "My Game"| Flag | Purpose |
|---|---|
--repo |
GitHub repo storing the game data (required unless --base-url) |
--ref |
Version tag for this build (default main — see note above about tagging) |
--title |
Browser tab title |
--heading |
Loading-screen text (defaults to --title) |
--render-scale |
How much of the game is visible (default 1.0) |
--ka-width |
Width KA must report before starting (default 1066) |
--out |
Output directory (default dist) |
--base-url |
Serve game data from a URL you control instead of GitHub/jsDelivr — useful for testing locally |
For the reasoning behind how this works — and why several obvious-looking simplifications would break it — see docs/HOW_IT_WORKS.md.