Code Battles is a free, browser-based coding game for primary and secondary schools. Instead of steering the robot, pupils program its brain, then watch it fight on its own in a 3D arena. They build WHEN-DO rules that decide what the robot does when an enemy is near, far, lined up in its sights or when its own health is low — the sense-think-act loop at the heart of real robotics and AI.
Pupils snap together drag-and-drop code blocks, reorder and delete them freely, and see the real Python or JavaScript the blocks become. Three difficulty tiers let a class work at the right level together: Beginner blocks, a Medium step up, and an Advanced tier of strictly text-based Python or JavaScript. It bridges the gap from blocks to written code inside a game, making it a free alternative to Scratch for teaching real programming.
A belt gauntlet runs from White to Black. Each rival has a weakness, hinted to the pupil, that can only be beaten by using a new coding idea — a condition, a loop, a variable or a smarter strategy — so progress and learning go hand in hand. Mastery stars reward flawless and dominant wins. It teaches conditionals, loops, variables, sensors and computational thinking for Key Stage 1 through Key Stage 3.
Pupils can build a robot in the companion app Robot Studio, export it as a 4-letter code, and import that code straight into Code Battles to send their own creation into battle — its shape and weapons come across, and the pupil writes the brain that drives it. Two players can also duel head-to-head on one keyboard. Battles are autonomous 3D fights with health bars, projectile trails and a slow-motion knockout.
Inside Code Battles is a Coding Dojo, a ladder of coding challenges across three tiers. In the Robot Courses track, pupils program a robot to carry out genuine robotics tasks: drive to a goal, stop at a wall using a distance sensor, dock on a coloured pad with a colour sensor, follow a bending line with a feedback loop, solve an L-shaped maze with a wall-following algorithm, climb a ramp onto a platform, slalom through gates by planning a route, and collect every ball before returning to the start with a two-phase program. Along the way they learn sequencing, loops, the distance and colour sensors, if / else conditionals, algorithms and state machines. In the Battle Tactics track they tune a battle brain and learn resource management. Every challenge a pupil clears earns permanent power for their battle robot, so it pays to program well — a better coder really does build a stronger robot, and coding, not the parts bolted on, decides the fight.
The highest rank in the Dojo, Grandmaster, is deliberately not won by being the strongest. Once a pupil has earned every belt they become a Master, and to reach Grandmaster they must give their knowledge back: they write a tip in their own words and publish their working solution to the Masters' Wall, where other pupils read it and study it to learn. Every shared tip is safety-checked before it appears. This is the message at the heart of the whole experience — that a true master is not the one who hoards what they know but the one who shares it, lifting others up, because being generous with knowledge rather than greedy is the real mark of mastery. It is a lesson in coding and in character at once.
Everything runs in the browser using WebGL. Nothing is uploaded, and on a shared classroom computer it starts fresh each session. Suitable for Key Stage 1, 2 and 3 Computing, coding clubs and STEM.
Four tabs at the top: 🤖 Robot (build it), 🏟️ Arena (build its world), 🏁 Drive (drive it), 🧩 Code (program it).