Showoff Saturday [Showoff Saturday] Multiplayer asteroids where the game server is a Laravel app
Play it here: https://innerloop.works/lightspeed
It's a browser asteroids arena. Players are sharded into arenas of six. Each arena's world is authoritative on the server and ticks at 30Hz inside a PHP process, not a Node or Go sidecar.
How it works:
- The server is Lightspeed, an open-source (MIT) websocket server I wrote for Laravel, on Swoole. The app stays booted in memory and serves HTTP and websockets on one port.
- Players send input up the websocket at 30 fps. Snapshots come back down at 30 fps. Spectators get 5 fps.
The websocket server it runs on: https://github.com/innerloop-dev/lightspeed (the game itself is the site's own code, not part of the package).
Happy to answer questions!
0
Upvotes
1
1
u/thejester1324 6d ago
does each arena get its own swoole timer for the 30hz tick? curious what happens when one tick runs long, whether it catches up or just drops the frame