Break point · Tennis Elbow 4
TE4
COACH
It cracks open the game's replay files and coaches you from your own match history.
Ball tracking
Every dot is a shot from a real decoded replay. Pick a filter and watch the ball land.
Real decoder output from one match, 6-0 6-0, kept as 59 points and 184 shots. Player names are replaced with placeholders. Shot heights are drawn for effect.
What it does
Four jobs, one database.
- 1
Decode the replay
Tennis Elbow 4 writes each match to a binary .dmo file with no documentation. TE4 Coach reads every frame: where the ball is, where both players stand, what buttons they hold.
- 2
Rebuild every point
From those frames it works out the serves, shots, bounces, winners and errors, then stores them in SQLite next to the game's own match log.
- 3
Grade each shot
Each shot is compared with what players have done from a ball like it. The page shows what you did, what the best pick was, and what to press next time.
- 4
Show it on a dashboard
Match pages, point-by-point replays, opponent pages, and a library of situations. A public upload site lets anyone try a single replay without my data.
Replay booth
The dashboard and the public upload site.
Why I built it
Tennis Elbow 4 saves an HTML log with a stat table per match, and the totals disappear into a long page. I wanted to get better at the game, and totals do not say why a point was lost.
The replay files do. They hold every point, serve and ball position, but in a format nobody documented. So the first job was reading them. Once the points were out, the job became turning them into advice a player can use mid-match: which button, which direction, how early.
The tool only reads files the game has already written. It never touches the running game.
How it's builtstack · architecture · hard problems
Architecture
- Python standard library only, no framework. Run
python -m te4coach.serverand open the dashboard. - Read-only by design. It reads files the game wrote after a match and never hooks the game.
- Ingest is incremental. A finished match shows up in the dashboard within about 10 seconds.
- Two sites from one codebase: the owner's dashboard, and a public upload site that analyses one replay and shows nothing of the owner's data.
- Releases go through a gate that starts a private copy of the whole tool and uses both sites before anything goes live.
Problems worth mentioning
- An undocumented binary format. Frames are variable length and positions are 32.32 fixed-point numbers. Matches against the computer write shorter frames, and some matches set a flag but leave out the energy values. The reader tries both layouts, which brought six unreadable replays back.
- Proving the decode is right. Replay-derived points, aces, winners and double faults are checked against the game's own match log. From the replay alone, the match result comes out right in 90 of 91 online matches. The one miss is decided by the game after the replay closes.
- Speed. A match page took 10 to 15 seconds to build. Caching each page as gzip JSON, keyed to the code and the data, brings a warm load to about 0.2 seconds.
243 commits · 58 Python modules · private repo
Try it with your own replay
Upload one Tennis Elbow 4 replay and see it analysed. The public site is a demo and has no access to my match data. Replays need ball and player positions recorded.