u/0xKlob

Image 1 — 5 days of progress making a tower defense game with Codex
Image 2 — 5 days of progress making a tower defense game with Codex
Image 3 — 5 days of progress making a tower defense game with Codex
Image 4 — 5 days of progress making a tower defense game with Codex
Image 5 — 5 days of progress making a tower defense game with Codex
Image 6 — 5 days of progress making a tower defense game with Codex
Image 7 — 5 days of progress making a tower defense game with Codex
Image 8 — 5 days of progress making a tower defense game with Codex

5 days of progress making a tower defense game with Codex

Short video of gameplay here.

So a few weeks ago I went looking for an old iPhone game I played ten-ish seventeen years ago (!) called GeoDefense Swarm. It's been off the App Store for at least 10 years...so I decided to make a spiritual successor to it.

I'm a software dev with ~10 years of experience but, critically, not a frontend dev at all nor have I ever touched game development, so I did spend a few days researching game design patterns and frameworks and engines and whatnot. In the end I decided to go with just a webapp made in Typescript, rendered on HTML canvas & using the PixiJs library for graphics.

Project was created off of my Codex template which initializes new projects with an AGENTS.md + 6 other documents similar to AGENTS.md but with their own scope:

  • PLANS.md ensures larger changes are driven by self-contained execution plans (this is adapted from OpenAI's article on exec plans)
  • PRODUCT.md keeps the current product truth explicit, especially for small and medium user-visible changes that may not get their own ExecPlan.
  • ROADMAP.md keeps intended future direction explicit so contributors can distinguish current behavior from planned behavior.
  • CODESTYLE.md keeps source conventions, commenting standards, and code-file size expectations explicit.
  • DESIGN.md captures stable product and interface language.
  • ARCHITECTURE.md captures stable system boundaries and invariants.

To iterate on the game / add features / fix stuff I just create issues on GitHub that are fairly descriptive, and then tell codex-cli to look up the issue and implement/fix it. For non-trivial stuff Codex will then create a plan by asking me questions about what direction I want to go in, etc, which builds up a fairly comprehensive spec for the feature which is store in an Exec Plan as referenced above. Then it builds the thing! Most features take around 30 minutes to an hour to complete.

One big struggle I had was making the frontend look decent - initially Codex would make *terrible* looking UIs and overlapping elements and whatnot. I added two skills to fix this: one that takes screenshots of the app using agent-browser (a headless chrome instance) and inspects them with GPT-Image-2 for issues, and another that uses Google Stitch for mockups of UI elements and screens/menus. UI is still the weakest part of Codex but with these two additions you can do a lot!

Note that I'm on the $100/month Codex plan and have about 50% of my weekly limit remaining from the past few days of usage, so this definitely isn't feasible on the $20/month plan.

Some stats:

  • 35 PRs merged (which I manually review every time!)
  • 109 commits pushed
  • 12,000 lines of Typescript + 8,000 lines of HTML/CSS
u/0xKlob — 7 days ago
▲ 76 r/codex

So I'm working on a Tower Defense game with Codex, got my AGENTS.md & my CODESTYLE.md & six other ALLCAPS.md files etc, and am working on some refactoring to keep the codebase clean & file sizes low, right? And then I see this in the ExecPlan for my latest refactor:

# Observations

- Observation: The refactor made the screenshots pixel-identical after the baseline was recaptured correctly.

Evidence: sha256sum screenshots/before-implementation-x.png screenshots/after-implementation-x.png reported matching hashes for before/after pairs 1, 2, and 3.

Which is crazy! I've never told Codex to do an sha compare on before/after screenshots of the app, but I do have instructions in my PLANS.md to take before & after screenshots of the webapp for the game to make sure we avoid frontend regressions (it uses GPT-Image-2 for analysis). So for non-frontend impacting changes, of course nothing should be different between screenshots taken at *identical timestamps* into the game start.

But doing an explicit SHA compare - that's just...not something I would've *ever* thought of. Wild.

(the template I use for my projects with 8 ALLCAPS.md files for Codex guidance is here, if anyone's curious)

Edit: Note that this only works because my app is based on a tick/game-loop system without callbacks; if this was the standard game-development pattern of callbacks & message handling to invoke events, it wouldn't work, because the timing would be slightly different each time, and an enemy would be a few pixels to the left/right of its position in the past run.

u/0xKlob — 9 days ago