Can LLMs Build a Graphical Game for UEFI Shell? A Hands-On Evaluation

    Building a tank game for UEFI Shell tests more than an LLM’s ability to generate C code: it requires a working firmware build environment, correct graphics output, and complete game logic. This hands-on evaluation examines common failures in EDK2 configuration and runtime assumptions, explains the GOP graphics approach, and offers practical guidance on incremental validation, project-level constraints, and token budgets.

    1. Why Use a UEFI Shell Game as an LLM Coding Benchmark?

    Most evaluations of large language models’ coding abilities focus on algorithm problems or web applications. Both categories are heavily represented in training data, making it difficult to distinguish genuine engineering understanding from effective pattern matching.

    For this evaluation, I chose a less familiar task: building a top-down tank combat game with fixed maps that runs from UEFI Shell, reproducing the full gameplay of the classic 1990 Famicom version.

    The task challenges several common weaknesses in LLM-generated software:

    • A sparsely represented technical domain. UEFI application development belongs to firmware engineering, with far less public reference material than web development. Models have fewer opportunities to reproduce familiar solutions.
    • An end-to-end engineering workflow. Delivering the game requires more than implementing individual functions. Project configuration, the build system, graphics initialization, and game logic must all work together.
    • Verifiable execution. The code must compile, run, and render correctly. A plausible-looking implementation is not enough.

    The gameplay requirements were substantial: the player controls a tank, moves around a fixed map, shoots waves of enemy tanks, and protects a home base. The game also needed destructible brick terrain, invincibility, armor-piercing ammunition, extra-life pickups, eight maps, and four enemy tank types. Audio was not required.

    2. Development Environment and Graphics Approach

    2.1 Two Environments for Validation

    The implementation was tested in two environments:

    1. EDK2 emulator environment. The application was built within the emulator package in an EDK2 source tree, using Windows and the Visual Studio 2019 toolchain. Running the build directly in the emulator provided the fastest development loop.
    2. QEMU virtual machine. QEMU booted a UEFI firmware image to exercise the firmware boot process and verify the application’s behavior in UEFI Shell.

    These environments served complementary purposes: rapid iteration during development and validation under a UEFI boot workflow.

    2.2 Graphics Output Through GOP

    The standard graphics interface in UEFI is the Graphics Output Protocol, or GOP. Unlike the older UGA interface, GOP is the standard UEFI approach to graphics output.

    The basic process is to locate GOP, select the intended display mode, and access the framebuffer. The following simplified snippet illustrates framebuffer access after a 640 × 480 mode has been selected:

    1. EFI_GRAPHICS_OUTPUT_PROTOCOL *Gop;
    2. gBS->LocateProtocol(&gEfiGraphicsOutputProtocolGuid,
    3. NULL, (VOID**)&Gop);
    4. EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *Info = Gop->Mode->Info;
    5. // After selecting 640x480, write directly to the framebuffer.
    6. UINT32 *fb = (UINT32*)Gop->Mode->FrameBufferBase;
    7. // Assuming BGRA byte order: 0xFFRRGGBB.
    8. fb[y * Info->PixelsPerScanLine + x] = 0xFF0000FF; // Blue pixel.

    Several details were easy for models to overlook:

    • The pixel format is not guaranteed to be BGRA. The implementation must inspect Info->PixelFormat and rearrange color channels when necessary.
    • The scanline stride is not necessarily the display width. Alignment padding can make each framebuffer row wider than the visible image. Row addressing must use PixelsPerScanLine; using the horizontal resolution instead can produce diagonal distortion.
    • Blt and direct framebuffer writes can have substantially different performance characteristics. For the full-screen particle effects in this game, direct writes were the preferred approach. Blt remained an option for localized updates.

    The completed implementation achieved a stable 30 frames per second at 640 × 480, including a particle effects system.

    3. Where the Models Failed

    Testing multiple models with the same prompting workflow revealed a consistent set of failure modes.

    3.1 Build Configuration Became a Loop

    The most common obstacle was configuring the emulator build environment.

    Many models became trapped in a configuration loop: modifying DSC files, changing FDF firmware descriptions, and adjusting library dependencies. Each compilation attempt produced another set of errors, sometimes increasing rather than reducing the number of problems.

    This exposed a broader weakness: fragmented understanding of the build system.

    A model might recognize a configuration entry in a DSC file without understanding how it interacts with the toolchain version or host platform. Its response was then reactive: change a setting, compile, inspect the errors, and change something else.

    The token count kept growing while the underlying problem remained unresolved. In this setting, unrestricted autonomous trial and error was both expensive and ineffective.

    3.2 Runtime Constraints Were Treated as Optional

    Some models introduced assumptions that did not fit the UEFI environment, including reliance on a complete standard C library, unconstrained dynamic-memory use, or ordinary application-style multithreading.

    A UEFI application runs in a firmware environment without the services of a conventional operating system. Memory management depends on the available firmware services, including Boot Services in this workflow. Treating the program as an ordinary hosted C application can therefore lead to code that either fails to build or compiles but fails at runtime.

    The problem was not simply incorrect syntax. It was a failure to carry the target environment’s constraints through the implementation.

    3.3 Successful Attempts Started Small

    The few approaches that completed the workflow shared an important characteristic: they validated a minimal program before expanding it.

    They first established that the build chain worked and that GOP could produce visible output. Only then did they add rendering and game logic in stages.

    The lesson is straightforward: in unfamiliar technical domains, break the task into small steps that can be verified independently. Incremental validation was more effective than asking a model to generate a complete project in one pass.

    4. Practical Lessons for AI-Assisted Development

    The evaluation produced four reusable lessons about managing both engineering risk and model usage costs.

    4.1 Record Environment Constraints in a Project-Level File

    A project instruction file such as CLAUDE.md can capture the build toolchain, target platform, and prohibited dependencies before implementation begins.

    This gives the model a persistent set of rules to consult rather than relying on corrections after unsuitable code has already been generated. In this test, the initial setup task cost less than RMB 1—a small expense compared with recovering from repeated configuration failures.

    The useful principle is not tied to a particular filename: make environmental constraints explicit, persistent, and easy for the coding assistant to reference.

    4.2 Set a Token-Budget Cutoff

    When a model enters a build-configuration loop, stop it and intervene rather than allowing open-ended retries.

    In this evaluation, a single environment-configuration attempt consumed tens of RMB in model usage. The lesson was clear: autonomous troubleshooting needs a spending limit.

    A budget cutoff does not solve the technical problem, but it prevents an unresolved problem from becoming an uncontrolled cost.

    4.3 Accept Progress Through Incremental Milestones

    A useful sequence of acceptance checkpoints is:

    1. The project compiles.
    2. The application displays one pixel.
    3. It draws a rectangle.
    4. It renders the map.
    5. It runs the game logic.

    Each checkpoint should pass before the next layer is added. This narrows the scope of failures and can substantially reduce the overall cost of development.

    It also makes progress concrete. A large generated codebase may look complete while concealing problems in the build chain or graphics initialization. Small, executable milestones expose those problems early.

    4.4 Give Emerging Model Ecosystems Meaningful Real-World Use

    The original evaluation also argued for giving models developed in China more opportunities in practical workflows. Its rationale was that real-world usage provides feedback and supports the scale needed for continued improvement.

    For an international audience, the broader point is about ecosystem development: meaningful use of emerging models can contribute feedback beyond standardized coding benchmarks. This is a model-selection consideration, not a performance result established by this test.

    5. Conclusion

    The value of this evaluation lies less in declaring a winning model than in its methodology.

    To assess an LLM’s engineering ability, choose a task with limited representation in training data, an end-to-end implementation workflow, and results that can be verified through actual compilation and execution. A graphical firmware application meets those criteria.

    For teams considering AI-assisted embedded, firmware, or systems development, a similar internal benchmark can provide a practical starting point. Establish a working build, require observable runtime results, and expand the task through independently testable milestones.

    The depth of AI involvement in the development process should follow from those results—not from how convincing the generated code appears.