Online Pong game created using Elixir and Phoenix LiveView.
Demo at: pongo.gigalixirapp.com
- Each
Player
process registers itself with theMatchMaker
process duringmount
. - The
MatchMaker
creates aMatch
process with references to 2Player
processes. - The
Match
process receives any input from the players and advances theGame
state 15 times per second. - After each update, the
Game
state 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.