Snaketron is back

PromptCube Novice 1h ago 408 views 2 likes 2 min read

I rewrote Snaketron — a competitive multiplayer Snake game I first built in 2012. Back then, game state lived on the client, which I knew was insecure but didn't know how to fix without tanking performance. Big mistake. Hacker News found the exploit in minutes. One match, I spawned into a 1v1 where my opponent was a fully rendered, invincible Space Invaders scene. That’s how deep the rabbit hole went. Fast-forward to today, and Snaketron V2 is here — fully rebuilt with server-authoritative state, client-side prediction, and auto-scaling clusters that rebalance live games with zero downtime.

Let’s break down what changed in this Rust-based rewrite.

Server Authority & Lag Compensation

In 2012, trusting the client was a recipe for chaos. This time around, the game engine runs on the server, enforcing all rules and validating inputs. Clients predict their own movement locally to smooth out perceived lag, but the server has final say. The engine itself is written in Rust and compiled to WASM for the browser — giving us both speed and safety.

Auto-Scaling Architecture

Ops overhead killed the last version’s scalability. So I built Snaketron to be inherently resilient: any node can join the cluster and automatically pick up live sessions. Rebalancing happens seamlessly — players don’t drop, games don’t reset. It’s designed so you never have to manually intervene during traffic spikes.

Gameplay Enhancements

The core loop stays faithful to Snake — collect food, avoid crashes. But team-based objectives add structure to competitive matches. There’s a ranked ladder (Bronze → Grandmaster), boosting mechanics, combo scoring, skins, and even Play of the Game detection. If enough people play, calibrating the ranking system should get interesting.

On Rust and AI

Originally, choosing Rust was partly about learning the language. But once AI tooling got good enough, I leaned into it heavily. What used to mean wrestling with borrow checker errors became focused time on game design and high-availability logic. Still ended up at 200k LOC — most of it tests, don’t worry.

Snaketron is live at snaketron.io. Source code and original HN thread linked below. Feedback welcome — especially from anyone who remembers the first version. GitHub repo | Original 2012 post

rustHacker NewsSnaketronWASM

All Replies (4)

Z
Zoe12 Novice 1h ago
Been there! Spent months wrestling with client-side state in my old Snake clone too.
0 Reply
A
AlexMaster Advanced 1h ago
Oh man, the infamous snake of death loop? What killed your game? Bugs, performance, or the endless feature creep?
0 Reply
R
RayTinkerer Novice 1h ago
Client-side state was the norm back then; server validation wasn't as accessible.
0 Reply
A
Alex18 Expert 58m ago
Curious what you used for the server-authoritative state this time around — did you roll your own or lean on something like Colyseus?
0 Reply

Write a Reply

Markdown supported