Generating Interactive Frontends with Large Language Models: Evaluation and Engineering Practices
Interactive frontend generation is evolving from text-based assistance into an online development sandbox where users can describe a requirement, preview a working page or application, and refine it through natural-language feedback. This article evaluates that workflow through two representative scenarios: a draggable desktop with 3D window switching, and a turn-based strategy game redesigned as a real-time strategy experience. It examines requirement understanding, state management, animation, pathfinding, visual fidelity, performance, maintainability, and the engineering practices required to turn model-generated prototypes into reliable applications.
Recently, a new version of a large language model became available for public testing. Its most notable capability was not simply improved single-turn question answering, but a shift in product form: from a text assistant toward an online development sandbox.
Users can describe a requirement, and the model generates a runnable page or small application. The system provides an immediate preview, after which users can continue refining the result through natural language. This short loop of generation, preview, feedback, and correction significantly reduces the time between an idea and a working prototype. It also makes the model’s capabilities in interaction design, frontend engineering, and visual reproduction easier to evaluate.
However, these capabilities cannot be assessed from a single screenshot or a few isolated examples. An interactive application includes state management, event handling, animation, layout, performance, and maintainability. A defect in any one of these areas can cause a demonstration to fail.
This article examines two representative test scenarios:
- A draggable desktop with 3D window switching.
- A classic turn-based strategy concept redesigned as a real-time strategy game.
The first scenario emphasizes interface interaction and visual presentation. The second focuses on abstraction, real-time simulation, pathfinding, and system design. Together, they provide a broader view of the strengths, limitations, and engineering improvements involved in using large language models to generate complex frontend applications.
1. Evaluation Framework: Why Interactive Applications Matter
Compared with tasks such as “generate a sorting algorithm” or “build a form,” interactive applications are better comprehensive tests because they require the model to handle multiple categories of work:
- Requirement understanding: Extracting features, implicit constraints, and acceptance criteria from natural language.
- Architecture: Choosing data models, module boundaries, state flows, and rendering strategies.
- Interaction implementation: Handling mouse, keyboard, touch, focus, layering, and accessibility.
- Real-time logic: Implementing animation frames, timers, collisions, pathfinding, and resource changes.
- Visual reproduction: Handling transparency, shadows, hierarchy, motion, and responsive layouts.
- Executability: Producing code that runs directly rather than a static mockup.
- Maintainability: Providing names, decomposition, comments, and error handling that support future changes.
- Performance and stability: Remaining usable as the number of entities increases, animations continue running, or input becomes more frequent.
At minimum, an evaluation should record six categories of results:
- Requirement coverage
- Functional correctness
- Visual fidelity
- Number of runtime errors
- Interaction latency and generation wait time
- Code maintainability
For team-level model selection, the model version, sampling parameters, prompt context, and runtime environment should be fixed. Tests should also be repeated across multiple runs. Anonymous model identifiers can reduce brand bias, but without version locking and result records, environmental fluctuations may be mistaken for differences in model capability.
2. Scenario One: A Draggable Desktop with 3D Window Switching
2.1 The Real Requirement
“Create a webpage that resembles a classic desktop system, supports draggable windows, and includes a 3D window-switching effect” sounds like a visual design task. In practice, it is an interaction-system task.
At a minimum, it requires:
- Draggable windows: The pointer should maintain its relative position to the window during dragging.
- Window focus: Clicking a window should bring it to the front while moving other windows behind it.
- Functional controls: Minimize, close, and restore buttons should have clear behavior.
- 3D switching: Multiple windows should form spatial depth through perspective, scaling, translation, and opacity.
- Glass styling: Translucent backgrounds, blur, borders, highlights, and shadows should work together.
- Boundary handling: Windows should remain within the visible area, including after resizing.
- Complete input support: Keyboard navigation, touch dragging, and focus management should be considered in addition to mouse input.
- Stable performance: Dragging should avoid excessive layout recalculation and animation stutter.
Tests show that this kind of task can easily produce something that “looks similar” without actually behaving correctly. A generated page may display attractive window cards but fail to update their stacking order. It may use absolute positioning in a way that causes frequent layout updates and jitter during dragging. It may support a mouse but not touch input. Visually, window controls, translucent glass effects, shadows, and depth transitions may also vary considerably between generations.
2.2 Implementation Principles and Example Code
Pointer events or another unified input abstraction should be preferred for window dragging. During a drag, only transform-related properties should be updated, and style changes should be batched within animation frames. Using transform: translate3d(...) for position is generally smoother than repeatedly changing layout properties.
Window focus can be implemented with an incrementing z-index value or an explicit stack order. Simply assigning an extremely large fixed layer to the active window can create inconsistent layering over time.
type WindowState = {id: string;x: number;y: number;width: number;height: number;z: number;minimized: boolean;}function onPointerDown(win, event) {focusWindow(win); // Update stacking order and active statedragState = {id: win.id,startX: event.clientX,startY: event.clientY,originX: win.x,originY: win.y};capturePointer(win.element, event.pointerId);}function onPointerMove(event) {if (!dragState) return;scheduleFrame(() => {const dx = event.clientX - dragState.startX;const dy = event.clientY - dragState.startY;const nextX = clamp(dragState.originX + dx, 0, viewport.width - win.width);const nextY = clamp(dragState.originY + dy, 0, viewport.height - win.height);win.x = nextX;win.y = nextY;win.element.style.transform =`translate3d(${nextX}px, ${nextY}px, 0)`;});}function focusWindow(win) {topZ += 1;win.z = topZ;win.element.style.zIndex = String(topZ);activeWindowId = win.id;}
3D window switching should separate state changes from visual animation. The state layer should maintain the active window, window order, and minimized state. The animation layer should map those states to perspective, rotation, translation, scaling, and opacity.
Animations should primarily modify transforms and opacity rather than read layout information on every frame. For translucent glass effects, compatibility fallbacks are also important. If blur is unavailable, the interface should preserve text contrast and readability instead of allowing content to disappear into the background.
2.3 User Experience and Key Problems
Two observations were particularly notable in this scenario.
First, online preview is extremely valuable. Users do not need to copy generated code into a local environment before seeing the result, so the feedback loop becomes much shorter.
Second, generation speed and generation quality do not always improve together. During periods of high service load, generation may take longer. After several iterations, functionality may become more complete while visual details become less accurate than in an earlier version. Window control precision, glass transparency, shadow depth, and the spatial feeling of layer transitions may regress.
This means evaluation should not rely on whether an application was generated at all. It should use an acceptance checklist such as:
- Can windows be dragged within the desktop boundaries?
- Does dragging follow the pointer smoothly?
- Does clicking or keyboard navigation update the stacking order correctly?
- Do minimize and restore operations preserve window state?
- Do 3D transitions provide clear entering, exiting, and focus feedback?
- Does translucency reduce text readability?
- Are there visible frame drops during dragging or switching?
- Are there runtime errors in the console?
- Are event listeners properly cleaned up?
- Does the layout remain stable after resizing or zooming?
3. Scenario Two: From Turn-Based Strategy to Real-Time Strategy
The second test is more representative because it requires a higher level of abstraction: redesigning a classic turn-based strategy concept as a real-time strategy game.
3.1 Understanding the Core Characteristics of Real-Time Strategy
Removing an “End Turn” button does not create a real-time strategy game. A genuine real-time system should provide:
- Continuous time progression rather than step-by-step confirmation.
- Fair timing between sides, without extra advantages caused by pausing one side.
- Continuous changes to resource collection, unit movement, combat, production, and research.
- The ability for players to issue commands at any time, with the system executing them according to scheduling rules.
- A speed control that changes simulation speed rather than merely accelerating visual animation.
- Victory conditions, pausing, resuming, and restarting based on a unified time system.
This requires the model to understand the system constraints behind “real time.” If the implementation still centers on turn events and only adds a speed slider to the interface, it may quickly develop problems such as duplicate resource calculations, teleporting units, or non-reproducible combat results.
A robust approach is a fixed timestep with an accumulator. Rendering can run at the display refresh rate, while the simulation advances at a fixed interval. The speed multiplier changes how quickly time accumulates. At high speeds, the number of simulation steps per frame should be capped to prevent a temporary stall from triggering excessive catch-up work and causing a cascading freeze.
const STEP = 50; // Simulation step in millisecondslet accumulator = 0;let lastTime = now();let speed = 1;function frame() {const current = now();const delta = Math.min(current - lastTime, 200);lastTime = current;accumulator += delta * speed;let loops = 0;while (accumulator >= STEP && loops < 20) {simulate(STEP);accumulator -= STEP;loops += 1;}render(accumulator / STEP);requestNextFrame(frame);}
When mapping a speed slider to a range from 1x to 10x, the implementation can use a continuous parameter such as speed = sliderValue, with boundary validation and a clearly displayed value.
More importantly, high-speed simulation must remain logically correct. Resource growth, cooldowns, movement, and research completion should be driven by simulation time rather than UI animation callbacks. The displayed speed, pause state, and actual simulation parameter must remain consistent.
3.2 An AI-Assisted Technology Tree
The requirement that an “AI assistant can be enabled and automatically complete research when resources permit” is a constrained decision-making subsystem.
The model must recognize that a technology tree is not merely a list of buttons. It contains prerequisites, costs, queues, completion times, and priorities. The assistant must not create resources or bypass prerequisites.
A data-driven design is easier to maintain:
type TechNode = {id: string;name: string;cost: number;prerequisites: string[];scoreBase: number;};function chooseResearch(state, techs) {const candidates = techs.filter(tech =>!state.completed.has(tech.id) &&!state.researching.has(tech.id) &&tech.prerequisites.every(id => state.completed.has(id)) &&state.resources >= tech.cost);candidates.sort((a, b) => score(b, state) - score(a, state));return candidates[0] ?? null;}
The assistant also needs clear rules for several edge cases:
- Are resources deducted when research starts or when it completes?
- Does research pause if resources become insufficient?
- Can the same technology be queued more than once?
- What happens to queued research after the assistant is disabled?
- Should automatic selection respect technologies manually locked by the player?
Without explicit answers, the model may generate an implementation where buttons work in simple cases but state errors appear during longer simulations.
3.3 Automatic Target Selection and Pathfinding
“Allow all units to automatically find opponents and cities” involves spatial queries, target selection, pathfinding, and dynamic replanning.
When the map uses a hexagonal grid, units cannot simply move in a straight line based on screen coordinates. Movement should use hex-grid adjacency and pathfinding. Axial coordinates simplify distance and neighbor calculations:
const HEX_DIRECTIONS = [[1, 0], [1, -1], [0, -1],[-1, 0], [-1, 1], [0, 1]];function neighbors(hex) {return HEX_DIRECTIONS.map(([dq, dr]) => ({q: hex.q + dq,r: hex.r + dr}));}function hexDistance(a, b) {return (Math.abs(a.q - b.q)+ Math.abs(a.r - b.r)+ Math.abs(a.q + a.r - b.q - b.r)) / 2;}
Pathfinding can use a heuristic search with hex distance as the heuristic. Target selection may combine distance, threat, city value, and reachability.
In a real application, spatial partitioning or grid indexing should be considered to avoid scanning every target for every unit. Paths near the same target can sometimes be reused or recalculated in batches. If a target is destroyed, a path becomes blocked, or a unit cannot make progress for an extended period, the system should select a new target or replan its route instead of leaving the unit stuck.
In the test sample, automatic enemy seeking and city attacks could be implemented, indicating that the model had a basic understanding of spatial structures, adjacency, and automated decision-making. However, performance and stability still require manual optimization as the number of entities increases. Recalculating paths every frame, repeatedly scanning the entire map, and failing to remove event listeners are common risks.
3.4 Controls and Presentation Details
Controls often determine whether an application feels usable:
- Speed slider: A visible 1x-to-10x control should be linked to the simulation time system.
- Hexagonal tiles: Rendering, coordinate conversion, selection highlighting, and boundary checks must use consistent geometry.
- Keyboard camera movement: Arrow keys should prevent page scrolling. Holding a key should move the camera smoothly and releasing it should stop movement.
- Object icons: Cities, units, and resources may use emoji or system symbols, but text labels and fallback options should be provided to avoid missing-glyph boxes.
Each detail is manageable in isolation, but the combination exposes engineering problems. If camera offsets are not synchronized with mouse-coordinate conversion, users may be able to see an object but fail to click it. If the speed multiplier is applied inconsistently to rendering and simulation, high-speed mode may cause visual jumps. If icon dimensions change while hit areas still use old sizes, interaction accuracy will suffer.
4. Observed Results: Strengths and Limitations
These two scenarios reveal three major strengths of large language models in interactive frontend generation.
Stronger Requirement Abstraction
For requirements such as real-time strategy, automated research, and automatic target seeking, the model can identify the underlying need for continuous time, resource constraints, graph structures, and pathfinding rather than treating the task as a simple collection of button changes.
This is one of the most important capabilities in complex application generation.
Fast Production of Runnable Prototypes
For small games, management panels, visualizations, and interactive demonstrations, models can often produce a complete structure quickly. This helps developers move beyond the initial scaffolding stage.
Lower Cost of Iteration
Online preview combined with natural-language refinement reduces the cost of experimentation. Developers can add visual specifications, edge cases, and acceptance criteria and gradually move the generated result closer to the target.
The limitations are equally clear:
- Visual fidelity is inconsistent. The same glass effect, window controls, or 3D transition may vary significantly between generations.
- Generation time depends on service load. Slow responses during peak periods make interruptible, resumable, and locally editable workflows important.
- Maintainability is unstable. Generated code may favor a single large file, long functions, or duplicated logic.
- Edge cases are easy to miss. Resource settlement, duplicate triggers, drag boundaries, unreachable paths, and event cleanup require explicit test cases.
- A single successful run is not evidence of stable capability. Anonymous tests, public demonstrations, and production environments differ. Versions, prompts, parameters, and runtime results must be recorded.
5. Reproducible Prompts and Acceptance Testing
To avoid subjective evaluation, prompts should be written more like requirements specifications. A useful template includes the objective, feature list, acceptance criteria, technical constraints, output order, and self-test requirements.
Goal:Build a directly runnable web-based interactive prototype.Functional requirements:1. Windows can be dragged, focused, minimized, and restored.2. Add 3D window switching with perspective, scaling, and opacity transitions.3. Provide a readable fallback for translucent materials on low-performance devices.4. Convert the strategy gameplay to continuous real-time simulation without a turn-ending button.5. Add an automated research option that selects technologies only when prerequisitesand resource requirements are satisfied.6. Allow units to find targets automatically and navigate a hexagonal grid.7. Provide 1x-to-10x speed control, keyboard camera movement, and icon fallbacks.Acceptance criteria:- Clicking a window updates its stacking order, and dragging does not jitter.- Resources, movement, research, and combat remain consistent at every speed.- Automated research cannot bypass prerequisites or deduct resources twice.- Units make a new decision when a target becomes unreachable or disappears.- Arrow keys do not scroll the page, and interaction coordinates remain accurate after zooming.- The page has no obvious runtime errors and event listeners can be cleaned up.Technical constraints:- Use standard web technologies and avoid untrusted external resources.- Separate simulation logic, rendering logic, and data definitions.- Provide initialization, pause, and restart behavior for key state.- Include necessary error messages and compatibility fallbacks.- Output the structure first, then the complete runnable implementation and a self-test checklist.
During iteration, avoid vague feedback such as “make it look better.” Specific failure descriptions are more effective:
The window buttons are too small, the glass background has insufficient contrast, text is selected while dragging, and focus state is not updated after layer changes.
For game logic, describe the reproduction steps, expected result, and actual result. Ask the model to inspect the state flow before modifying the code.
Testing should be divided into milestones:
- Generate the runnable skeleton and core data model.
- Implement the real-time loop and automated decision-making.
- Add visual details and accessibility support.
- Perform performance and edge-case testing.
Requiring too many features at once may cause the model to focus on appearance while missing resource consistency, pause and resume behavior, or event cleanup.
6. Engineering Recommendations for Production Use
Generated frontend code is useful for prototypes and scaffolding, but it requires engineering work before entering production.
Separate Simulation and Rendering
The simulation layer should own resources, units, technologies, paths, and time state. The rendering layer should read that state and display it. The input layer should translate mouse, keyboard, and touch actions into commands instead of scattering interaction logic across components.
Technology trees, unit attributes, and icon mappings should be configuration data rather than repeated hard-coded branches. Random numbers, clocks, and network requests should be injectable to support testing and replay.
Optimize Interaction and Simulation
Dragging, camera movement, and animation should batch transform updates and avoid repeated layout recalculation. Pathfinding and spatial queries can use caching or partitioning. With many entities, calculations should be performed in batches.
At high simulation speeds, fixed timesteps and a maximum number of catch-up steps can prevent a single frame from executing excessive simulation work. Long-running games and simulations should also be checked for memory growth, timers, event listeners, and temporary object allocation.
Establish Quality Gates
At minimum, quality assurance should include:
- Static analysis and type checking
- Unit tests for critical pure functions
- Headless-browser interaction regression tests
- Screenshot or visual-difference checks
Fixed replay scenarios should cover window dragging, the speed slider, automated research, and automatic target selection. Teams should also check keyboard accessibility, color contrast, responsive layouts, uncaught exceptions, and console errors.
Isolate Preview and Evaluation Environments
Generated artifacts can be archived in object storage, while container platforms can provide isolated preview instances. Logging services can collect runtime failures, and monitoring and alerting can track preview availability.
Baidu AI Cloud provides general-purpose categories such as object storage, container platforms, logging, and monitoring that can be used to build this kind of continuous evaluation and preview workflow. However, generated code should never directly access sensitive credentials or execute untrusted content in an unisolated environment. Least-privilege permissions, dependency review, and content security policies are necessary to reduce risk.
7. Conclusion
The most valuable aspect of this evaluation is not whether a single generated result resembles an existing product. It is that the model can increasingly understand interactive systems at a higher abstraction level.
It can recognize that real-time strategy requires continuous time, automated research requires resources and prerequisites, unit actions require spatial queries and pathfinding, and desktop windows require stacking order, dragging, and state management. In the tested scenarios, complex requirements could generally be turned into runnable prototypes, showing that large language models have practical value in the workflow from requirements to interactive applications.
At the same time, generation quality remains variable. Visual details and edge cases still require human acceptance testing. Generation speed may degrade during high-load periods. Multi-round iteration may improve functionality while introducing visual or performance regressions.
The most practical positioning is therefore not as a one-shot replacement for the entire development process, but as an efficient prototype collaboration tool and engineering scaffolding generator. Teams that want to use this capability reliably should establish fixed versions, prompt templates, acceptance checklists, automated regression tests, and isolated preview environments. Model output should become part of an engineering system that is testable, reproducible, and rollback-friendly.
