Cosmic Drift

paused

Space-themed absorption game with physics-based movement and AI ecosystem

Tech Stack

HTML5 CanvasJavaScriptCSS

Gameplay

Absorb smaller planets, avoid larger ones, be the last one standing

Survival mode gameplay

What We Built — my first game, somehow

Phase 1

Unified Physics

This started as a fishy clone — you know, the "big fish eats small fish" game. Somewhere along the way, fish became planets, and I thought: what if every planet had gravity? Suddenly we needed real physics — gravitational pull based on mass, inverse square law, the whole thing.

Every celestial body follows the same rules: force = G × mass / distance². Get too close to a bigger planet and you'll get sucked in. But here's the fun part — the boost ability triples gravity effects. Great for vacuuming up food particles, terrifying near anything larger than you.

The result: Food orbits planets, small bodies slingshot around large ones, and boosting near a giant is basically a death wish

Phase 2

AI Ecosystem

The AI isn't smart — it's just paranoid. Each bot constantly scans for two things: prey (anything 10% smaller) and threats (anything 10% larger). Hunt the former, flee the latter.

Add in boundary avoidance (the map shrinks battle-royale style) and boost decisions, and you get emergent behavior that feels alive. Planets cluster around food, scatter when a giant approaches, and occasionally pull off accidental slingshot maneuvers that look intentional.

Fun bug: Early versions had AI boosting into gravity wells constantly. Turns out "always boost toward prey" doesn't work when prey is orbiting a sun

Tech Stack

Vanilla JSHTML5 CanvasCSS3Vercel

No frameworks, no build step, just 1,700 lines of JavaScript and a lot of requestAnimationFrame calls. Sometimes the old ways are the fun ways.