Examples menu

๐ŸŽฎ Game of Life

Multiplayer Conway's Game of Life. Click to draw, watch patterns evolve.

Shared board via ROUTE scope โ€” everyone on this page sees and edits the same 50ร—50 grid. Click to draw a cross pattern in your color.
200ms timer evolves the board every 200 milliseconds server-side. The entire board state is re-rendered and pushed via SSE to all viewers.
2,500 divs, no problem โ€” each tick sends all 2,500 cells as plain HTML. No diffing, no virtual DOM, no clever protocol. The "stupid" solution just works because Brotli compression over SSE is absurdly efficient: 18 seconds of continuous updates transferred only 58 KB over the wire from 15 MB of raw HTML โ€” roughly 250ร— compression.
No canvas, no JS drawing โ€” the grid is a flat CSS Grid of server-rendered <div> elements with color classes. Datastar morphs them in place. The entire rendering pipeline is PHP string concatenation.
Why this matters โ€” frameworks that diff on the client or send fine-grained patches add complexity for marginal gains. SSE + Brotli makes the brute-force approach viable even at 5 fps with thousands of elements, which covers the vast majority of real-world UIs.
Color identity โ€” each connected session gets a unique color. Your cells are visually distinct from other players' cells.
Lazy timer โ€” the evolution loop pauses itself when no clients are connected. Re-open the page and it resumes from where it left off.
CSS Grid rendering uses inline styles on a flat grid of divs. No canvas, no JavaScript drawing code โ€” the server sends pre-colored HTML cells.
Collaborative drawing โ€” every click is an action that mutates the shared board, then broadcasts the result. Multiple users can sculpt patterns together in real time.

Click cells to draw patterns. Multiple users can draw simultaneously! ๐Ÿ‘ฅ 3 connected

Generation: 180444

๐ŸŽฏ Actions

toggleRunning

Pauses or resumes the simulation timer.

reset

Clears the entire board and resets generation counter.

tapCell

Draws a cross pattern at the tapped cell in the session's color.

๐Ÿ‘ Views

game_of_life.html.twig

ROUTE-scoped. 2,500 divs in a CSS Grid, re-rendered every 200ms by server timer. No canvas, no JS drawing.