Coding4Games: Can Modern Coding Agents Play Modern Video Games?

Shifang Zhao, Haoyu Wang, Yuyang Yin, Dong Chen, Xingyilang Yin, Yunkang Tao, Honghao Chen, Guangzhi Wang, Yiran Wang, Junfu Pu, Cheng Cheng, Xiaodong Cun, Ying ShanarXiv 2026

TL;DR

When we ask AI to play modern video games, we usually treat the model as a slow-thinking player—sending it screenshots and waiting for it to pick the next button press while the game’s boss effortlessly flattens our character. Coding4Games flips this paradigm: instead of playing the game directly, a coding agent explores the game in a sandbox to write a standalone Python program that plays on its own, zero LLM calls required. It turns out that letting AI write fast, traditional code to handle real-time perception and control beats direct AI gameplay on almost every title tested—though debugging dynamic worlds remains a humbling frontier.

Comparison of direct GUI agents versus Coding4Games standalone program synthesis, alongside overall benchmark performance.

What Problem Does This Paper Address?

Modern AAA video games are sensory and strategic gauntlets. Existing game benchmarks largely fall into two camps, and each has a catch:

  1. GUI Agents ("Computer-Use"): An LLM looks at pixels and outputs keyboard/mouse actions at every step. This racks up massive inference costs and suffers from crippling latency—in real-time action games, the world keeps moving while the model is "thinking."
  2. API-Based Bots: Coding agents write scripts that interact with clean, structured game states (like coordinates and health values) via custom APIs. This bypasses the messy reality of visual perception and low-level control that humans actually face.

The authors ask a unifying question: Can a general coding agent learn how a modern game works purely by looking at the screen and pressing standard keys, and distill that knowledge into a fast, standalone executable program?

Methods

To test this, the authors built a two-stage evaluation framework that strictly separates learning/coding from playing:

  • Gym-Like Game Server: Wraps heterogeneous commercial PC games under a unified Model Context Protocol (MCP) interface. It feeds screenshots to the agent, executes keyboard/mouse inputs, tracks "game tics" (time steps), and calculates objective scores safely out of the agent's reach.
  • Development Stage (Sandbox): Given a budget of tokens and game tics, the coding agent (using harnesses like Codex, Claude Code, or Gemini CLI) explores the game, writes vision-and-control scripts (e.g., using PIL and numpy), runs self-tests, and iterates.
  • Test Stage (Frozen Execution): The agent submits one final program. That code is frozen and run in a fresh environment with no LLM inference and no internet access, testing whether the code genuinely generalizes.
  • Process Metrics: Beyond game scores, the authors introduce clever diagnostics: Final Grounding Level (FGL) (does the code just spam buttons on a timer, or parse game state and plan?), Iterative Modification Score (IMS) (are edits tiny parameter tweaks or full strategy shifts?), and Problem Resolution (NER & RS) (when the agent spots a bug and tests a fix, does the bug actually go away?).

Datasets

Rather than training models, this paper introduces Coding4Games, an evaluation benchmark spanning 15 modern games across five categories (including Black Myth: Wukong, Sekiro, Balatro, Forza Horizon 5, NBA 2K25, and Overcooked! 2). Unlike retro Atari suites or web-game collections, Coding4Games combines rich 3D/modern visuals, low-level GUI controls, live execution, and strict development–test separation. Each game features a standardized starting scenario and continuous partial-progress scoring (like boss HP depleted or orders completed).

