oneshotlm
Compare all models on this prompt →

Asteroids · glm-5

Build a playable Asteroids game on a canvas: a thrust-and-rotate vector ship that shoots and wraps around the screen edges, splitting asteroids into smaller pieces, with score and lives. Procedural vector graphics only, no external assets.

⛨ sandboxed Open in new tab ↗
transcript · 4 messages
user

Build a playable Asteroids game on a canvas: a thrust-and-rotate vector ship that shoots and wraps around the screen edges, splitting asteroids into smaller pieces, with score and lives. Procedural vector graphics only, no external assets.

assistant
thinking
The user wants me to build a classic Asteroids arcade game. Let me plan out the features:

1. **Canvas-based game** - All rendering on HTML5 canvas
2. **Vector ship** - Triangle ship that can thrust and rotate
3. **Controls** - Arrow keys or WASD for rotation and thrust, space to shoot
4. **Screen wrapping** - Ship, bullets, and asteroids wrap around edges
5. **Asteroids** - Procedural vector graphics (irregular polygons), split into smaller pieces when shot
6. **Score system** - Points for destroying asteroids (more for smaller ones)
7. **Lives system** - Multiple lives, game over when all lost
8. **Collision detection** - Ship vs asteroids, bullets vs asteroids

Let me build this step by step:

1. Ship mechanics:
   - Position, velocity, angle
   - Thrust adds velocity in facing direction
   - Rotation changes angle
   - Inertia/friction for space feel
   - Wrap around screen

2. Bullets:
   - Fired from ship position in facing direction
   - Limited lifetime
   - Wrap around screen

3. Asteroids:
   - Random irregular polygon shapes (procedural)
   - Different sizes (large, medium, small)
   - Split into 2-3 smaller asteroids when hit
   - Random velocities
   - Wrap around screen

4. Collision detection:
   - Circle-based for simplicity
   - Ship hit = lose life, respawn
   - Bullet hit = asteroid splits/destroys

5. UI:
   - Score display
   - Lives display (ship icons)
   - Game over screen
   - Start screen

Let me write this all in one HTML file.

I'll build a complete Asteroids game with all the classic features. Let me create this in a single HTML file.

write /workspace/index.html (17787 bytes)
toolResult

Successfully wrote 17787 bytes to /workspace/index.html

assistant
thinking
I've created a complete Asteroids game. Let me verify the file exists and summarize what I built.

I've created a fully playable Asteroids game in `index.html`. Here's what's included: ## Features **Ship Controls:** - **Arrow Keys / WASD** - Rotate and thrust - **Space / X** - Shoot **Gameplay:** - Vector graphics ship with thrust animation - Screen wrapping for ship, bullets, and asteroids - Procedurally generated asteroid shapes (irregular polygons) - Asteroids split into smaller pieces (Large → 2 Medium → 2 Small) - Points: Small=100, Medium=50, Large=20 - 3 lives with invincibility after respawn - Progressive difficulty (more asteroids each level) **Visual Effects:** - Thrust flame animation - Explosion particles when ship is destroyed - Particle debris when asteroids are destroyed - Ship flickers during invincibility - Start screen with floating asteroids demo **UI:** - Score display - Lives shown as ship icons - Start screen with instructions - Game over screen with final score

TAKE IT TO CODE

A single self-contained HTML file — copy it and open in any browser, or reuse the prompt with your own pi-agent run.

RUN

modelglm-5
vendorZ.ai · GLM
harnesspi-agent
generated2026-07-22

EVALUATION

3/5 working

Menu transitions into gameplay with a visible ship and drifting asteroids after Enter/Space/arrows/WASD, but no visible score/lives HUD or shooting confirmed.

Vision grade · anthropic/claude-sonnet-5

MEASUREMENTS

Raw readings from the capture, not a verdict — the grade above is the only judgement. Percentages are how much of the screen changed; the measure under-reports sparse motion on a dark background.

idle motion2.8%
on click2.6%
on drag3.1%
on wheel2.7%
on enter + space4.6%
on arrow keys2.8%
on w/a/s/d2.3%
frame spread15.9 / 255
console errors0
js errors none

METRICS

runtime78.9s
tokens in4.4k
tokens out4.5k
cached2.9k
cost / run$0.0116