How to make a game with Codex (step-by-step)
Use OpenAI Codex, the coding agent, to build a small browser game, fix bugs, save versions with Git and grow it into a multi-file project. No coding experience needed.
Quick answer
To make a game with Codex, OpenAI's coding agent, open an empty folder in the Codex app, the Codex CLI or the Codex extension for your code editor, and ask it to build one small browser game as an index.html file. Open that file in your browser to play, then ask for one change at a time and save each working version with Git. Codex can create and edit many files for you, so it's a good next step once a game outgrows a chat window. You don't need to know how to code to start.
What is Codex, and when should you use it for a game?
Codex is OpenAI's coding agent. Instead of copying code out of a chat, you describe what you want and Codex reads, writes and edits the files in your project folder, and can run commands to check its work. You can use it on your own computer (the Codex app, the command-line tool or an editor extension) or as a cloud agent inside ChatGPT that works on a GitHub repository.
Use Codex when your game is getting too big for one file, when you're tired of pasting full files back and forth, or when you want to use a framework like Phaser or Three.js with several files. For a very first tiny game, a chat like ChatGPT, Claude or Grok is just as good, and you can move that file into Codex later. Cursor is a similar option if you prefer a full AI code editor.
Codex comes with ChatGPT plans and can also be used with an OpenAI API key. Which plans include it and how much usage you get change over time, so check openai.com/codex for what's included right now.
Steps
Set up Codex and make an empty folder. Install the Codex app, the Codex CLI or the Codex extension for your editor (such as VS Code or Cursor) from openai.com/codex, and sign in with your ChatGPT account. Create a new empty folder such as
my-first-gameand open it in Codex. Everything it makes will go in this folder.Describe a tiny game. Keep the first idea small. For example: "Create a complete browser game in a single file called index.html, no external libraries. The player moves a ship left and right with the arrow keys and shoots falling rocks. Show the score, end the game when a rock hits the ship, and press R to restart."
Review and approve what it does. Codex tells you which files it wants to create and which commands it wants to run, and depending on the approval setting you choose, it asks before doing more. Read its summary, approve it, and you'll see
index.htmlappear in your folder.Play it in your browser. Find
index.htmlin your folder and double-click it. If the page is blank, tell Codex exactly that and paste any red error text from the browser console (F12, then Console).Ask for one change at a time. Describe what you saw: "The rocks fall too fast at the start, make them 30% slower and speed up over time." One change per message makes it easy to spot what broke something.
Save your progress with Git. Ask Codex: "Set up Git in this folder and commit the current working version." Then ask it to commit again each time the game works, so you can always go back.
Grow into multiple files when you need to. Once the game gets long, ask: "Split this game into index.html, style.css and game.js, keeping it working." Codex edits all the files together, which is where an agent beats copying from a chat.
Add art and sound. Put free sprites and sounds in an
assetsfolder and ask Codex to use them (see below).Share it and get it tested. Upload the folder to itch.io, Netlify or GitHub Pages, or upload a single
index.htmlstraight to AI Game Universe. Then ask other makers to playtest it.
What prompt makes a complete playable slice?
Turn this into a complete short game:
- smooth keyboard controls, plus on-screen buttons for phones
- a clear win condition and a lose condition
- a start screen, a score, and a game-over screen with "Press R to restart"
- save the high score in localStorage
- keep the code commented and easy to follow, no external libraries
Test that index.html still opens and runs in a browser.What do you do when the game breaks in Codex?
- Describe the symptom, not the fix. "When I press space nothing happens" works better than guessing at the code.
- Paste the error. Copy any red lines from the browser console into your message.
- Go back to the last commit. If several fixes in a row make it worse, ask Codex to restore the last working commit and try again with a smaller change.
- Start a fresh session for big changes. Long sessions can lose track. Start a new one and say "Read index.html and game.js first, then..." so Codex looks at the current code.
- Add an AGENTS.md file for long projects. Codex reads a file called
AGENTS.mdin your folder for instructions. Ask it to write one describing the game, its controls and its files, and to keep it updated.
How do you add art and sound?
Download free assets from Kenney or OpenGameArt (check each asset's license), put them in an assets folder, and ask: "Use the images in the assets folder instead of colored shapes." For sound, ask Codex to play the sound files or to make simple effects with the Web Audio API. The sound guide walks you through it.
How does Codex compare with ChatGPT, Cursor and Claude Code for games?
ChatGPT, Claude and Grok chats are great for a first single-file game, but you copy the code out yourself. Codex is an agent: it works on the files in your project and can run commands, which is easier once a game has many files or you make lots of changes. Cursor and Claude Code work in a similar way, so pick the one whose plan you already have or whose results you like best. Many makers start a game in a chat and move it into an agent when it grows. See the walkthroughs for ChatGPT and Cursor, or ask other makers in Advice.
Frequently asked questions
Can Codex make a whole game?
Yes, a small one, and it can keep growing it. Codex can create a complete browser game and then edit it across many files as you add features one at a time.
Is Codex free for making games?
Codex is included with ChatGPT plans, and usage limits differ by plan and change over time. Check openai.com/codex for what's included right now.
Is Codex the same as ChatGPT?
No. ChatGPT is a chat where you copy code out yourself. Codex is OpenAI's coding agent that works directly on the files in your project folder or repository. You sign in to both with the same ChatGPT account.
Do I need to know how to code to use Codex?
No. You describe the game in plain English and Codex writes the code. Knowing how to open a folder, open a file in your browser and read the browser console is enough to start.
How do I share a game made with Codex?
Upload the game folder to itch.io, Netlify or GitHub Pages and send the link, or upload a single index.html to AI Game Universe so other makers can play and playtest it.
Ask the community — answers earn credits, so people do help.
💬 0 comments
No comments yet. Tried this guide? Say how it went.
Log in or join free to comment and track progress.
Built something with this guide?
Add your game in a minute, free. Paste a link and we fill in the rest.
➕ Add your game