Developing a Vertical Shooter Game in UEFI: Engineering Practices from Two Delivery Rounds

    This article walks through the engineering practice of building a vertical scrolling shooter that runs directly in a UEFI environment, where window systems, font engines, audio frameworks, and mature file systems are all absent. It covers setting up a reproducible build and run pipeline, building a text rendering pipeline from code points to pixels for Chinese display, managing the game loop with a fixed timestep and interpolation, and recovering from missing source or assets through a regenerable build flow. It also explains the two-round delivery and collaboration method, and closes with a reusable acceptance checklist across the environment, display, logic, and process layers.

    Developing a Vertical Shooter Game in UEFI: Engineering Practices from Two Delivery Rounds

    Why Run a Game Inside UEFI

    Most developers think of graphics programs as living “on top of an operating system”: with a window system, a font engine, an audio framework, and a mature file system. At the UEFI (Unified Extensible Firmware Interface) stage, almost all of this infrastructure is missing. UEFI provides only a limited set of boot services and runtime services; once you call exit boot services, control is handed entirely to you as the developer. This “minimal environment” is precisely a testing ground for low-level skills.

    A vertical shooter was chosen as the vehicle for three reasons. First, the gameplay loop is clear and easy to split into verifiable modules. Second, the visuals are mostly 2D sprites, which makes offscreen-buffer composition straightforward. Third, vertical scrolling inherently demands a stable frame cadence, which exposes flaws in timing design. The end goal was a fully playable version with five levels of weapon upgrades, a wingman system, item drops, and stage boss fights, rather than a demo that only moves a square around.

    Environment Setup: Minimizing Uncertainty

    The first hurdle in low-level development is not coding but a reproducible build and run pipeline. The steps most prone to problems in practice include: a cross-compilation toolchain that does not match the firmware architecture, an image packaging format the target environment does not recognize, and debug output that cannot be sent back. The recommendation is to get a “minimal runnable skeleton” working first, then layer features on top.

    A reusable minimal entry point looks like this (illustrative; exact types and calls depend on the firmware specification in use):

    1. EFI_STATUS EFIAPI UefiMain(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *ST) {
    2. ST->ConOut->ClearScreen(ST->ConOut);
    3. ST->ConOut->OutputString(ST->ConOut, L"UEFI Game Booting...\r\n");
    4. // 1. Initialize the graphics output protocol to get resolution and framebuffer base address
    5. // 2. Initialize input device events and build a key state table
    6. // 3. Enter a fixed-step main loop
    7. return EFI_SUCCESS;
    8. }

    Three engineering lessons are worth locking in. First, fully separate “environment detection” from “game logic,” and emit a readable error code instead of a black screen when detection fails. Second, the build script should do one thing only: produce a verifiable image artifact while keeping intermediate map files for locating problems. Third, retain a complete serial log for every run; logs are the most effective “print debugger” in a bare-metal environment.

    Graphics and Chinese Text Display: From Bitmap to Text Pipeline

    At the UEFI stage there is no ready-made text rendering service for in-game text, so you need to build a pipeline from code point to pixel yourself. A workable path is to embed a set of bitmap glyph data covering common Chinese characters and ASCII, look up glyphs through a three-level table of “code point -> glyph index -> bitmap offset,” and then write the bitmap into the framebuffer with color.

    1. Code point (Unicode)
    2. │ Normalization / range check
    3. ▼
    4. Glyph index table (Index)
    5. │ Offset calculation
    6. ▼
    7. Bitmap data (Bitmap, 1bpp/8bpp)
    8. │ Color blending + clipping
    9. ▼
    10. Framebuffer (FrameBuffer, RGB)

    There are three key design points. One is glyph caching: cache already-rendered text blocks as offscreen regions to avoid decoding them again every frame. Two is double buffering with dirty-rectangle refresh to reduce the bandwidth pressure of full-screen copies. Three is resolution adaptation: scale font size and line spacing by screen height ratio so the layout does not break at different firmware resolutions. The hard part of Chinese handling is not drawing but typesetting: you need to handle punctuation squeezing, baseline alignment in mixed text, and line-break points. It is advisable to make the “line-breaking strategy” a separate module so it can later be replaced with more complex rules.

    Game Loop and Time Model

    A bare-metal environment has no preemptive scheduler, so frame cadence must be controlled by the developer. A structure of fixed-step updates plus render interpolation is recommended to decouple logic from display:

    1. while (running) {
    2. uint64_t now = ReadTimestamp();
    3. accumulator += now - last;
    4. while (accumulator >= STEP) { Update(); accumulator -= STEP; }
    5. Render(accumulator / STEP); // interpolation to smooth jitter
    6. last = now;
    7. }

    Collision detection uses a layered strategy: axis-aligned bounding boxes quickly reject bullet-and-enemy pairs, while the player’s hit area is shrunk to a small rectangle for better feel; enemy bullet patterns reuse an object pool to avoid frequent allocation. The difficulty curve is controlled by a “spawn weight table” that gradually unlocks denser bullet patterns and higher-HP targets as stages progress, and boss fights use a phase state machine to manage behavior switches.

    Self-Rebuild Capability Under Missing Resources

    A real and frequent risk in low-level development is losing source code or resources. The robust approach is to make the build flow “rebuildable”: resources are defined by generatable description files, glyph and sound data are regenerated by scripts from the source descriptions, and an integrity check runs before the build so that missing pieces trigger regeneration rather than an outright failure. This way, even if the working directory is wiped, the full compilable project can be recovered from the description files and scripts. Making this part of the routine flow is more reliable than depending on after-the-fact recovery.

    The Collaboration Method Behind Two Delivery Rounds

    “Two rounds, passed on the first try” was not luck, but the result of treating AI coding tools as a reviewable collaborator: the first round focused on the skeleton and runnable pipeline, producing a verifiable minimal closed loop; the second round focused on gameplay completeness and feel tuning, closing out item by item against an acceptance checklist. What really widened the efficiency gap in practice was the precision of requirement descriptions and the decidability of acceptance criteria—refining “Chinese display works correctly” into “no truncation or misalignment at two resolutions” significantly reduces rework. If cloud collaboration is needed, object storage can hold build artifacts, a logging service can aggregate run records, and a container platform can host a reproducible build environment, forming a traceable closed loop.

    Acceptance Checklist and Reusable Conclusions

    • Environment layer: reproducible image, returnable logs, readable error codes;
    • Display layer: glyph caching in effect, no tearing with double buffering, adaptive layout;
    • Logic layer: stable fixed step, no object-pool leaks, controllable difficulty curve;
    • Process layer: regenerable resources, verifiable build, decidable acceptance.

    Making a game at the firmware stage without operating system support is essentially a training exercise in “minimal dependency” capability: converge the four chains of rendering, input, timing, and resources each into testable modules, then use AI coding tools with autonomous execution ability for fast iteration. Once the method is consolidated, the same skeleton can be migrated to more low-level visualization scenarios.