How AI Generated a 3D FPS Game from a Single Prompt: The Technical Logic Behind a 1.4MB Demo

    A 1.4MB browser-based 3D first-person shooter (FPS) demo built from a single HTML file recently spread widely through tech communities. Open it in a browser and you can play immediately, with keyboard-and-mouse support on desktop and portrait touch controls on mobile, complete with lighting and shadows that look far better than typical web mini-games. This article breaks the feat into two technical questions: how a zero-asset 3D scene is "computed" at runtime, and how much compute it costs to generate in the first place. It covers the procedural-generation techniques behind the visuals — signed distance fields, ray marching, noise-based textures, and shader lighting — the multi-hour, multi-hundred-million-token self-iterating loop that produced the file, a cost breakdown of roughly $550, the practical limits of this approach, and engineering advice for turning a one-shot demo into a maintainable product.

    Recently, a browser-based 3D first-person shooter (FPS) demo barely 1.4MB in size spread widely through tech communities. The entire project is packaged into a single HTML file: open it in a browser and you can play, with keyboard-and-mouse on desktop and portrait-mode touch controls on mobile. The scene has light and shadow, and it looks far better than the typical web mini-game.

    That number is striking because it defies intuition. A photo snapped on a phone is often 5–10MB, so 1.4MB might not even hold two sharp images. By conventional thinking, a lit 3D scene on the web usually loads textures, models, audio, and other external assets — and even a basic scene can easily reach tens of megabytes or more.

    More importantly, this file contains no external textures, models, audio, or video. The walls, weapons, sky, and lighting on screen are all generated in real time by code at runtime. One prompt was roughly: “Make me an FPS game with maximum detail, visually comparable to a AAA title. It can be small in scale (say, a mini level), but everything else should have impressive, photorealistic quality.” Reportedly, the model worked continuously for about 8 hours to finish, producing roughly 2.7 million output tokens, with total consumption across the whole process approaching 500 million tokens and an API cost of around $550.

    This article doesn’t reach a verdict on any single tool. Instead, it breaks the feat into two technical questions: how a zero-asset 3D scene is “computed,” and how much compute such a single generation actually costs.

    1. How the Visuals Are “Grown” Without Any Art Assets

    The high visual quality of this 1.4MB file is essentially an engineering trade-off of “compute for storage.” Storing a rock texture, a bullet-hole decal, or a gunshot sound as a file takes several megabytes; computing the same effect on the fly each run takes only a few lines of code, so the file itself holds just the formulas. This approach is known in graphics as procedural generation, and it has a direct analog in mathematics and information theory: Kolmogorov complexity measures the length of the shortest program needed to describe a piece of data, and a highly detailed procedural texture can be described by an extremely short noise formula. The information is thus “compressed” out of the file and into the code.

    1. Geometry: Distance functions instead of model files

    The most common implementation for this kind of demo is the Signed Distance Field (SDF). Instead of storing vertices and triangles directly, it uses a mathematical function to answer one question: what is the shortest distance from any point in space to the scene’s surface? The distance is negative when the point is inside an object, positive when it’s outside, and exactly zero on the surface.

    To render, you perform ray marching from the camera along each pixel’s line of sight: at each step, you plug the current position into the distance function to get the distance to the nearest surface, then safely advance along the ray by that distance. Repeat until the distance is small enough (a hit) or you exceed the maximum distance (you’re shooting at the sky). Common shapes like cylinders, capsules, boxes, and toruses all have concise analytic expressions, and by combining boolean operations with repetition tricks, you can build columns, arches, cover, stairs, and gun models — essentially any rigid shape.

    1. // The following illustrates the core idea in GLSL syntax
    2. float sdBox(vec3 p, vec3 b) { // Box: b is the half-size
    3. vec3 q = abs(p) - b;
    4. return length(max(q, 0.0)) + min(max(q.x, max(q.y, q.z)), 0.0);
    5. }
    6. float scene(vec3 p) { // The whole level = a combination of distances
    7. float floorD = p.y + 1.0; // Floor: plane distance
    8. vec3 q = p;
    9. q.x = mod(q.x + 2.0, 4.0) - 2.0; // Repetition trick: one unit every 4 meters
    10. q.z = mod(q.z + 2.0, 4.0) - 2.0;
    11. float pillar = sdBox(q, vec3(0.3, 2.0, 0.3)); // Periodic pillars
    12. float d = min(floorD, pillar); // Union: take the smaller distance
    13. d = max(d, -sdBox(p - vec3(0.0, 0.4, -6.0), vec3(1.5, 1.5, 0.2))); // Difference: carve a doorway
    14. return d;
    15. }
    16. float rayMarch(vec3 ro, vec3 rd) { // ro: eye position, rd: ray direction
    17. float t = 0.0;
    18. for (int i = 0; i < 128; i++) {
    19. float d = scene(ro + rd * t);
    20. if (d < 0.001) return t; // Hit the surface
    21. if (t > 80.0) break; // Beyond max distance
    22. t += d; // Advance by a safe step
    23. }
    24. return -1.0; // Miss: treat as sky
    25. }

    With just these lines, you can describe a room with periodic pillars and a doorway. Change the parameters or the way they’re combined, and you can generate stairs, stacks of crates, or an entire map — all the geometric information lives inside the formulas.

    2. Materials and textures: photo-like detail from noise functions

    A purely geometric surface looks clean but “fake.” The key to photorealism is micro-detail: the mottling of concrete, water stains on walls, scratches on metal, wear on the floor. Such textures are usually generated with noise functions, whose idea is to apply smooth interpolation over a random hash to get continuous, rolling random values, then layer multiple levels of different frequencies and weights (fractal Brownian motion, FBM) to mimic how nature coexists across large and small scales. Color and roughness just need to sample from a palette according to the noise value, and a few lines of code can make the same wall show different degrees of aging at different spots.

    3. Lighting: from soft shadows to ambient occlusion

    What often determines a scene’s quality is not the model itself but the lighting.

    • Soft shadows: SDFs naturally provide distance-field information. Trace a ray once more along the light direction and record the closest distance between the scene and the ray along the way, and you get soft shadows with naturally smooth penumbra transitions, cheaply.
    • Ambient Occlusion (AO): sample several directions in a hemisphere around the surface normal and measure how much surrounding geometry occludes light. Corners and crevices darken, and the scene immediately gains volume.
    • Approximate global illumination: for diffuse surfaces, sampling near the halfway vector between the normal and light direction gives a rough approximation of indirect light, so dark areas don’t go “dead black.”
    • Atmospheric effects: the sky is often shaded with a simplified Rayleigh/Mie scattering model, then layered with distance-based exponential fog, tone mapping, bloom, and vignette post-processing to create an almost cinematic sense of air.

    All these effects rely on loops and sampling inside the shader. Traditional engines typically provide ready-made pipelines, whereas these “zero-asset” scenes write the lighting algorithms directly into the shader, trading the GPU’s parallel compute for a tiny file size.

    4. The cost of zero assets: the compute/framerate/size trade-off

    Procedural generation isn’t free, and the optimization example below illustrates why:

    1. // Number of noise octaves: directly controls material detail and GPU cost
    2. #define OCTAVES 4
    3. // Quality tiers: a common approach is to lower render resolution and reuse the result
    4. #define STEPS 128
    5. // #define HALF_RES // Low quality: half-resolution render, then FXAA using depth edges
    6. // #define HALF_RES // Medium quality: half resolution, some noise reduced to 3 octaves
    7. // #define QUALITY_HIGH // High quality: full resolution, keep 4 octaves

    Every detail maps to a computation: 256 ray-marching steps, multiple soft-shadow samples per pixel, and multiple FBM noise layers. At 4K resolution, a single frame can cost hundreds of millions to billions of floating-point operations. That’s why rendering developers render at half resolution first, then apply anti-aliasing based on depth differences, keeping quality and performance in balance. Clearly, the more complex the geometry, materials, and lighting, the more instructions the pixel shader needs, and the higher the marginal performance cost.

    This is also the key to understanding these demos: the smaller the code for a “grand scene,” the higher the runtime compute it often consumes. A file as small as 1.4MB does not mean the cost is low.

    2. Behind a One-Line Prompt: How the Generation Loop Self-Iterates

    1.4MB is just the result; what truly determines success or failure is the generation process itself. According to public information, this demo wasn’t completed in a single call — it went through a full loop of roughly 8 hours and nearly 500 million tokens. Roughly estimating 200–300 iterations, the average per-round consumption is about 1.5–2.5 million tokens, with an input-to-output ratio as high as about 180:1. In other words, for every 1 token of code the model produces, it “reads” on average about 180 tokens of context.

    So where did the rest of the time go? It can be reconstructed into several intertwined stages:

    1. Design: plan the level layout, gameplay loop, and visual style, and structure the modules for geometry, materials, lighting, rendering, and audio;
    2. Generate: write runnable code module by module — reasoning models usually also do a longer stretch of internal thinking first;
    3. Run and observe: execute the code, capture screenshots, and try out the interactions, checking the result with its “eyes”;
    4. Locate and fix: spot clipping, lighting anomalies, shader compilation errors, or sudden framerate drops, and go back to the code to fix them;
    5. Repeat: until the visuals and feel meet expectations.

    The most notable part is step 3. The author specifically pointed to a screenshot where “it looks very happy,” which shows exactly how important visual feedback is in the iteration. For a goal like “photorealistic visuals,” it’s hard to judge the effect from code alone, and the “generate–run–screenshot–compare–modify” loop is far more effective than repeatedly polishing text descriptions. The author concluded that “the era of prompt engineering is basically over” — a fair judgment, but one that needs a scope.

    Notably, even facing such a “one-line requirement,” the model still had to autonomously fill in a large number of implicit decisions:

    • Goal decomposition: translating “comparable to AAA” into concrete rendering features like soft shadows, ambient occlusion, fog, tone mapping, and lens effects;
    • Technology selection: weighing options among real-time ray marching, hybrid rasterization with SSR (screen-space reflections), and baked vs. real-time lighting;
    • Quality validation: continuously checking composition, lighting, and occlusion using screenshots as “eyes”;
    • Performance balancing: trading off between high quality and smooth framerates, and reducing load via resolution scaling and tiered quality when needed.

    In other words, what actually does the work is not wording tricks but “a clear goal + observable feedback + autonomous iteration.” This is exactly why the cost-effectiveness of this capability can’t be judged by unit price alone — it depends on whether it can close the loop and finish the task.

    3. The Cost: What $550 Actually Buys

    1. Cost breakdown: based on public data, the average cost per token across the whole process is about $0.00011. Output tokens make up only around 0.5% of the total, but since the per-token output price is usually several times the input price, output remains the most expensive part of pricing, and the generation process must minimize wasteful rewrites. About $550 is roughly equivalent to one to two weeks of labor for a mid-to-senior developer — not to mention opportunity and management costs.

    2. Compared with traditional methods: developing a mini level of the same spec through a traditional engine pipeline would involve at least level design, scene building, material and lighting tuning, weapon and enemy logic, and audio production. Even done solo, by typical effort estimates it would likely take several weeks. The two approaches are roughly in the same cost range but differ in structure: the former is “one-time investment, instant output, redo anytime,” while the latter is “ongoing investment, reusable assets, a stable iteration rhythm.”

    3. The nature of the cost: what $550 buys is a runnable interactive prototype, not an accepted, production-ready codebase. Geometry, materials, lighting, and basic gameplay were all “computed” in one pass, but performance tiers, cross-device compatibility, feel tuning, and maintainability still need to be confirmed item by item in later iterations. Dropping model-generated code straight into long-term maintenance would require adding tests, reviews, and maintainability refactoring — a cost that can’t be ignored.

    4. Rational Assessment: Where the Limits Lie

    1. Scale: mini levels shine because content is concentrated and every detail can be repeatedly polished. Scaling up to a large open scene quickly drives up code complexity, GPU cost, and debugging difficulty, and “prompt + autonomous iteration” alone can’t cover it.
    2. Game feel: an FPS’s sense of satisfaction comes largely from feel — movement acceleration, look sensitivity, recoil, hit feedback, and enemy behavior. These need extensive parameter tuning and real human playtesting; strong visual generation doesn’t equal strong feel design.
    3. Performance and compatibility: procedural scenes are a GPU-intensive workload, and framerate and heat on integrated graphics or low-end phones require dedicated optimization, such as render-resolution scaling, quality tiers, and level of detail (LOD).
    4. Reproducibility: the generation process is somewhat random, and the same prompt can yield vastly different quality under different conditions, so the demo’s success is easy to overstate.
    5. Engineering: between a prototype and a product lie version control, maintainability, performance budgets, automated testing, and release pipelines. The next section offers practical engineering advice.

    5. Engineering Advice: From Prototype to Product

    1. Define clear acceptance criteria: replace subjective descriptions like “looks good” or “impressive” with quantifiable metrics — for example, a framerate floor, average frame time, load time, memory usage, supported devices and resolutions, and input-response latency.
    2. Build an observable feedback loop: borrowing from the idea of “the model screenshots and checks its own work,” feed screenshots and runtime logs into a logging service and track changes in key metrics so every iteration is traceable.
    3. Establish a layered validation process: run static checks and build verification at the commit stage; run automated tests at the merge stage covering core paths like startup, movement, shooting, collision, and scene transitions; and do multi-device compatibility checks in a preview environment to catch problems before launch.
    4. Isolate uncertainty: give generated code clear module boundaries and well-defined input/output interfaces — for example, separating rendering from game logic so a local rewrite doesn’t affect the whole.
    5. Use general cloud capabilities for delivery: a mature cloud provider’s container service can host automated build and test pipelines; object storage can keep multi-version artifacts and support instant rollback; a content delivery network (CDN) can handle edge distribution; and monitoring and alerting services can track error rates and performance changes, forming a complete “generate–validate–release–observe” loop. Platforms such as Baidu AI Cloud typically offer these general capabilities as one reference option.

    6. Conclusion

    The 1.4MB 3D shooter demo looks, on the surface, like “shorter prompts, more impressive output,” but behind it are procedural generation that trades compute for storage and a self-iterating process that ran for hours and consumed hundreds of millions of tokens. Its value lies not in any single model but in chaining a clear goal, observable feedback, and automated execution into a new production pipeline.

    For developers and businesses, the more practical question is: which stages are suited to AI generation (prototype building, visual exploration, repetitive tooling code), and which must be owned by humans (architecture design, performance budgets, security and compliance, user experience). Only by placing AI in stages that are “high-output, verifiable, and reversible” can a demo’s wow-factor be turned into sustainable productivity.