This skill helps an agent build and debug a pygame game, targeting pygame-ce 2.5.8, the maintained fork that imports as pygame. It checks which package is installed, keeps game logic testable without a window and runs one loop per frame: drain events, update with a clamped delta, draw, flip.
It includes a loop that can run headless with a frame count and a screenshot, a sprite that moves at a constant speed on diagonals, and unit-test advice using the SDL dummy drivers. A gotcha list covers frozen windows, speed that varies per machine, integer Rect truncation and pygame and pygame-ce installed together.
What You Get
- A five-step workflow from checking the installed package to testable logic, one loop per frame, asset loading order and a headless verification
- A runnable loop with frame count and screenshot options, and a Sprite class using float rects and a normalized move vector
- Commands that run unit tests and a scripted game run with the SDL dummy video and audio drivers
- A gotcha list for frozen windows, frame-rate dependent speed, Rect truncation, convert errors, missing mixer and conflicting installs
Common Use Cases
- Starting a pygame project with a correct loop and delta time
- Fixing a window that says not responding
- Making game speed the same on every machine
- Running a game check in CI without a display
What Makes It Unique
The skill treats pygame-ce as the default and explains how to tell it from legacy pygame at run time. It builds the loop so it can quit after a set number of frames and save a screenshot, which lets an agent check drawing and loading without a screen, and it states what that run cannot prove.
Under The Hood
The agent loads the SKILL.md and, when needed, a reference on sprite groups, masks and audio. It runs a short Python command to read the installed pygame version, may install pygame-ce with pip for a new project, edits Python files in your project, and runs unit tests and the game with the SDL dummy video and audio drivers. The scripted run writes a PNG screenshot into your project. It fetches no web pages and calls no APIs; feel, audio and real input need a person to play and report.