Key Insights and Ideas

  • Spotting a bug is much easier than fixing it: Agents are great at designing self-tests that trigger the exact problem they want to fix (80%–100% exposure rate), yet they successfully resolve those targeted problems only 35.7% to 83.3% of the time. Getting good execution feedback doesn't automatically translate into a working patch.
  • Fancier code can backfire: Writing complex control logic doesn't guarantee higher scores if the agent can't calibrate it. In Forza Horizon 5, one model wrote a sophisticated PID steering controller that scored 443.7 due to false recovery triggers and road departures, getting smoked by another model's simpler local route-follower (645.7).
  • Partial blindness: Frozen programs often fail because they only ground part of the game state. For instance, a Riders Republic script learned to detect crashes via a red-screen pixel threshold to recover, yet still executed mid-air tricks on a blind, fixed counter—recovering from disasters without ever learning how to prevent them.
  • Script-first debugging: Rather than playing the game "by hand" to explore, 10 of the 12 models spent the vast majority of their interaction budget (up to 98.5%) running candidate scripts and reading the aftermath.

Key Results

Evaluating 12 closed and open-weight coding models against human and paused-game GUI baselines yielded clear takeaways:

  • Programs beat online GUI agents (mostly): Taking the best standalone program per game outscored the strongest GUI baseline on 13 of 15 games (and tied on one), all with zero test-time LLM cost. However, when comparing the exact same model head-to-head (program vs. paused GUI), results were split—programs dominated in games like Kingdom Rush 5 (+72.6 gap for GPT-5.6-Sol) and King of Fighters '98, while GUI agents won in visually fluid environments like Forza Horizon 5 and Palworld.
  • Model leaderboard: Closed models led the pack, with GPT-6-Astra taking 1st place (52.6 average normalized score), followed by Claude-Opus-5.5 (44.0) and Claude-Opus-5 (37.7). Open models trailed between 12.1 and 17.0.
  • Humans still reign supreme: An unpracticed human player briefed only on basic controls averaged 97.2, beating every AI agent on 10 of the 15 games (though coding agents managed to beat or tie the human on five titles, including Aimlab and Balatro).

Limitations and Future Work

The authors note several practical constraints: in complejos games like Forza, it is hard to isolate exactly how much specific calibration bugs contribute to score gaps, and variations in run counts and budgets across development traces mean interaction habits shouldn't be over-interpreted as rigid model personalities. Furthermore, standalone programs are not yet a universal drop-in replacement for online GUI agents in open-ended tasks. Looking forward, the central open challenge exposed by Coding4Games is generalizable revision: teaching coding agents to turn raw execution feedback into robust perceptual and strategic code that holds up outside the exact scenario they just saw.

Summary updated

Abstract

Games, especially modern AAA games, challenge language models to perceive complex scenes, control actions, and make decisions over long horizons. Existing game benchmarks primarily test language models as computer-use agents that query a language model throughout play, incurring repeated inference cost and, in real-time games, acting while the environment continues to evolve. We ask whether coding agents can learn from game interaction to develop standalone game-playing programs that run without language model inference. We thus introduce Coding4Games, a benchmark for evaluating whether coding agents can develop standalone programs that play modern games through visual observations and standard game inputs. Coding4Games has three defining features: 1) Diverse Modern Games, covering 15 games with diverse visual, strategic, and control demands; 2) Development-Test Separation, in which a coding agent uses a sandbox and the standard player interface to iteratively develop a program, after which the selected program is frozen and independently tested without language-model inference; and 3) Outcome and Process Evaluation, which measures not only game performance and reliability but also how agents use feedback, revise programs, and resolve problems during development. Across 15 games, the best program per game outscores the strongest GUI baseline on 13 and ties it on one. The human player outscores all agents on 10 games. We additionally examine the effects of development budgets. Coding4Games evaluates whether coding agents can turn their understanding of complex interactive environments into programs that work reliably on their own.
BibTeX
@misc{zhao2026coding,
  author = {Shifang Zhao and Haoyu Wang and Yuyang Yin and Dong Chen and Xingyilang Yin and Yunkang Tao and Honghao Chen and Guangzhi Wang and Yiran Wang and Junfu Pu and Cheng Cheng and Xiaodong Cun and Ying Shan},
  title = {{Coding4Games: Can Modern Coding Agents Play Modern Video Games?}},
  year = {2026},
  eprint = {2611.31974},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2611.31974},
}
Figure