Local web app that:
- is designed for a joystick controller with two buttons, while also supporting keyboard fallback controls
- asks OpenAI for a fresh set of 4 two-answer questions on startup
- asks OpenAI for a brand-new arcade game based on those answers
- loads the returned single-file game directly in the browser
- can also run as a static GitHub Pages site for replaying saved games from the library
Try it without AI game generation on GitHub Pages: AI Arcade demo
This browser demo is for playing saved games only and does not include the AI game generation flow.
- Node.js built-in HTTP server
- vanilla HTML, CSS, browser Gamepad API, and keyboard/mouse fallback bindings
- OpenAI Responses API from the local server so the API key never sits in the browser
You can either run it on your own server with an OpenAI API key so you can generate new games, or try the saved games on GitHub Pages without game generation.
- Use Node 20+.
- Create a
.envfile in the project root. - Add at least:
OPENAI_API_KEY=your_api_key_here
OPENAI_QUESTION_MODEL=gpt-5.4-mini
OPENAI_GAME_MODEL=gpt-5.4
PORT=3000- Start the app:
npm start- Open
http://localhost:3000.
- The browser UI is designed around a joystick controller with two buttons.
- Keyboard fallback is also supported: arrow keys or
WASDmove,Entermaps to Button 1,Shiftmaps to Button 2,Escreturns to the start menu, and mouse buttons1and2also map to Button 1 and Button 2. - The frontend reads the controller through the browser Gamepad API and mirrors the same digital inputs to keyboard and mouse fallback bindings.
- By default, Button 1 is gamepad button index
0and Button 2 is index1. - The joystick uses either the left stick axes or standard d-pad button mapping if the controller exposes buttons
12-15. - Generated games receive controller state through a host-provided
window.arcadeInputobject inside the iframe.
- The repo root now includes a static
index.htmlentry point so GitHub Pages can serve the saved library without the local Node server. - On GitHub Pages, game generation is disabled unless the app can reach a local API with an
OPENAI_API_KEY, but saved games indata/library/remain playable in the browser. - GitHub Pages demo: AI Arcade on GitHub Pages
If you run the app, generate a really cool game, and want to share it back, feel free to open a pull request and I will happily take a look and merge it in.
All help to expand the app further is welcome, whether that is new saved games, polish, fixes, or bigger feature ideas.
This project is released under the MIT License. See LICENSE for the full text.
