Sphxace Invaders
Space Invaders with a 50-millisecond server-side game loop and no custom browser JavaScript.
A game as an experiment
I recreated Space Invaders in Phoenix LiveView to explore its limits for a fast-changing, interactive interface. LiveView was still new at the time, and a game offered a different test from a typical web app.
A 50-millisecond game loop
Every 50 milliseconds, the game updated enemy ships, the player’s ship, and projectiles, then detected and displayed collisions. That meant running the game logic and sending the resulting browser updates 20 times a second.
I wrote the game logic in LiveView, with no custom JavaScript running on the client. LiveView handled the browser updates over its connection to the server.
What it demonstrates
The experiment put game state and collision detection on the server while the browser displayed the changes. Unlike a client-side game, those updates had to travel over the network. Watching ship positions change in the browser’s DOM made that work visible.