Iron Potatoesgames · devlog

Day one: a repo, and a ball that bounces

We started where most people would not: not with a sprite, but with a test.

Pong’s rules fit in about 150 lines — a ball, two paddles, a score, and a condition for winning. That is small enough to write down completely before building anything, which is exactly what makes it worth writing down as tests first. “First to five wins.” “The ball speeds up on every return.” “A ball that gets past a paddle scores for the other player.” Each of those is a sentence and also a test.

The rules live in their own package with no game engine in it at all. Phaser draws the result and reads the keyboard, and that is all Phaser does. It means the whole game can be played at ten thousand frames a second in a terminal with no browser open, which is how we know it works.

The first real bug was a good one. At full speed the ball moves about twelve pixels between frames, and the paddle is fourteen pixels wide. Ask “is the ball touching the paddle right now?” on each frame and eventually the answer is no every single time — the ball is in front of the paddle on one frame and behind it on the next, and it sails straight through. The fix is to ask a different question: did the ball cross the paddle during this frame, and if it did, where was it vertically at the moment it crossed?

Then there is the file called tuning.ts, which may be the most important file in the project. It has no code in it, only numbers with names: how fast the paddles move, how big the ball is, how many points win a game. It exists so that the six-year-old half of this studio can change how the game feels without being able to break it.

Next: making it look like something.