AI Coding Tools in Extreme Testing: Building a Graphical Breakout Game for the UEFI Shell
This article describes an experiment in which AI coding tools wrote a graphical breakout game with Chinese text rendering for the UEFI Shell, without any manual coding. It covers the test rules, model selection, four development stages, a comparison of autonomous agents and coding plugins, and the cost and output of the project.
Introduction: Why Use Extreme Scenarios to Test AI Coding Ability
Smart coding tools have advanced quickly in recent years. They have moved from simple code completion plugins to AI coding assistants that can carry out complex tasks on their own. The industry continues to debate where these tools’ abilities end. Some developers believe AI performs well in areas with abundant training data, such as web applications and scripting. They doubt it can handle hardware programming, register operations, and firmware protocol stacks, where specialized understanding and training data are scarce.
To test this view, I designed a demanding experiment. An AI coding tool would develop a graphical breakout game that runs in the UEFI Shell and displays Chinese text. I would write zero lines of code by hand. In practical terms, the finished program would be copied to a USB drive, plugged into a computer, and launched from the firmware Shell.
I have used breakout as a test project for years. Its structure is clear and its logic is complete. It involves graphics rendering, user input, collision detection, and state management, so it is a classic way to assess programming ability. I had run similar tests in web and mobile environments before. This time, the firmware environment raised the difficulty considerably. Anyone who has done low-level work will understand why: there is no operating system layer, so no ready-made graphics library, font engine, or memory management framework is available.
1. Test Rules and Goals
1.1 Strict Challenge Rules
To keep the test clean, I set the rules strictly:
- Minimal environment: The Windows machine has one mainstream IDE (2019 edition) and no other helper tools. There is no prepared cross-compilation toolchain and no third-party libraries.
- No manual coding: The local code repository starts from scratch. I did not write a single line of code. All code was generated by AI.
- No expert guidance: I provided almost no domain-specific guidance. The AI handled architecture design, protocol calls, debugging, and troubleshooting on its own throughout.
1.2 What Makes the UEFI Target Hard
The UEFI (Unified Extensible Firmware Interface) environment differs fundamentally from traditional application development:
- No standard library: There is no full C standard library. String handling and memory allocation must be built on the low-level services that the firmware provides.
- Primitive graphics: The only option is the Graphics Output Protocol (GOP), which provides the framebuffer address. Every pixel is drawn directly, and even lines and filled rectangles must be written by hand.
- Limited debugging: No mature breakpoint debugger exists. Problems are found mainly through log output and repeated tests in a virtual machine.
- Chinese text is the hardest part: The firmware environment has no font rendering engine. Bitmap font storage, indexing, and bitmap drawing all have to be implemented manually.
2. Model and Tool Selection: Ferrari or Family Car
I put real thought into choosing the model. I had previously used a flagship coding model from a leading vendor, and it performed well. Its responses were fast and its logic was clear. However, the cost was more than 200 RMB for two hours of use, which is high for everyday development. A financial talk show once used an analogy that stuck with me: a Ferrari is excellent, but most people need an affordable family car.
This captures the central trade-off in choosing AI coding tools:
- Flagship models: They have strong reasoning and suit architecture design and difficult problems. However, their token costs are high, and long autonomous runs add up quickly.
- Mid-tier models: They are affordable and respond quickly, which suits routine coding. They may struggle with long chains of reasoning and multi-step planning.
- Differences in tool form: Command-line autonomous coding agents favor “give a goal and let it run.” Editor-plugin assistants favor “a human in the loop, confirming each step.” Agents have more autonomy but consume more resources. Plugins are easier to control but require continuous human involvement.
My final strategy combined both. I used a strong model for architecture design and difficult stages, and an economical model for routine iteration. This matches how most companies deploy these tools: they route tasks dynamically according to complexity instead of using one model for everything.
3. Four Rounds of Development
3.1 Round 1: Building the Foundation
The AI first built the project skeleton. This included the entry function, retrieval of the firmware service table, location of the Graphics Output Protocol, and mapping of the framebuffer. The AI performed better than I expected in this stage. Its understanding of the UEFI specification was accurate. It correctly distinguished the lifecycles of Boot Services and Runtime Services, and it released resources properly before exiting.
3.2 Round 2: Adding Features
The basic version could only display a solid color. The AI then added the following:
- Double buffering to eliminate screen tearing;
- Keyboard input polling to move the paddle;
- Collision detection to handle bounces off bricks, walls, and the paddle;
- A game state machine to manage transitions between start, play, and game over.
This stage exposed a typical problem. At high ball speeds, the collision detection let the ball pass through walls. The AI analyzed the cause on its own. The problem was an inherent flaw of discrete sampling. It fixed the issue by switching to swept collision detection, which checks the line segment the ball travels against the boundaries. This self-diagnosis was impressive.
3.3 Round 3: Detour in Shell Compilation
This was an unexpected pitfall. To make the program compatible with more firmware environments, the target format and linking method had to change. The AI took a wrong turn in the compiler configuration. It repeatedly produced binaries that ran in a virtual machine but failed to load in some real firmware Shells. After several rounds of trial and error, the AI identified the root causes: the entry point convention and the handling of the relocation table. This case shows that the “last mile” of low-level development often gets stuck on specification details rather than algorithm logic. The AI needed real-world feedback to converge, and pure reasoning was not enough.
3.4 Round 4: Chinese Text Rendering
This was the hardest part of the project. Along the way, a side issue came up: Chinese comments in the source files caused a compilation encoding error. The AI resolved it by standardizing the file encoding.
The core difficulties of Chinese text rendering were:
- Font source: The firmware environment cannot rely on operating system fonts. The AI embedded a compact bitmap font as a data array in the program.
- Storage optimization: Thousands of common Chinese characters make a full font set too large. The AI extracted characters on demand and packaged only the characters the game actually used.
- Rendering: The program parses the bitmap data bit by bit, maps it to framebuffer pixels, and handles character spacing and alignment.
When the interface correctly displayed Chinese text on screen, the challenge was complete.
4. Autonomous Agents and Plugin Assistants Compared
Back to the original question: how do autonomous coding agents differ from traditional plugin-style tools?
| Dimension | Autonomous coding agent | Coding assistant plugin |
|---|---|---|
| Interaction | Gives a goal, then runs independently | Human leads, AI suggests completions |
| Long tasks | Advances through multiple steps on its own | Needs frequent human confirmation |
| Cost | High token consumption | Relatively controllable |
| Best suited for | Exploratory work and building from scratch | Maintaining existing code and making local edits |
In this project, which involved building from scratch with a long feedback loop, the autonomous form was clearly more efficient. For routine maintenance of business code, the plugin form offers better cost control and predictability. The two complement each other.
5. Cost and Output
- Cost: Using the mixed-model strategy throughout, total spending came to about one-quarter of what a flagship-only approach would have cost. This confirmed that routing tasks by level of difficulty works.
- Output: The AI generated several thousand lines of code autonomously. These covered four modules: graphics rendering, input handling, game logic, and the font engine. My involvement was limited to setting goals and approving results. I did not write a single line of code.
- Capabilities: The AI completed the full cycle on its own. It researched protocols, designed the architecture, implemented the code, diagnosed defects, optimized performance, and fixed encoding problems.
6. Conclusions and Recommendations
This extreme test leads to one main conclusion: even in a specialized low-level domain with scarce training data, current AI coding tools can deliver end to end. The view that AI cannot handle low-level development needs to be revised. Three points also deserve attention:
- Cost management is key to practical use. Choose the model tier according to task complexity. Companies can use the large language model services offered by cloud platforms to build tiered calling strategies.
- Real-world feedback is essential. The AI’s convergence on specification details depends on a closed loop of testing and verification.
- The engineer’s role shifts from writing code to defining problems and judging results. This raises the demands on architectural skill and quality judgment.
The “old-school coding” joke points to a real change in how software is developed. Developers who embrace this change and use these tools well are making the best choice.
