Individual academic projectDesktop version
Pong
Motion, contact and reaction.
Solo against AI at three difficulty levels, local duels and four-player survival. A Python desktop game exploring simulation steps, swept collisions and imperfect decisions.
My workI develop the simulation, modes, interfaces and records for this individual academic game.

Python / pygame-ce · Desktop
Pygame-rendered captures with scripted input. Desktop games.
Separate the rhythms
Simulation advances in 1/120-second steps. Rendering is separately capped at 60 frames per second.
The match model is independent of the window. The screen turns held keys into directions; an accumulator consumes time in fixed steps, then the renderer draws the state. Time beyond a 0.1-second stall is discarded rather than fully caught up.
Through the contact
The ball is modelled as a square. The code finds the first contact along its movement and uses remaining step time after the bounce. It tests expanded paddle front faces; a ball already behind a paddle cannot be returned. Contact position changes deflection, up to 60° from horizontal.
Imperfect AI
Predicting a target does not mean tracking it perfectly.
The AI periodically samples an interception target. It predicts a fraction of travel, folds wall rebounds, adds bounded error and moves at a limited speed. Between reactions its target may be stale. With multiple balls it prioritises the approaching ball with the nearest estimated contact.
Easy
- Maximum speed
- 220 px/s
- Reaction interval
- 0.240 s
- Aim error
- ±36 px
- Prediction fraction
- 0%
Normal
- Maximum speed
- 320 px/s
- Reaction interval
- 0.150 s
- Aim error
- ±22 px
- Prediction fraction
- 45%
Hard
- Maximum speed
- 400 px/s
- Reaction interval
- 0.095 s
- Aim error
- ±14 px
- Prediction fraction
- 80%
Change the rules

Classic mode plays to seven points, solo or in a local duel. Four-player survival uses four sides and individual lives; eliminated sides change how the arena plays. Simultaneous contacts have explicit ordering: walls and paddles precede goals.
Enlargement, slowdown and multiball change the rally. Durations advance during active simulation, not pause. The first goal ends a classic rally for one point and clears remaining balls. The game attempts to save a record once at the end of a finished match; leaving or restarting is not a result.
Tests and limitations
Isolated tests cover collisions, AI, modes, effects, states, records and resizing among other behaviour. Captures use the pygame renderer and a scripted sequence under SDL without a visible window.
Rally rhythm, difficulty, control comfort and four-player keyboard input still require physical playtesting.