15 Jul 2026
Match AI
Set pieces
The opponent now takes its own throw-ins, goal kicks and corners
Set pieces are where football games quietly give up. Ours doesn't
anymore — the whole restart cycle plays itself, on both sides.
Every restart used to be a dead moment for the AI: the ball would sit there, then
get nudged into play by invisible hands. Now the opposition plays them properly.
Throw-ins: two or three players check to the ball, breaking to short, open
angles. The thrower picks the genuinely open man — every team-mate is scored on
space, passing lane and distance the instant before release — then the ball goes to
his hand, he winds up, and throws.
Goal kicks: two centre-backs split to the edges of the six-yard box, and the
keeper plays out from the back to whoever's free — or boots it up to the striker at
halfway if he fancies it. Your team is walled out of the box until he strikes it,
exactly as Law 13 says.
Corners: a driven cross to the danger zone, six attackers crashing near-post,
spot and far-post — and three staying home for the counter, because you don't send
everyone up.
The best bug: the thrower kept throwing to himself. A ball in flight has no
owner, so every AI fell back to "loose ball — closest man presses it." The thrower
was closest. The receiver, seeing he wasn't closest, politely jogged away. Fixed by
telling the team that a ball we've just played still belongs to us.
14 Jul 2026
Match AI
Milestone
Eleven a side
I didn't write AI for 22 players. I wrote it for two.
Twenty-two players each deciding for themselves gives you under-8s football:
everyone chases the ball, nobody holds a shape, because nobody is thinking about the
team.
So I stopped writing player AI and wrote a Team Brain — one per side. It
thinks ten times a second and hands every player a target. Players don't decide where
to be; they read. What it actually does is move a block: it slides up and down
the pitch with the ball, shifts to the ball's side, squeezes tight when you lose
possession and spreads when you win it. That's just… football.
And here's the part I love: twenty-two players scanning each other every frame is a
slideshow. One brain per team isn't. Team shape and performance turned out to be
the same problem — and the same fix.
The pitch got the same treatment. Twenty-two hardcoded numbers became one config, so
the code that paints the eighteen-yard box and the code that enforces
it are now guaranteed to be the same box.
Bug of the week: the opposition stopped attacking and started running at their own
goal. Each player carried a hand-typed "goal to attack" coordinate — and I'd resized
the pitch. Now it's derived from the pitch and your shirt colour. It can't go stale,
and it can't be typo'd.
11 Jul 2026
Gameplay
Corners, and the full set-piece cycle
Throw-in, goal kick, corner. The match can now restart itself from
anywhere the ball goes out.
Corner kicks landed this week — an aimed ground ball on one button, a lofted cross
on another, both charged, both with a proper run-up that strikes the ball on the exact
animation frame rather than teleporting it.
That completes the cycle. Every way the ball can leave the pitch now has a real,
playable restart with its own camera, aim and animation. It sounds unglamorous until
you play a match without it and the game just… stops.
9 Jul 2026
Characters
Real bodies, real kits
The kit colour isn't something I picked. It's pulled straight from the
club's record in the database.
Change the club, the shirts change. Team colour from the club, opponent in theirs,
and the goalkeeper in something that clashes with both — which isn't my preference,
it's Law 4 of the actual laws of the game.
Getting there was funnier than it should have been. My first attempt put the kit
on the mannequin: his chest punched straight through the shirt, like a robot
in pyjamas. The fix was a realisation, not a hack — the character system
deletes the body geometry that sits under clothing. The arms, the legs and the
outfit are made for each other. I was dressing the wrong body.
Zero per-player setup: spawn a footballer, tag him with a team, and he turns up in
the right shirt. That's the whole point of building data-first — the game gets more
real without me touching it.
6 Jul 2026
Match AI
Teaching the AI to actually pass
Every team-mate gets an Expected Success % — then the AI picks like a
footballer, not a dice roll.
The passing brain scores every option on four things: how far it is (there's an ideal
range — hopeful punts and toe-pokes both score badly), whether the lane is genuinely
open (measured geometrically, not guessed), how much space the receiver has, and how
much the ball actually progresses up the pitch.
Then the off-ball players got the same treatment in reverse: instead of scoring who
to pass to, they score where to stand — open space, a clear lane from the
carrier, spread from team-mates. Passing triangles emerged on their own. I didn't
write "make a triangle" anywhere.
My favourite fix in the whole project came from this. The players kept slowly
bunching together over a match, and I could not see why — until I realised that
while a pass is in the air, the ball has no owner. Every team-mate dropped into
"loose ball — closest man presses it," and the whole team converged. On every single
pass. Possession, it turns out, includes the ball travelling between two of your
players.