stevegrossi / sengoku

An online Risk-like game built with Elixir and Phoenix LiveView
https://www.playsengoku.com/
59 stars 3 forks source link

Migrate from React to LiveView 🔥 #49

Closed stevegrossi closed 4 years ago

stevegrossi commented 4 years ago
screenshot

Sengoku 1.0's architecture had a tree of React components subscribed to changes in the game state via a Phoenix channel. That worked well enough, but had some performance struggles. I'm interested to play with LiveView, and its performance from sending minimal data over the wire is impressive (plus I'd rather be writing Elixir than JavaScript).

So, Sengoku 2.0 removes all React and custom JS in favor of a single LiveView component, GameLive. Instead of a Phoenix channel, the game's state is pushed to each player's LiveView over Phoenix.PubSub. Some other changes:

yakryder commented 4 years ago

Woo exciting!