Show HN: Pigame – pi+LLM plays black-box browser games via observe/move tools
GameMind is a project that combines Raspberry Pi with LLMs (e.g., DeepSeek) to create a general game-playing agent, with Neon Snake as the first demo The architecture separates concerns: Pi+LLM acts as the "brain" for strategy and decision-making, while Playwright-controlled Chromium serves as "eyes/hands/feet" for observation and action A key technical innovation is the agent-mode game loop: the upstream Snake game ticks autonomously, causing stale decisions during LLM inference; the fix freeze
Analysis
TL;DR
- GameMind is a project that combines Raspberry Pi with LLMs (e.g., DeepSeek) to create a general game-playing agent, with Neon Snake as the first demo
- The architecture separates concerns: Pi+LLM acts as the "brain" for strategy and decision-making, while Playwright-controlled Chromium serves as "eyes/hands/feet" for observation and action
- A key technical innovation is the agent-mode game loop: the upstream Snake game ticks autonomously, causing stale decisions during LLM inference; the fix freezes the world on
game_observeand advances exactly one grid step pergame_movecall - The project provides three tools (
game_observe,game_move,game_wait) and a structuredAgentStatefor the LLM to interact with the game - Distribution is via Pi extension format, with npm packaging support and a mock adapter for testing without a live game
Why It Matters
This project demonstrates a practical pattern for building LLM-powered game agents on resource-constrained hardware, which is directly relevant to anyone exploring embodied AI or tool-use architectures. The agent-mode game loop solution—freezing simulation time during LLM reasoning—addresses a fundamental challenge in real-time agent-environment interaction that scales to other domains beyond gaming.
Technical Details
- Architecture: Three-layer design where Pi+LLM decides strategy,
game_observereads screen state intoAgentState, andgame_move/game_waitexecute actions; test scaffolding (smoke:*) uses hardcoded loops separate from the agent path - Agent-mode game loop: The vendored
snake.htmlpauses the auto game loop on connect (setAgentMode(true)), freezes the world ongame_observe, and advances exactlyMOVE_STEPS(default 1) grid cells pergame_movecall, preventing decision staleness - Tech stack: Node.js ≥20 with
--experimental-strip-typesfor TypeScript, Playwright with Chromium for browser automation, Pi CLI for agent execution;HEADED=1flag controls visible browser window - Distribution: Packaged as a Pi extension (
dist/pi-pigame/) or npm tarball (dist/pigame-0.1.0.tgz), installable viapi install; rootpackage.jsonproxies scripts into thepigame/subdirectory - No dedicated tools: There is no
game_eat_foodorgame_survivetool—the LLM loopsobserve → moveitself, making it a general-purpose agent rather than a task-specific script
Industry Insight
- The agent-mode pause pattern (freezing simulation during LLM reasoning) is a transferable solution for any real-time environment where inference latency causes state drift; consider this when building agents for robotics, simulations, or live games
- The separation of "brain" (LLM) from "scaffolding" (game loop, I/O) and "tools" (observation/action) provides a clean template for building modular AI agents that can be adapted across different environments
- The project's emphasis on Pi as a deployment target suggests growing interest in edge-deployed AI agents; the packaging model (Pi extension + npm tarball) could serve as a reference for distributing similar tool-use agents
Disclaimer: The above content is generated by AI and is for reference only.