Building a Complete Game from Scratch with Codex in One Afternoon

·Toolin Editorial Team

Kick off game development with OpenAI Codex in a single sentence — assets, background removal, and music generated automatically; a publishable, complete game in one afternoon

Building a Complete Game from Scratch with Codex in One Afternoon

A developer used OpenAI Codex to build a complete zhiguai-supernatural roguelike deck-builder, Night Patrol: The Deserted Temple, from scratch in a single afternoon. No code written, no engine touched — only requirements described in natural language. This article breaks down his full development process; you can use the same method to quickly build your own game prototype.

The project is open source, and desktop installers (macOS / Windows) are already packaged: https://github.com/op7418/Night-Patrol/releases

Preparation

  • Required tools: OpenAI Codex (requires Codex access), GPT-Image 2.0 (built into Codex)
  • Optional tools: Seedance 2.0 (video generation), Suno v5.5 (music generation)
  • Technical requirements: no programming background needed — Codex handles all the code
  • Estimated time: 4-6 hours to a publishable game

Step 1: Describe Your Game Idea

All it takes is talking through your game concept with Codex. This developer's prompt was along the lines of 'Can you help me make a game like Slay the Spire?'

From your description, Codex plans the game architecture on its own. In this case it picked a React + Phaser stack and generated a complete loop in one go: title screen, map, battles, rewards, events, shop, rest, Boss, and results.

First playable build

About an hour later, a playable prototype was already running.

Tip: Don't over-detail the first conversation. Codex's strength is deriving a complete design from a vague requirement. Let it build the prototype first, then iterate step by step.

Step 2: Let Codex Generate the Art Assets Automatically

Character art is a game's core visual asset. This step shows off one of Codex's most surprising capabilities.

A Self-Built Asset Pipeline

When the developer told Codex to 'call GPT-Image 2.0 to generate the assets,' Codex autonomously completed an entire pipeline:

  1. Generated green-screen character art: it produced character sprites on a solid green background on its own, to make cutout processing easy later. The developer never told it a transparent background was needed — it derived that requirement itself.

  2. Found its own cutout tools: it searched for, installed, and invoked tools like rembg to do the background removal, then filed the results by filename into the designated directories.

  3. Handled bulk assets: when facing an asset pack with thousands of images, Codex wrote a script to stitch all the small images into one contact sheet, with each thumbnail labeled with its filename underneath. It then only needed to 'look' at this single large image to pick every asset it required in one pass.

Tip: The 'stitch into a sheet, then recognize' idea is well worth borrowing. When a multimodal task has to process large numbers of images, compose one index image with a script first and let the AI finish the screening in a single scan.

Step 3: Generate Video and Music to Polish the Game's Texture

Once the prototype runs, the next job is making it 'feel like a real game.'

Execution Animations with Seedance 2.0

The process for generating a finishing animation for each Boss:

  1. Use GPT-Image to generate a still frame of the Boss
  2. Feed the still frame to Seedance 2.0 to generate a short video
  3. Save the video into the assets directory; it plays automatically after each battle victory

The trick to a seamless loop: pass the same image as both first and last frame, so the video starts on that image and returns to it — spliced together, it loops infinitely.

Background Music with Suno v5.5

Just give Suno a short direction. This project's prompt was: 'zhiguai night road, temple block, bells, low-frequency drone, pentatonic scale, restrained, not sentimental.' Run a few versions and pick the best fit.

Music generation with Suno

Step 4: Polish the Game Feel

This is the step that separates a 'demo' from a 'game.' Codex handled these details on its own:

  • Hit feedback: characters lurch left and right, the camera shakes, and the screen briefly flushes red
  • Differentiated sound effects: sword, talisman, thunder, and fist each carry their own impact sound
  • Freeze frames: a brief freeze the instant an enemy dies, then the execution animation plays
  • Volume control: title-screen music plays louder, then automatically drops to background level once you press start

Combat effects

Verified Results

The final product is a complete tower-climb deck-builder:

  • Complete game loop: title screen -> map exploration -> battle -> Boss -> results
  • 7 monsters, 20+ cards, 4 burst combo lines
  • Hit feedback, sound effects, music, card art, idle animations, and finisher videos all in place
  • macOS and Windows installers built automatically via GitHub Actions

Project address: https://github.com/op7418/Night-Patrol/releases

Key Takeaways

  1. Don't over-describe: Codex derives complete designs from vague requirements — give it goals, not steps
  2. Let it build its own tools: when it hits a wall, Codex writes a script to solve the problem itself (like the contact-sheet stitch)
  3. The asset pipeline can be fully automated: from image generation to cutout to sorting, one sentence starts it all
  4. Polish matters more than the prototype: the first 3 hours produce a playable version; the hours after decide whether it feels like a game
  5. Pair your audio and video tools: the GPT-Image + Seedance + Suno combination covers all of a game's multimedia needs