From Watching to Playing: Auto-Playing Video Games with a Self-Constructed Code World Model
Abstract
Vision-language model (VLM) agents can play video games by selecting actions from successive screenshots, but calling a VLM at each decision step incurs prohibitive time and token costs. Compiling a VLM's game knowledge into reusable code would amortize these costs, yet raw visual gameplay entangles autonomous physics with player actions, obscuring the transition dynamics a compiled model needs. To address both challenges, we present PlaySmith, an agent harness that constructs three modules from visual gameplay. First, a visual Observer detects game objects and tracks them across frames with persistent identity. Second, action-conditioned displacement (ACD) links actions to object motion, guiding construction of a stateful Predictor that distinguishes action-driven motion from autonomous physics. Third, a controller uses the Predictor to evaluate candidate action sequences multiple steps ahead and executes the selected action. Across eight 2D browser games, PlaySmith achieves competitive scores relative to direct VLM gameplay using the same backbone, while consuming no VLM tokens during evaluation episodes per game and reducing mean per-step latency from 4.526 to 0.293 seconds. These results demonstrate that a self-constructed code world model can be more practical than direct VLM play in settings requiring repeated deployment.
Create a lesson
Related papers
Evolving Pixel-Based Game Agent: Generalizable Strategy Learning from Open-World Exploration
Shared title terminologycs.AIXinyu Liu, Chenwei Tang, Zizhou Wang et al.
PlayCompass: Recursive Self-Improvement for Game Generation with Visually Grounded Evolving Rubrics
Shared title terminologycs.AIFuxiang Zhai, Sixiang Chen, Tengjun Huang et al.
GameAtlas: Bringing LLM Agents Back to Basics in Visual Coding and Spatial Reasoning for Game Development
Shared title terminologycs.AIYusong Sun, Jingtan Chen, Zixuan Zhang et al.
Scout: A Game-Based Framework for Teaching Token, Energy, and Water Awareness in AI-Assisted Programming
Shared title terminologycs.AIAbdur R. Shahid, Ahmed Imteaj
Self-Regression-Test: Persistent Behavioral Contracts for Skill-Evolving Agents
Shared title terminologycs.AIXinjian Yi, Rui Qian, Xutao Mao et al.
Crowded at the Frontier: Model Advantage and Herding among LLM Agents in the Minority Game
Shared title terminologycs.AIZan-Kai Chong, Alan Yi-Lun Khor, Nur Alysha Ismady