Vibe coding a VR game with Claude, ChatGPT or Cursor
By the Turbl team · · 11 min read
Vibe coding a VR game means you describe the game in plain words and an AI writes all the code. It works today for small games that run in the headset browser. The catch is that a chat assistant alone cannot put the game in your headset. Something still has to build it, host it over HTTPS and test it in VR.
What vibe coding means
Andrej Karpathy coined the term in a post in February 2025. He described a way of working where you "forget that the code even exists". You ask, you accept every change, and you paste error messages back without reading them. He called it fine for "throwaway weekend projects".
The programmer Simon Willison gives a tighter definition: "building software with an LLM without reviewing the code it writes". An LLM, or large language model, is the kind of AI behind Claude and ChatGPT. If you read and test every line, he says, that is ordinary software development with AI help.
Reading code does not tell you how a VR game feels. Either way, you have to put the headset on.
What a chat assistant cannot do alone
Claude and ChatGPT write good 3D code for the browser. The usual target is WebXR, the browser standard that lets a web page run as VR. Our guide to what WebXR is covers the basics. The problems start after the code is written.
The chat cannot see VR. Chat apps can show a preview of a web page next to the conversation. That preview is a flat page inside the chat window. A browser rejects a request for a VR session when the page lacks a permission named xr-spatial-tracking. We found no official statement from Anthropic or OpenAI that their previews grant it, and we did not test it. Plan on moving the code out of the chat.
WebXR needs HTTPS. Browsers offer WebXR only in a secure context. That means a page served over HTTPS, or a page on localhost, which is the computer the browser runs on. A headset is a separate computer. If you open your PC's network address from the headset, such as http://192.168.1.20:8080, the page loads but VR is not available. A three.js page shows "WEBXR NEEDS HTTPS" in place of the VR button.
VR starts with a button press. A page cannot put you into VR on load. The browser accepts the request only from code that runs because of a user action, such as a click.
Real projects need a build. A single HTML file works for a small scene. A larger game uses packages from npm, the package registry for JavaScript, and a build tool such as Vite. A plain chat cannot run those tools. A coding agent can. A coding agent is an AI tool that writes, runs and fixes code on your computer. Cursor and Claude Code are examples.
Nobody tests it. The assistant writes the code and stops. It does not know if the grab works.
Three setups that work
| Setup | Who builds and hosts | Who tests in VR | Skill needed | Main weakness |
|---|---|---|---|---|
| Plain three.js in a chat | You, by hand | You, in the headset | Low to medium | Copy, paste and upload for every change |
| Cursor or Claude Code with a WebXR starter | The agent, on your computer | The agent in an emulator, then you | Medium to high | A real code project to maintain |
| A chat with an MCP connector | The connected service | You, through a link | Low | Tied to that service and its limits |
Setup 1: plain three.js in a chat
three.js is a widely used JavaScript library for 3D in the browser. Ask Claude or ChatGPT for "a single HTML file using three.js with WebXR support". The VR part of a three.js page is short. This is a complete page that shows one cube in VR. It uses three.js 0.187.0, the current version as of November 2026.
<!doctype html>
<html>
<body style="margin:0">
<script type="importmap">
{
"imports": {
"three": "https://cdn.jsdelivr.net/npm/[email protected]/build/three.module.js",
"three/addons/": "https://cdn.jsdelivr.net/npm/[email protected]/examples/jsm/"
}
}
</script>
<script type="module">
import * as THREE from 'three';
import { VRButton } from 'three/addons/webxr/VRButton.js';
const scene = new THREE.Scene();
const camera = new THREE.PerspectiveCamera(70, innerWidth / innerHeight, 0.1, 100);
camera.position.set(0, 1.6, 0);
const cube = new THREE.Mesh(
new THREE.BoxGeometry(0.3, 0.3, 0.3),
new THREE.MeshNormalMaterial()
);
cube.position.set(0, 1.4, -1);
scene.add(cube);
const renderer = new THREE.WebGLRenderer({ antialias: true });
renderer.setSize(innerWidth, innerHeight);
renderer.xr.enabled = true;
document.body.appendChild(renderer.domElement);
document.body.appendChild(VRButton.createButton(renderer));
renderer.setAnimationLoop(() => {
cube.rotation.y += 0.01;
renderer.render(scene, camera);
});
</script>
</body>
</html>
Three lines make it VR. renderer.xr.enabled = true tells three.js to prepare for a headset. VRButton.createButton(renderer) adds the "Enter VR" button. renderer.setAnimationLoop runs the game loop. The three.js docs advise this method over the browser's own requestAnimationFrame.
Distances are in meters. The cube above is 30 cm wide. It floats 1.4 meters above the floor and one meter in front of you. The camera.position line only sets the view on a flat screen, at an eye height of 1.6 meters. In VR, three.js moves the camera with your head.
To play it, save the file as index.html. Upload it to any static host with HTTPS, such as GitHub Pages or Netlify. Open the address in the headset browser and press the button. Our guide to sharing a WebXR game covers hosting in more detail.
This setup is fine for a first scene. Every later change is a copy, a paste and an upload.
Setup 2: Cursor or Claude Code with a WebXR starter
A starter is a ready project with the build tool, the VR setup and the controls already in place. The agent fills in your game.
Meta's Immersive Web SDK (IWSDK) is the starter made for this. It is open source under the MIT license and built on three.js. In April 2026, Meta announced tooling for coding agents. You run npm create @iwsdk@latest and pick your AI tool during setup. Meta names Claude Code, Cursor, GitHub Copilot and Codex. The IWSDK docs ask for Node.js 20.19 or newer. Meta's announcement names Chrome or Edge as the browser.
The part that matters most is testing. IWSDK ships an emulator, a program that pretends to be a headset inside a desktop browser. The agent can move the emulated headset, press controller buttons, take screenshots and read the position of each object in the scene. It can check its own work before you look. Our guide to testing WebXR without a headset explains emulators.
To try the game on a Quest, connect the headset by USB with Developer Mode on. Then run adb reverse tcp:8081 tcp:8081. adb is Android's command-line tool for talking to a device. Port 8081 is the IWSDK default. Use the port your dev server reports. The headset browser can now open localhost:8081, which counts as a secure context. To share the game, ask the agent to deploy it. Meta's announcement lists GitHub Pages, Vercel and Netlify.
The VR developer Antony Vitillo, who writes the blog The Ghost Howls, tested this workflow in April 2026. He used VS Code with GitHub Copilot. A grabbable cube took him about 30 minutes, mostly spent on physics. A small basketball demo took about two hours. He called the automatic testing a "game-changer". He also wrote that the workflow "still feels unsuitable for production work".
Setup 3: a chat with an MCP connector
MCP stands for Model Context Protocol. It is an open standard that connects AI apps to outside tools. A connector is an MCP server you add to your chat app. It gives the chat abilities it lacks, such as building and hosting a project.
Turbl is our product, and it works as a connector for ChatGPT, Claude and Cursor. You stay in your usual chat and write something like "Build me a VR shooting gallery with Turbl". Turbl builds and hosts the game. You open the link in the Meta Quest browser. There is no file to upload and no cable. Signed-in users find the setup steps on Turbl's integrations page.
The limits: games are single player only. There is no Meta Quest Store app and no APK export (an APK is the app file a Quest installs). You get a hosted link, not a code project on your own computer. If you want full control of the code, setup 2 fits better.
Adding a connector differs by app, as of November 2026:
- Claude: go to Customize, then Connectors, click "+ Add", then "Add custom connector", and enter the server address. Free accounts are limited to one custom connector. On Team and Enterprise plans, an owner has to add the connector first.
- ChatGPT: OpenAI's docs say to open the Plugins page at chatgpt.com/plugins, press the plus button and choose "Add custom MCP server". The docs do not say which plans include it, so check your own account.
- Cursor: add the server's address to
.cursor/mcp.jsonin your project, or to~/.cursor/mcp.jsonfor all projects.
Only add connectors from services you trust.
One more option sits outside these three apps. Google's XR Blocks Gem runs in Gemini's Canvas and writes WebXR apps for Android XR headsets such as Galaxy XR. Google's research post from March 2026 says a simple prompt "will likely finish in under 20 seconds" on Gemini Flash. We compare it with other tools in AI VR game generators compared.
A workflow for vibe coding a VR game
- Start with one sentence. Name the player's action and the goal. "I throw balls at stacked cans. Each can I knock down scores a point."
- Get it into the headset first. Do this before you add anything. An empty room you can stand in proves that the hosting, the HTTPS and the VR button all work.
- Change one thing per message. If two changes land together and something breaks, you cannot tell which one did it.
- Test in VR after each change. Scale, reach and comfort only show in the headset. A table that looks right on a monitor can be chest high in VR.
- Report what you saw, not what to code. "The ball passes through the cans" is a better message than a guess at the cause.
- Paste errors in full. If the page is blank, connect the headset by USB with Developer Mode on. Open
chrome://inspect/#devicesin Chrome on your computer. You see the error log of the headset browser. - Save working versions. In a code project, ask the agent to commit to Git after each step that works. In a chat, keep a copy of the last good file.
Our guide to writing prompts for AI VR game builders goes deeper on steps 1 and 5.
Common failure modes
The page shows a message instead of "Enter VR". The three.js button names the cause. "WEBXR NEEDS HTTPS" means the page is not in a secure context. Check that the address starts with https://. "WEBXR NOT AVAILABLE" means the browser has no WebXR at all. "VR NOT SUPPORTED" means the browser has WebXR but finds no headset. On a desktop, use an emulator. "VR NOT ALLOWED" means the page lacks permission, which happens inside some embedded previews.
Objects fall through the floor. In Vitillo's test, gravity made the first cube "fall into oblivion". Physics needs a floor with a collider, an invisible shape that stops objects.
Things appear in the wrong place. Vitillo wrote that it is hard to place objects with prompts such as "put this cube on the right of the plant". Give distances in meters instead. "Put the target 3 meters in front of the player at eye height" leaves less to guess.
The AI uses code that does not exist. Google reported that most early errors in its XR tool came from bugs in its own framework or from invented or outdated code. Paste the error back. If it repeats, ask the AI to check the current docs of the library.
It works on the monitor but not in VR. The game was written for a mouse and keyboard. Say "VR controllers" or "hand tracking" in your first prompt.
The agent loops. Vitillo watched his agent run a long loop of reasoning and screenshots and then "fix nothing". He also noted that the workflow can use a lot of tokens, the units AI usage is billed in. Stop the agent, describe the bug in one sentence and start a fresh attempt.
The code grows until changes break old features. Nobody reads the code, so nobody keeps it tidy. Keep the game small. For a larger game, someone has to read the code.
FAQ
Can ChatGPT or Claude make a VR game?
Both can write the code for one. Neither chat app alone hosts the game or puts it in your headset. You upload the file to a host with HTTPS yourself, or add a connector that builds and hosts it. A coding agent such as Claude Code can build, test and deploy a project on your computer.
Do I need a VR headset to vibe code a VR game?
Not to start. An emulator shows the scene in a desktop browser. Meta's IWSDK announcement says "No headset needed". You need a headset before you call the game finished. Scale and comfort cannot be judged on a monitor.
Which is better for a VR game, Cursor or a chat app?
Cursor suits you if you are comfortable with a terminal and want to own the code. A chat app with a connector suits you if you want to play something soon and never open a code editor.
Why does my WebXR game say VR is not supported?
Two causes are common. The page is not served over HTTPS, and WebXR works only in a secure context. Or the browser finds no headset, as on a desktop with no headset connected and no emulator.
Is vibe coding good enough for a real VR game?
For a prototype, a game jam entry or a small arcade game, yes. For a commercial game, not on its own. Testers of the current tools describe the output as fit for prototypes, not for production.
Sources
- Not all AI-assisted programming is vibe coding (but vibe coding rocks), Simon Willison
- WebXR Device API, MDN
- Permissions and security for WebXR, MDN
- Secure contexts, MDN
- Geometry and reference spaces in WebXR, MDN
- VRButton, three.js docs
- WebXRManager, three.js docs
- WebGLRenderer, three.js docs
- Accelerate VR Development with AI and Immersive Web SDK, Meta
- Immersive Web SDK, Meta
- Project setup, Immersive Web SDK docs
- VRButton.js source, r187, three.js
- Debug Browser content, Meta
- Meta AI Agentic Workflow for WebXR development: how to get started and hands-on impressions, The Ghost Howls
- Vibe Coding XR: accelerating AI + XR prototyping with XR Blocks and Gemini, Google Research
- What is the Model Context Protocol?, Model Context Protocol
- Get started with custom connectors using remote MCP, Anthropic
- Developer mode, OpenAI
- Model Context Protocol (MCP), Cursor