snakes.run: rendering 100M pixels a second over ssh
SMRTR summary
A developer has created what might be the nerdiest multiplayer game ever: a version of Snake accessible only through SSH commands in your terminal. Players simply type "ssh snakes.run" to join thousands of others in a shared digital playground, but the real marvel lies beneath the surface.
The creator faced a fascinating technical puzzle. Early versions consumed a staggering 35 kilobytes per second of bandwidth per player, enough to "easily saturate a 56k modem." The solution involved clever Unicode trickery, cramming two pixels into each terminal character using block elements and exploiting foreground and background colors.
Performance posed another headache. Initial tests showed the server burning through a full CPU core for every 40 players. Through meticulous optimization, including gutting helpful but slow utility libraries and pre-allocating everything to reduce garbage collection, the developer achieved a 25-fold performance boost.
The backend now handles 2,500 concurrent players while rendering over 100 million pixels per second. It's a testament to creative problem-solving in an era where most games rely on fancy graphics engines, proving that sometimes the most innovative gaming experiences happen in the humble terminal window.
SMRTR provides this summary for quick context. The original article belongs to lobste.rs.
Read the original article