Skip to content
Go to file

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time


TLDR: I made a mutiplayer Pong game using Elm, Elixir GenServer and Phoenix.

Demo player 1 Demo player 2

Please allow some time for the dyno to spin up. If multiple people try to control the same player, hilarity ensues.


I wanted to develop my Elixir and Elm skills and I figured a mutiplayer game would really exercise the whole stack. I had come across the original Elm Pong game some years ago and decided to make it multiplayer and move all the game state to the server. After completing the excellent Elm, Elixir and the first part of the Elm + Elixir courses by The Pragmatic Studio, I was confident enough to try.


I started with porting the game state of the original game to a simple Elixir module:

I then added a basic GenServer to hold the game state and actually run the game:

After testing this from an IEx shell, I added a separate Phoenix app, with the sole purpose of serving the Elm game client itself and provide websocket funcionality using the excellent Phoenix Channels. After getting the channels to work in plain old Javascript, I grabbed a 0.18 port of the Elm Pong game: Then I set to work to replace all the client-side game state updates with calls to and from the Phoenix backend:

To watch this process, you can checkout commits:


Finally I converted the whole thing to an Elixir umbrella app, since that proved easier to deploy to Heroku.

What's next?

Some obvious improvements are:

  • actual user sessions
  • game create
  • share game link

These features are much like some topics in the Unpacked: Multi-Player Bingo course. Then there are some gameplay improvements:

  • do not allow paddle move during pause (because that's cheating)
  • save key-down event in state until key-up event (this is already implemented in the 0.18 port I stole
  • save and publish highscores, which allows me to play with Ecto


This whole exercise was a very pleasant experience with very little frustrating moments. This was very suprising, given my experience with Elixir (little) and Elm (none). If you have any questions, drop me a line.


A multiplayer Pong game using Elm, Phoenix and GenServer




No releases published


No packages published
You can’t perform that action at this time.