Better HN
topnewbestaskshowjobs
Log inSign up

henrysdev

7 karma · joined Sep 10, 2020 (6y ago) · 1 submissions

Submissions

comment 5y ago · link · parent

Great article. I'm currently building a turn-based multiplayer improv piano game for the web using Elixir/Phoenix.

In a nutshell, you compete with other players on creating freestyle piano solos over backing tracks using a MIDI keyboard. Players and audience members then listen through the solos and vote for their favorite.

The Elixir/Phoenix stack has been an absolute superpower for building my game backend. Some examples:

    - Phoenix channels as a wonderful abstraction over 
      managing WS connections. Implementing basic chat took ~3 
      minutes on the backend.

    - The ability to model game logic with a finite state 
      machine in a GenServer. The lifecycle of a game round is 
      progressed forward by receiving incoming client events.

    - The ability to have many game servers 
      running simultaneously as a dynamic pool under a 
      DynamicSupervisor. Games can end and new games can be 
      created, all isolated and under watchdog-like 
      supervision.

    - ETS as an out-of-the-box memory cache for session data. 
      Persisting user data between pages and sessions without 
      needing to deal with an actual persistence layer.
For the curious, the project is called Midi Matches and is currently in public alpha:

Game (desktop chromium only): http://midimatches.com/

Gameplay Video: https://www.youtube.com/watch?v=UVD2wOCB_jE&t=41s

Repo: https://github.com/henrysdev/midimatches