Evaluating LLM Web Generation Capabilities: From UI Replication to Strategy Game Development

    As large language models (LLMs) evolve to handle code generation, page design, and interaction logic, developer evaluation has shifted from isolated code snippets to complete application prototypes. This article evaluates LLM web generation capabilities through two representative tasks: replicating a classic draggable desktop window interface and building a real-time strategy web game. We explore the changing criteria for web generation, technical implementation details, the importance of phased prompt iteration, and how to establish an objective model evaluation process for application prototyping.

    As LLMs gradually acquire the ability to generate code, design pages, and implement interaction logic, developers’ focus when evaluating models has shifted from “can it generate a piece of code” to “can it complete a relatively complete application prototype based on natural language.” Especially in web applications and lightweight game development scenarios, models must simultaneously handle visual layout, state management, user interaction, algorithm logic, and runtime debugging, which places higher demands on comprehensive reasoning capabilities.

    This article selects two representative testing directions: first, replicating a classic desktop OS-style draggable window interface, and second, implementing a web game with real-time strategy mechanics. Through these two tasks, we can comprehensively observe the LLM’s actual capabilities in requirement decomposition, code organization, visual implementation, and feature iteration.

    1. The Changing Evaluation Standards for Web Generation

    Traditional code generation tests often only focus on whether a function runs correctly. For web applications, however, the final result is usually determined by multiple dimensions:

    1. Structural Correctness: Whether the page loads normally and whether there are obvious conflicts between components.
    2. Interaction Completeness: Whether buttons, windows, dragging, scaling, and switching operations work as expected.
    3. Visual Fidelity: Whether colors, shadows, borders, transparency, icons, and layout match the target style.
    4. State Management Capability: Whether state changes across multiple components remain consistent.
    5. Extensibility and Maintainability: Whether the generated code is easy to modify further, rather than being a one-time showcase.
    6. Exception Handling: Whether the page remains stable when inputs are missing, resources are insufficient, or operations conflict.

    Therefore, a page that “looks runnable” does not equal a high-quality generation result. What truly matters is whether the model can transform abstract descriptions into an executable, verifiable, and iterable implementation plan.

    2. Desktop Window Tasks: Visual Effects and Interaction Logic Matter Equally

    In the first test, the goal is to build a web interface with a classic desktop style, implementing window dragging, layer switching, and 3D window switching effects. While this requirement appears to be standard front-end development, it actually encompasses several technical challenges.

    2.1 Core Implementation of Draggable Windows

    A complete window dragging function must handle the following states at a minimum:

    • Current position coordinates of the window;
    • Initial position of the mouse or touch pointer;
    • Offset between the window and the pointer when pressed;
    • Whether the current window is in a dragging state;
    • Whether the window should be brought to the front layer.

    During implementation, you cannot simply bind the window position to the pointer coordinates; otherwise, the window will jump when dragging begins. A more reasonable approach is to record the offset at the moment the pointer is pressed:

    1. const offsetX = pointerX - windowX;
    2. const offsetY = pointerY - windowY;
    3. function onMove(pointerX, pointerY) {
    4. windowX = pointerX - offsetX;
    5. windowY = pointerY - offsetY;
    6. }

    Additionally, drag events should ideally be bound to a unified pointer event system rather than handling mouse and touch devices separately. This reduces browser differences and improves mobile compatibility.

    2.2 Window Layer Management

    When multiple windows coexist, users typically expect a clicked window to immediately display at the front. To achieve this, you must maintain a layer value (z-index) for each window, increment a global layer counter upon clicking a window, and assign the latest value to the current window.

    If the model only implements position changes without designing layer management, overlapping windows will result in click failures and occlusion issues. Therefore, when evaluating generated results, you should not only check if a single interaction works but also test stability when multiple components are used together.

    2.3 Difficulties in Semi-Transparent Visual Effects

    Glassmorphism interfaces typically rely on a combination of semi-transparent backgrounds, backdrop blur, soft shadows, and thin borders. Simply increasing transparency does not yield good visual results; you must also consider:

    • Whether the background content is rich enough; otherwise, the blur effect is unnoticeable;
    • Whether there is sufficient contrast between foreground text and the background;
    • Whether shadows are too heavy, making the interface look muddy;
    • Different browser support variations for background filters;
    • Whether stacking semi-transparent layers causes color distortion.

    This demonstrates that visual fidelity is not simple style concatenation but requires the model to have a certain understanding of design. Even if the functionality is entirely correct, unreasonable button proportions, spacing, shadows, and transparency control will cause the final result to deviate noticeably from the requirements.

    3. Complex Game Tasks: Testing Comprehensive Reasoning Capabilities

    Compared to simple UI replication, strategy games are better suited for testing whether an LLM can understand complex requirements. This is because they require not only generating an interface but also implementing a set of interconnected rules.

    The testing goals can be summarized as follows:

    • Transforming traditional turn-based progression into real-time execution;
    • Adding auto-research or intelligent assistance mechanisms;
    • Enabling units to automatically find enemy targets;
    • Providing speed adjustment controls;
    • Using a hexagonal map;
    • Supporting keyboard controls for the camera view;
    • Adding intuitive icons for cities, units, and resources.

    These requirements are not isolated. Speed changes affect unit movement, resource growth, and research progress; auto-targeting requires map coordinates and pathfinding; and hexagonal grids alter the calculation of adjacent nodes. Therefore, the model must first establish an internal rule system before generating the page and code.

    4. Implementation Key Points for Real-Time Strategy Mechanics

    Transforming turn-based mechanics into real-time mechanics is not about deleting the “End Turn” button, but rather establishing a time-based update loop.

    A common approach is to use timers or animation frames to perform the following operations during each update:

    1. Calculate the time elapsed since the last update;
    2. Update resources based on the time increment;
    3. Advance unit movement;
    4. Check attack ranges and combat states;
    5. Update research progress;
    6. Determine victory, defeat, or end conditions;
    7. Refresh the interface state.

    The pseudocode is as follows:

    1. function update(deltaTime) {
    2. updateResources(deltaTime);
    3. updateResearch(deltaTime);
    4. updateUnits(deltaTime);
    5. resolveCombat(deltaTime);
    6. checkGameState();
    7. render();
    8. }

    The most common issue with real-time mechanics is “speed unfairness.” If values are increased by a fixed amount per loop, different devices’ refresh rates may cause the game speed to vary. A more reliable solution is to calculate using time differences, allowing all behaviors to advance based on actual elapsed time.

    The speed slider should also apply to a unified time multiplier (e.g., multiplying actual time by speedFactor) rather than modifying each system’s timer individually. The latter approach easily causes desynchronization among resources, movement, and combat.

    5. Auto-Research Features Reflect Requirement Understanding

    Auto-research is not a standard feature in traditional strategy games, so the model needs to correctly understand the systemic implications behind the requirement to “automatically complete research when resources allow.”

    A basic research system should include:

    • Tech nodes;
    • Prerequisites;
    • Research costs;
    • Research time;
    • Current research status;
    • Auto-select strategy;
    • Pause logic when resources are insufficient.

    If intelligent assistance is enabled, the system can select targets based on the tech tree sequence, resource yields, military needs, or user-defined priorities. Even without implementing a complex decision-making algorithm, it must at least ensure that auto-research does not repeatedly select completed nodes, does not consume non-existent resources, and correctly waits when resources are insufficient.

    The value of such features lies in testing whether the model can distill a state machine from a single natural language description, rather than merely generating a superficial toggle button.

    6. Auto-Targeting and Hexagonal Maps

    Auto-targeting typically involves three steps:

    1. Filter attackable targets from the current set of units;
    2. Sort them by distance, threat level, or target type;
    3. Use pathfinding to move near the target.

    In a hexagonal map, each grid cell usually has six neighbors, meaning you cannot directly apply the up-down-left-right logic of square grids. The model must explicitly choose a coordinate representation method, such as axial, cube, or offset coordinates, and then uniformly handle distance calculations, adjacency checks, and pathfinding.

    Pathfinding can use Breadth-First Search (BFS) or heuristic search algorithms. For small-scale web prototypes, BFS is sufficient; if the map is large and there are many units, you need to consider search frequency, path caching, and dynamic obstacles to prevent noticeable lag.

    Furthermore, “all units automatically finding opponents” involves edge cases such as non-existent targets, blocked paths, and multiple units contesting the same position. High-quality generated results should handle these situations explicitly rather than only running in ideal scenarios.

    7. Keyboard View Control and Icon Systems

    Keyboard control seems simple but must avoid conflicting with the browser’s default scrolling behavior. When handling arrow keys, you should prevent default behavior based on whether the page is in a game-focused state. If input fields exist on the page, you must also avoid accidentally triggering view movements during user input.

    The icon system relates to information density and readability. If cities, units, resources, and enemy targets are all displayed as pure text, the map will quickly become cluttered. Using uniformly sized icons helps players establish visual recognition faster, but you must pay attention to:

    • Distinguishing factions with icon colors;
    • Maintaining a unified style across different objects;
    • Ensuring icons do not obscure grid lines or clickable areas;
    • Keeping icons clear when scaling or on different screen sizes;
    • Expressing important states through borders, animations, or auxiliary markers.

    8. Multi-Round Prompt Iteration is More Reliable Than One-Shot Descriptions

    A typical phenomenon observed during testing was that earlier generated versions often met visual requirements better, while subsequently regenerated versions—despite including more descriptions—suffered from degraded button styles, transparency effects, and layouts.

    This indicates that prompts are not “the longer the better.” Too many constraints may cause the model to distribute attention across different goals, ultimately sacrificing already achieved effects. A more reliable iteration approach is:

    Phase 1: Build a Runnable Skeleton First

    Only require the completion of page structure, core interactions, and basic state management, avoiding adding too many visual details at the start.

    Phase 2: Add Functional Modules

    Incrementally add the real-time loop, auto-research, pathfinding, speed control, and keyboard operations, asking the model to explain where modifications were made.

    Phase 3: Optimize Visual Performance Specifically

    Independently adjust colors, transparency, shadows, button shapes, spacing, and animations, without making major changes to the business logic.

    Phase 4: Execute Regression Testing

    After each modification, check existing features to prevent visual optimization from breaking dragging, targeting, or resource calculations.

    This “separation of function and visual” method is more likely to yield stable results than repeatedly asking the model to regenerate the entire page.

    9. How to Establish a More Objective Model Evaluation Process

    To avoid evaluating models based solely on subjective impressions, you can establish a simple scoring rubric:

    • Can the page run directly?
    • Core feature completion ratio;
    • Is the interaction continuous and stable?
    • Visual fidelity degree;
    • Is the code structure clear?
    • Can local modifications be made based on feedback?
    • Can exception scenarios be handled?
    • Generation speed and response stability.

    You should also distinguish between “first-generation capability” and “iterative repair capability.” Some models may not output perfect results on the first try but can accurately locate problems and make small-scale modifications, which is equally valuable in real-world development.

    Overall, new-generation LLMs have demonstrated strong comprehensive capabilities in web prototyping and lightweight game development. They excel especially at transforming natural language requirements into runnable interfaces and basic logic, but they still require developers to review and test complex state synchronization, visual consistency, edge cases, and large-scale performance optimization.

    A more reasonable usage approach is not to treat the model as a fully automated replacement, but as a collaborative tool for requirement decomposition, code generation, interaction design, and problem location. Developers are responsible for defining goals, establishing acceptance criteria, and performing quality control, while the model accelerates implementation and explores solutions. Only by combining the two can a “runnable demo page” be further elevated into a “maintainable, extensible application prototype.”