Codex Omnia is now playable in the DHSeaDev Arcade. It is a free spell-crafting puzzle, idle and battle game: you solve rune puzzles for shards, craft spells that keep earning while you are away, and then take them into a fight against hexagonal walls that close in. The project page has the full description. This post is about the part that was not obvious: getting a game written as one HTML file to live in two places.
One source, two homes
Codex Omnia was built as a single self-contained file for itch.io. That file carries its whole script inline, and its content security policy allows exactly that: inline script, no network at all. The arcade runs under a stricter rule. Scripts must come from the same origin, and inline script is not allowed. Loosening the arcade policy for one game was the wrong answer, so the game gets a second output instead.
A small generator reads the finished single file and writes an arcade build from it: the page, plus the script moved out into its own file. Every replacement it makes has to match exactly once or the generator throws, so it cannot quietly produce a build that differs from what was tested. The result is 52,811 bytes of page and 448,128 bytes of script, and the game itself is unchanged.
The save key that would have collided
Every game in the arcade is served from one origin, so they all share one browser storage area. The itch.io build saves under a plain key. In the arcade, a plain key could be read or overwritten by any other game that picked the same name. The generator therefore rewrites the key to carry the game’s own prefix, and does the same for the small storage probe the game runs at start-up.
A check you have never seen fail is not evidence, so the test was run against a build without the prefix as well. The save test has 14 checks and passes all 14 on the real build. Pointed at a build with the plain key, 11 pass and 3 fail, which is the failure I wanted it to be able to show. It also checks that a progress counter survives a reload, that a sibling game’s data is left untouched, that a plain legacy key is not adopted, and that the game still starts and shows its storage notice when local storage throws, as it does in some private modes.
What a green suite did not tell me
My first run of that save test failed on a check that looked like a real bug: after a reload, the level and shard count did not match what I had saved. They did match what the game had advanced to on its own in the meantime, because the flame character studies runes automatically after a save. The reloaded values were correct and my test was comparing against a moving target. The fix was to assert on a counter the game never advances by itself. The lesson is the old one: when a test fails, work out whether the product or the test is wrong before touching either.
I have not yet seen the arcade’s back-bar and the game’s title overlap on a real device, and I have not measured frame rate on real hardware. The game renders cleanly at desktop and phone widths with no console errors. Anything beyond that I will mark as unverified until I have looked.
Play it at the arcade, or read about it on the project page.

Leave a Reply