This site contains illustrative data. Register to hear about our openingRegister

Skip to content

Live

Asteroides

A faithful Spanish-language remake of Atari's 1979 Asteroids, built as a single dependency-free HTML file: vector graphics on a 2D canvas, synthesized CRT-era sound, a global high-score table and an AI player that plays the game itself at three skill levels — a demo of an agent that acts through the very same controls a person uses.

Vector line-art of a spaceship firing amid asteroids on black, with the ASTEROIDES wordmark in arcade CRT style

The challenge

The point was never another Asteroids clone but a believable AI pilot. A bot with perfect aim and perfect reflexes never dies and reads as a machine sweeping rocks aside — the hard part is making it play like a person who could actually lose.

And it had to be a genuine player, not a script that nudges asteroids out of the way: it should sense the same world the game renders and act only through the controls a human has.

The approach

The whole game is one dependency-free index.html: vanilla JavaScript drawing vector shapes on a 2D canvas, physics with real inertia on a toroidal wrap-around world, and every sound synthesized with the Web Audio API. A global scoreboard runs on Netlify Functions.

The AI reads the same in-memory state as the renderer and writes to the very same input object the keyboard does. It perceives, replans on a cadence rather than every frame, then either evades — threats push it toward safe space — or hunts, locking a target and leading the shot.

Its imperfection is deliberate and never fully switches off, even at the top level: a human-like reaction delay is what keeps it beatable and believable rather than a flawless automaton.

Stack

  • JavaScript (vanilla)
  • HTML5 Canvas
  • Web Audio API
  • Netlify Functions

More projects