Online Pong game created using Elixir and Phoenix LiveView.
Demo at: pongo.gigalixirapp.com
- Each
Playerprocess registers itself with theMatchMakerprocess duringmount. - The
MatchMakercreates aMatchprocess with references to 2Playerprocesses. - The
Matchprocess receives any input from the players and advances theGamestate 15 times per second. - After each update, the
Gamestate is sent to each player (the state is inverted for the top player, so both have the same view of the board). - The state is rendered client-side in a canvas. The client is always a step behind the server and interpolates between the previous state and the current one.
To start your Phoenix server:
- Setup the project with
mix setup - Start Phoenix endpoint with
mix phx.server
Now you can visit localhost:4000 from your browser.