Building a Rainy Night City with AI Coding Tools: A Practical Guide

    This article walks through building a rainy night city scene with an AI coding assistant, from turning a vague visual idea into a structured scene specification to iterating on proportions, lighting, rain effects, and detail density. It also covers common browser rendering bottlenecks and general optimization strategies, plus a reusable workflow for collaborating with code generation tools. Readers will learn how to write verifiable prompts, use single-variable tuning, and turn each conversation into a reusable scene recipe.

    1. Why a Rainy Night City Is a Good Test for AI Coding Tools

    A rainy night scene combines three types of difficulty. First is spatial proportion: street width, building height, and sign dimensions must stay coordinated, or the image immediately looks wrong. Second is dynamic effects: rain streaks, ground reflections, and flickering neon all need to be calculated frame by frame. Third is performance constraints: on the browser side, the scene must maintain an acceptable frame rate with limited computing power.

    These three points cover the collaboration friction most common in real projects, which makes the scene well suited for observing how an AI coding tool performs along the path from idea to runnable work.

    This article does not evaluate any specific product. Instead, it abstracts the process into a general workflow: you are working with an AI coding assistant that can generate code, and your job is to translate the image in your mind into a machine-executable specification and converge on a result through multiple rounds of feedback.

    2. Step 1: Turn the “Feeling” into a “Specification”

    Most people describe requirements by saying something like “I want that wet, warm glow spilling out of a convenience store.” That kind of description works for humans but carries too little information for a code generator. A more reliable practice is to first build a scene specification checklist:

    • Camera and viewpoint: fixed position or slow push-in, approximate field of view;
    • Spatial scale: street length, number of floors on each side, storefront width of the convenience store;
    • Light sources: key light (warm interior light), fill light (cool streetlight), accent light (neon signs);
    • Dynamic elements: type of rain (fine streaks or heavy drops), whether the ground has standing-water reflections;
    • Performance target: target frame rate, acceptable maximum number of draw calls.

    When handing the checklist to an AI coding tool, it is better to provide a structured description all at once rather than adding scattered details later. Structured input significantly reduces the number of “generate, discard, regenerate” cycles.

    A sample prompt skeleton looks like this:

    1. Scene: Three.js rainy night street, fixed camera, 45-degree field of view
    2. Scale: street 60 units long, 8 units wide, buildings 3 to 5 floors on each side
    3. Lighting: warm convenience store light (yellowish) + cool streetlight + two neon signs
    4. Dynamic: 4000 rain particles, semi-reflective ground
    5. Constraints: prioritize 60 FPS, merge draw calls as much as possible
    6. Output: a single HTML file that opens directly in a browser

    3. Step 2: Iterative Tuning Is the Main Work

    In practice, getting it right on the first try is the exception. The more common rhythm is to first get a runnable skeleton and then fix things one by one. Breaking feedback into verifiable small problems is the key to faster convergence.

    1. Proportion problems. When buildings look too tall or the street too narrow, do not vaguely say “the proportions are wrong.” Point out the specific relationship instead, for example, “the floor height is too large relative to the street width; compress the floor height by about 20%.” A verifiable description makes it easier for the tool to locate the specific parameter.
    2. Lighting problems. The core atmosphere of a rainy night comes from light and dark contrast. If the image looks washed out, ambient light is usually too strong and local light attenuation is missing. You can ask to “lower the ambient light intensity so the warm light forms a clear falloff at the store entrance.”
    3. Rain texture. More rain streaks are not always better. Too many particles blur into a white fog and lose the rainy night feel. A reasonable approach is to control the particle count while tilting the rain slightly along the line of sight to create a sense of wind.
    4. Detail density. Small objects such as sign text, steps, air conditioner outdoor units, and manhole covers determine realism, but they should be added in layers, main structure first and accents later, to avoid piling everything on at once and creating a messy structure.

    A practical iteration template:

    1. Current issue: overall too bright, lacking night atmosphere
    2. Expected: lower ambient light, keep only the warm store light and two neon signs
    3. Adjust only lighting-related parameters and keep the geometry unchanged

    The constraint “change only one type of parameter and keep the rest unchanged” is very important. It prevents the tool from breaking parts you are already satisfied with while fixing one problem.

    4. Step 3: Balancing Performance and Visuals

    Common browser rendering bottlenecks concentrate in three places: too many draw calls, too many particles, and overly heavy reflection calculations. General optimization approaches include:

    • Merging geometry: combine static walls, curbs, and similar objects into a small number of meshes to reduce draw calls;
    • Restraining particles: use fewer particles with textures or gradient transparency to simulate a curtain of rain, which is more cost-effective than simply piling up quantity;
    • Simplifying reflections: approximate the wet ground with low-intensity reflection plus a highlight gradient instead of full real-time reflection;
    • Tiered loading: use simplified models for distant buildings and invest detail only in the foreground.

    Sample code (illustrating the idea only, not a specific API):

    1. // Merge static geometry to reduce draw calls
    2. const staticParts = [];
    3. function addStatic(mesh) { staticParts.push(mesh); }
    4. // Choose rain particle count by performance tier
    5. const RAIN_LEVELS = { low: 1500, mid: 3500, high: 6000 };
    6. const rainCount = RAIN_LEVELS[tier] ?? RAIN_LEVELS.mid;

    When tuning, it is recommended to use the single-variable method: change only one dimension at a time, observe the difference in frame rate and visuals, and record it to build your own parameter baseline. After several rounds, you will accumulate a reusable scene recipe.

    5. Turning Conversations into Assets

    The greatest value of this kind of practice is not just producing a work, but distilling transferable collaboration experience:

    • Specification first: a structured scene checklist reduces rework more than emotional description;
    • Small-step feedback: solve only one type of problem at a time and explicitly state “do not change anything else”;
    • Verifiable standards: replace vague wording with measurable statements such as “compress floor height by 20%” or “frame rate not below a certain value”;
    • Layered construction: proceed in order through main structure, lighting atmosphere, detail accents, and performance optimization;
    • Version tracking: keep each runnable intermediate version for easy rollback and comparison.

    6. Conclusion

    Building a rainy night city with an AI coding tool is essentially a training exercise in “turning imagination into engineering.” The tool converts descriptions into code, while the person defines clear goals, breaks down problems, and sets acceptance criteria. Once this workflow runs smoothly, the path from inspiration to a work that runs in a browser and can be played with repeatedly will be shorter than expected.