8 ms·
Show HN: Battleship game built with Elixir, Phoenix, React and Redux
- jtokoph 10y agoVery cool demo of these technologies. I played around with Phoenix a few weeks ago and haven't had a chance to come back to it. Are you using Phoenix channels for the real time communication?
- dsiegel2275 10y agoLooks like the author is using a server side route and controller just to render the initial view - and then beyond that he has two channels: one for players to join a game and one for managing game mechanics. I'm just learning Elixir and Phoenix myself. Looking at the source of this it is apparent even to me a newbie that a two player game where game state is managed as a supervised process - and the server manages many games is a nice example of the power of Elixir/Erlang to facilitate concurrent development.
- ElijahLynn 10y agoI am waiting for an opponent.. https://phoenix-battleship.herokuapp.com/game/DHT33GgB https://phoenix-battleship.herokuapp.com/game/DHT33GgB
- ElijahLynn 10y agoHrm, went back to tab and it said "Game over"...
- bigardone 10y agoHi! That's because someone joined the game and then left. The game process listens for exit messages from the two player channels. In case a player leaves, the game ends and sets the remaining player as winner.
- therockhead 10y agoCan not copy the url for a session using the iPad.
- MrLeap 10y agoMy coworker and I just tested this. It doesn't say when you've sunk a battleship. This took us to frown town. Also, it doesn't show you the borders between _your_ battleships if they're touching. Makes using the honor system to supplement the first thing very difficult.
- cpeterso 10y agoI've long wondered how a Battleship MMO might work, a game with a huge world map and multiple factions/navies trying to bomb each other. :)
- deleted 10y ago[deleted]
- arvinsim 10y agoAs a frontend developer working who works with React and Redux, I keep seeing Elixir and Phoenix articles popping up nowadays. What is the best reason to learn Elixir and the Phoenix for someone like me who just handles the client side part of a web application? Is it a better alternative to say, Django or RoR?
- blaix 10y agoIf you just handle the client side part, you don't really need to learn any of it. If you do need to get into the server-side, Elixir/Phoenix seems like a great fit if you are doing real-time/concurrent stuff (websockets are dirt-simple). If you just need a persistent storage backend, RoR or Django will get you up and running quickly, and both are adding their own websocket support as well.