A PyTorch PPO agent plays the real QWOP browser game through Playwright. Six evaluation races, six 100 m finishes. Grace was not part of the reward function.
Rebuilt in 2026 with Stable-Baselines3 PPO, PyTorch and a Gymnasium environment driving the official browser game through Playwright. Eight browser environments trained for 22 minutes. The recorded evaluation finished all six races; the best normal-speed game time was 193.8 seconds.
What it's good for
Shows how to train against a real browser game without a simulator or a modified game: Playwright presses the keys, a virtual clock makes every step exactly six frames, and the same keys replay the same race. A busy machine just plays slower, not differently.
Diagrams
Main paths only. The edge cases stayed in the code.
The finish screen said 19.4 seconds. It was 193.8.
Point at a box to see what it connects to.
Look at the runner84x84 grayscale, last 4 stacked
Hold one of nine key combosQ/W thighs, O/P calves
Advance exactly six frames0.1 s on a virtual clock
Read the distance with OCRJumps over 2 m ignored
Reward metres gained, minus time+1 a metre, -0.002 a step
Race over?End panel, stall or 15 min
How did it end?
Add 50 for the finish
Third finish?
Subtract 2 for the fallSmall, or it freezes
Press R, race againSame page, no reload
256 steps per browser yet?
PPO updates the policy4 epochs, batches of 512
Stop trainingMain run: 22 minutes
Look at the runner(84x84 grayscale, last 4 stacked) → Hold one of nine key combos
Hold one of nine key combos(Q/W thighs, O/P calves) → Advance exactly six frames
Advance exactly six frames(0.1 s on a virtual clock) → Read the distance with OCR
Read the distance with OCR(Jumps over 2 m ignored) → Reward metres gained, minus time
Reward metres gained, minus time(+1 a metre, -0.002 a step) → Race over?
Race over?(End panel, stall or 15 min) → yes: How did it end? → no: 256 steps per browser yet?
How did it end? → finished: Add 50 for the finish → fell: Subtract 2 for the fall → cut short: Press R, race again
Add 50 for the finish → Third finish?
Third finish? → yes: Stop training → not yet: Press R, race again
Subtract 2 for the fall(Small, or it freezes) → Press R, race again
Press R, race again(Same page, no reload) → 256 steps per browser yet?
256 steps per browser yet? → yes: PPO updates the policy → no: Look at the runner
PPO updates the policy(4 epochs, batches of 512) → Look at the runner
Stop training(Main run: 22 minutes)
Features
Official QWOP game in headless Chromium
Eight parallel training environments
OCR distance feedback and shaped rewards
Training curves, checkpoints and run GIFs
The problem
Learning a stable gait from browser-game observations
Measuring normal-speed game time consistently
What I did
PPO with a Gymnasium environment and Playwright controls
Fixed 60-frame game seconds and explicit evaluation records
Results
Completed 100 m in all six recorded evaluation races
Best normal-speed game time: 193.8 seconds
Training run: 22 minutes across eight browser environments
A 200.2-second race at 4x speed: the trained agent knee-scoots the whole 100 m
What I learned
The finish screen shows a tenth of the real time, so '19.4 seconds' was a 193.8-second race.
Judging a finish by the score at the top booked 7 races that ended at 99.5 to 99.9 m as falls; now the end screen decides.
Skipping WebGL draw calls on frames between observations made stepping about 40% faster without changing the race.
How it fits together
Simplified on purpose. The real thing has more arrows and at least one config file nobody understands.
Screenshots
First 20 seconds: after 2 minutes of training it does the splits; after 22 it moves on
Learning curve: the best race reaches 100 m after 16 minutes; the average nears 60 m
The 2020 agent's finish screen: 592.1 on it, probably about 99 real minutes
Time-series models that forecast solar output for an energy-storage demonstration site, scheduled with Airflow. The sun is punctual; the clouds are the problem. The dashboards here are redrawn on simulated data.