LLM-Driven FPS Game Development: Achieving 3A-Grade Visuals for a Rainy Harbor Port Scene — Real Timings, Prompts and Pitfalls
A complete walkthrough of generating a playable rainy-harbor FPS demo with a large language model, from scene setup to gameplay and HUD. It covers the four coupled technical gates of FPS work (spatial composition, materials and lighting, gameplay consistency, performance budget), how to turn them into measurable acceptance criteria, the exact Three.js r160 + WebGL2 configuration used, a layered prompting workflow with verbatim prompt fragments and interface contract templates, and engineering practices for build, observability, log redaction and asset licensing. It also records the actual cost of the run: seven generation rounds, roughly three hours of generation plus four hours of human review and rework, with rework concentrated on wet-ground reflections, per-frame enemy AI and duplicated HUD state.
Generative LLMs can compress a playable FPS prototype with 3A-grade visuals and a working gameplay loop from weeks into days — but only if you manage the model like a small team: set a budget, write contracts, verify the data. This article records the full generation process for a rainy-harbor FPS demo, including verbatim prompts, real timings, and the pitfalls encountered along the way.
A note on the code samples: all examples in this article target Three.js r160 + WebGL2 with a PBR pipeline. The “reference scene” mentioned below refers to a comparable rainy-harbor shooter scene used for comparison only. All art assets in this demo are self-made or sourced from properly licensed asset libraries; no assets from the reference work are reproduced here.
1. Why an FPS demo is the hardest test for generative models
A playable first-person shooter demo may look small, but it simultaneously stresses the hardest parts of a generative model’s capability stack:
- reading a reference image and reproducing its composition,
- reasoning about layout and player flow in three-dimensional space,
- designing interfaces between multiple modules that do not contradict each other,
- maintaining code consistency across a long context window.
Compared with generating a script or a static page, it has one brutal property: whether it runs is judged objectively. A broken render pipeline, a raycast that goes through walls, out-of-sync state — none of these are “feels wrong” problems. They are pass/fail.
We therefore use this kind of demo to measure a model’s level on three dimensions: image comprehension, hard reasoning, and software engineering ability. Every asset, scene, gameplay mechanic, and HUD element in the demo below was produced by a generative model across multiple dialogue turns; human work was mainly acceptance testing, tuning, and integration.
What “3A quality” means in this article: correct PBR material tiering at 1080p, real-time shadows and atmospheric perspective, complete particle and post-processing layers, and a stable 60 fps on mid-range hardware. It is a reduced-scale sample, not team-level production capacity.
2. Breaking down the technical challenges: four gates and a quantified budget
| Gate | Core problem | Typical failure mode |
|---|---|---|
| Spatial composition | 3D layout, depth layering, sightline guidance | Empty scenes, no sense of pressure, players get lost |
| Materials and lighting | Roughness/metalness tiering, lighting layers, atmospheric perspective | Plastic look, near and far blur together, no backlit rim |
| Gameplay consistency | State sync for health, ammo, objective progress, etc. | UI disagrees with actual state, missions deadlock |
| Performance budget | Draw calls, polygons, texture and shadow cost | Frame-rate cliffs, unusable on low-end devices |
These four gates are coupled. Stack up smoke and shadows for atmosphere, and the performance budget collapses immediately. Cut prop instances for performance, and the flow guidance disappears. So the order must be budget first, art second, game feel last.
The budget has to be expressed as numbers that can be verified. We wrote these directly into the prompt:
- Target hardware: Snapdragon 7-series / Apple A13 class; 1080p resolution.
- Frame-rate floor: average ≥ 60 fps, 1% low ≥ 45 fps.
- Draw calls: ≤ 300; main scene ≤ 1.5 million triangles.
- Texture VRAM: ≤ 512 MB, single texture ≤ 2K.
3. Scene construction: turning “rainy harbor” parameters into a reproducible spec
The reference scene depicts a harbor at dusk after rain: the cloud deck has cracked open, low-angle sunlight cuts diagonally through the container lanes, a film of water still covers the ground, and in the distance the crane’s steel frame is half-swallowed by fog.
Why dusk after rain rather than night in rain? A rainy night needs complete harbor lighting and volumetric light just to hold the image together — far more expensive than this demo’s budget allows. Dusk after rain, by contrast, can deliver rim light, long shadows, and wet-ground highlights from a single directional light, which is by far the best value for money.
Tech stack and parameter conventions (read this before copying the config)
- Rendering: Three.js r160 + WebGL2, PBR metalness/roughness workflow.
angleis the elevation angle (the angle between the light and the horizontal plane, in degrees), not an altitude. 12° corresponds to the low angle of dusk.fog.densityis exponential fog density, in units of 1 per unit of scene length; typical range 0.01–0.03.intensityis a relative value in Three.js physical light units: directional light 2–3, ambient light 0.3–0.5, point light 1–2.- Shadows: 2048-class shadow map on the directional light, PCFSoft sampling.
- Wet-ground reflections need extra configuration:
clearcoat = 1.0,clearcoatRoughness ≈ 0.08, plus screen-space reflections (SSR) or a reflection probe. Tuningmetalnessalone will not produce a water film — water is not metal.
Modular geometry
Containers, forklifts, barricades, and stacked pallets are classic reusable props. Render them with InstancedMesh instancing to keep draw calls under control. Layered stacking forms a natural skyline occlusion; sightlines are pressed into the lanes, and the sense of pressure comes from “not being able to see what is around the next corner.”
Material tiering
Metal containers get medium roughness with high metalness. Wet ground gets low roughness plus a clearcoat water film. Concrete and fabric stay at high roughness, which creates contrast.
Three lighting layers and atmospheric perspective
The low-angle key light supplies direction and a backlit rim; ambient light lifts shadow visibility; local point lights inside the lanes create guiding highlights. Fog attenuates with distance, fading the far cranes and reinforcing depth. Finally, tone mapping, slight bloom, and subtle camera shake pull all of these elements into a single military-shooter mood.
// Scene parameter example (Three.js r160; `angle` is the elevation angle, in degrees)const scene = {fog: { color: 0x8a7f74, density: 0.018 }, // warm grey fog, dusk after rainlight: [{ type: 'dir', angle: 12, intensity: 2.4, color: 0xffd2a1 }, // low-angle key light{ type: 'ambient', intensity: 0.35 },{ type: 'point', pos: [8, 3, -12], intensity: 1.6, range: 14 }],shadow: { mapSize: 2048, type: 'PCFSoftShadowMap' },material: {wetGround: { roughness: 0.12, metalness: 0.0, clearcoat: 1.0, clearcoatRoughness: 0.08 },container: { roughness: 0.55, metalness: 0.8 }},reflection: { ssr: true, probeResolution: 256 },post: { toneMap: 'filmic', bloom: 0.35, vignette: 0.25 }};
Key takeaway: scene parameters must be externalized as configuration, not hard-coded. That way the model can iterate on tuning without touching logic, and artists can swap the visual style without changing code.
4. Gameplay systems: authoritative state and game feel in a classic FPS loop
The gameplay uses a highly conventional structure: the harbor’s defense system has gone rogue, and the player moves through the container yard, warehouses, and docks, cuts three relay nodes, and finally breaks through the blockade to board a ship and extract. This “objective → combat → advance” skeleton is durable precisely because the state model is unambiguous.
State model
- Player state machine: idle, moving, aiming, firing, reloading, taking damage, dead.
- Weapon logic: fire rate, recoil curve, magazine and reserve ammo, reload duration, damage falloff.
- Enemy behavior trees: patrol → detect → pursue → engage → lose contact and fall back, with separate branches for air and ground units.
- Mission state machine: each relay is inactive / activating / cut; once all three are cut, the extraction point opens.
// Main loop: fixed timestep + render interpolation (physics decoupled from rendering)const STEP = 1 / 60;let acc = 0, last = performance.now();function frame(now) {acc += (now - last) / 1000; last = now;while (acc >= STEP) {const input = sampleInput();player.update(STEP, input);weapon.update(STEP, player.firing);enemies.forEach(e => e.tick(STEP, player.position)); // enemy AI polled on a 10Hz time slice, not `think` every framemission.update(STEP);acc -= STEP;}render(acc / STEP); // the render layer only interpolates, it does no state computationhud.sync(player, weapon, mission); // single source of truthrequestAnimationFrame(frame);}
Authoritative state and game feel
HUD values such as health, ammo, and objective distance must all come from the same authoritative state. Any approach that “recomputes them separately in the render layer” turns into a bug that is hard to reproduce later on. The render layer only interpolates and never participates in judgment.
In addition, game feel is not decided by parameter sweeping alone: animation blending and root motion affect movement and firing timing; collider dimensions and capsule radius determine how the player hugs walls or gets stuck in doorways; aim-assist strength changes hit perception substantially. List all of these as independent modules in the prompt — do not expect a single generation pass to nail them.
5. Prompt engineering: layered prompt text and acceptance criteria
One-shot generation can produce a demo. Stable production requires layers.
- Goals and acceptance criteria (quantified): Three.js r160, 1080p, Snapdragon 7-series target averaging ≥ 60 fps; the player can complete the full run of “cut three relays + board the ship and extract”; a single session lasts 5–8 minutes.
- Technical constraints: language and rendering approach, directory structure, forbidden dependencies; character animation limited to idle / run / fire / hit-reaction only, no facial animation; ≤ 12 sound effects, each ≤ 10 seconds; textures uniformly 1024 or 2048. This must be stated explicitly: 3A is team-level production capacity, and this demo is only a reduced-scale sample.
- Module list and interface contracts: agree on module boundaries and function signatures before implementation details.
- Module-by-module implementation: scene → player controls → weapons → enemies → mission → HUD → tuning.
- Integration and game-feel tuning: one dedicated round for parameter adjustment.
Verbatim fragment of the layer-2 prompt:
Tech stack is locked to Three.js r160 + WebGL2; no third-party libraries beyond a physics engine are allowed.Rendering: PBR metalness/roughness workflow, 2048 directional shadow map, PCFSoft enabled.Performance red lines: at 1080p, draw calls <= 300, main scene <= 1.5M triangles, texture VRAM <= 512MB.Content scope: character animation limited to idle/run/fire/hit-reaction only, no facial animation;audio <= 12 clips, each <= 10 seconds; textures uniformly 1024 or 2048.Output order: give the directory structure and module signatures first; implement them one by one only after I confirm.
Interface contract template:
Module name: WeaponSystemSignature: fire(now: number, origin: Vector3, dir: Vector3) -> HitResult | nullInputs: `now` is the authoritative clock in seconds; `origin`/`dir` are supplied by the player state machine, in scene unitsOutput: HitResult { targetId, point, damage, falloff }Error contract: return null when ammo is 0 or a reload is in progress — do not throw;when `origin` is invalid (NaN), log a warning and discard the call
Acceptance criteria are quantified the same way: target hardware + resolution + frame-rate floor + the ability to complete all three mission stages. Check every item after each generation round rather than relying on “looks close enough.”
The iteration cadence is grey-box first, then art, then game feel. Working in the reverse order — chasing visuals first — usually forces major rework during logic integration.
6. Engineering and delivery: log redaction and asset licensing
- Build and hosting: the output is static assets, so it can be hosted on object storage behind a CDN to reduce first-paint latency, with versioned directories enabling rollback.
- Asset pipeline: compress textures into a general-purpose format and generate mip levels, standardize audio encoding, and set distance-based LODs on models.
- Observability (mind compliance): wire up logging and monitoring to collect first-frame time, average frame rate, and exception stacks. Logs must redact user identifiers and IP addresses. Raw prompts and player input text are not collected by default; if collection is necessary, truncate and mask them first, and limit both the field list and the retention period (for example, 7 days).
- Compliance and security: confirm the licensing source of every art and audio asset and keep the receipts. If a third-party model is used for fine-tuning, confirm that the personal information in the training data and the provenance of any code are compliant, and abide by the relevant model service terms. Front-end logic can never be truly protected, so anything involving scoring and leaderboards must be validated server-side.
7. Common pitfalls in LLM-generated FPS games, and countermeasures
- Context drift: variable names and interfaces gradually diverge over a long conversation. Countermeasure: maintain a list of interface contracts and feed it back into the prompt after every round.
- Hallucinated interfaces: calls to properties or functions that do not exist. Countermeasure: verify in small steps — get each module running on its own before moving on.
- Out-of-control performance: generating props one at a time causes draw calls to spike; having enemies run
thinkevery frame also drives CPU cost up. Countermeasure: introduce instancing and batching early, and poll AI by distance and on a time slice. - Missing game feel: animation blending, root motion, collider dimensions, and aim assist all affect feel; parameter sweeping is only one part of the job.
FAQ: what problem does this practice actually solve?
- What it is: using a generative LLM to produce a runnable, acceptance-testable FPS gameplay prototype, not a one-off demo.
- How it works: budget first → interface contracts → module-by-module generation → grey-box integration → art and game feel, checking against quantified acceptance criteria throughout.
- What to watch for: context drift, hallucinated interfaces, log redaction, and asset licensing — the four areas most likely to go wrong.
8. Measured data: how many rounds it took, and where the rework happened
In this run, the scene and gameplay skeleton went through 7 generation rounds in total: 2 rounds for the scene config (round 1 set fog color and key light to mutually exclusive values — rainy night plus low-angle sunlight; round 2 switched to dusk after rain), 2 rounds for player and weapons, 1 round for enemy AI, 1 round for mission and HUD, and 1 round for performance and game-feel tuning.
Total generation time was about 3 hours, with about 4 hours of human acceptance testing and rework. Rework concentrated in three places: wet-ground reflections (clearcoat and SSR were missing), frame-rate jitter caused by enemies running think every frame, and HUD values recomputed in the render layer and therefore inconsistent with the logic.
The conclusion is plain: better models really do compress a prototype that used to take a small team weeks into days — but only under a bounded visual scope and explicit acceptance criteria. What ultimately determines quality is engineering discipline: budget first, interfaces first, a single source of state, and verification in small steps. Lock that in, and generative tools become production capacity rather than a demonstration.
