How it works
Two teams, blue and orange, play by volleyball rules: the server hits from behind the end line, each side gets at most three touches, the same player may not touch twice in a row, the ball must cross between the antennas, and a ball that lands outside the lines or touches a wall or the ceiling is out. Rally scoring, sets to 25 (win by 2); the team that wins a rally serves, and rotates when it wins the serve back.
How it learns: there is one agent, and every player on both teams is that agent. Each generation, a slightly mutated copy (blue) plays one match against the champion (orange). If the copy wins clearly – by a margin that grows with the number of decided rallies, so luck rarely decides – and also holds its own against the first brain and the last few champions, it becomes the new champion; otherwise it is thrown away. Mutation steps shrink while copies keep winning and grow when none has won for a while. Every 10 generations the champion also plays the very first brain – the chart shows that share, where 50% means no better than the start.
A hard ball is hard to control: the faster it arrives, the less exact the next pass or hit – which is what makes hard serves and spikes win points.
On each touch the brain decides whether to pass (code then lobs it to the best-placed teammate: a forearm bump low, a two-hand set high) or to attack – a one-arm swing on a high ball, aimed by the brain. Passes that are played on, and balls sent over after two or three touches by different players, earn extra.
The evolved brain decides six things per player, 60 times a second: whether to spike (code then times the jump), the hit angle, the sideways aim, the power, pass or attack, and whether to throw a backflip in the air. The server's brain also picks the serve's angle, power and direction. Ordinary code runs each player to the ball (if it is theirs to take) or back to their spot. It sees the ball, where the ball will come down, its teammate and the net, all mirrored so every player thinks it plays from the left.
Ordinary code animates the body: spine, head, three-part arms (upper arm, forearm, hand) and three-part legs (thigh, shin, foot) are posed with inverse kinematics so the hands reach for the ball. Hands and forearms strike, shins and feet kick (upside down in a flip that is a bicycle kick), and every other part only deflects the ball. Each part is drawn exactly as wide as its collision shape – tick “Show hitboxes” to see them.
Training rallies stop after 30 s and then count for neither side; the match on show has no time limit and is played to the end.
The court is 3D: players move forwards, backwards and sideways, each has a home spot so the team covers the whole half, and a ball landing outside the lines is out. The 2D view is a side-on look at the same court. Drag the 3D view to orbit, scroll to zoom.