11 ms·
Nice article. I built my own online version of a turn based board game because none exists at the moment. I just want to play with my family so I didn't bother
by d0m3 5y ago
Nice article.
I built my own online version of a turn based board game because none exists at the moment. I just want to play with my family so I didn't bother coding a server at all, instead all clients communicate their actions to all others so I naturally implemented the deterministic approach. I haven't thought about secret state so it's interesting to see a possible solution for that. Fun!
- sjrd 5y agoI'm also writing an online version of a board game I like, to play with family and friends. I am about to start the networking part, and I actually intended to implement the deterministic approach, although I didn't know the concept had a name before reading the article. It's nice to read some validation that it is a good design. I'm curious to know how you achieve not to need a server at all. How do you create the initial connection between clients without a server to negotiate NATs and things like that?
- infinite8s 5y agoIf your game is web-based, you could leverage WebRTC - where you only need to share a unique link between users - see peerjs (https://peerjs.com/ https://peerjs.com/) or croquet.io (https://croquet.io/docs/croquet/ https://croquet.io/docs/croquet/)
- sjrd 5y agoIt is web-based, yes. I was aware of WebRTC but assumed I would need a least to host the server myself. I'm looking at the links you provided and they seem very interesting. Thank you.
- JoeOfTexas 5y agoIf you target desktop, should be fine, but mobile users tend to use cell towers which are on Symmetric NAT, which would require a TURN server on top of the WebRTC.
- sjrd 5y agoI'm targeting desktop, but your point is good to know, thanks. I will keep it in mind.
- meheleventyone 5y agoEven on desktop you run into people with weird configs. For example my router will not allow mDNS to work but my ISP NAT is pretty good so I can connect two machines as long as they’re not on the same network! In the end you almost always will need a relay to guarantee connectivity for any random pairing of participants in a large enough population. The good news is that WebRTC is perfectly straightforward if all you want to do is to connect to a server on the open internet.
- JoeOfTexas 5y agoNot sure how far along you are, but I could help you build the game if you are willing to try making it for acos.games. I built a simulator that can help speed up development which is done in React and NodeJS.
- sjrd 5y agoThank you for the suggestion. However I am close to finishing all the game mechanics, just on a single computer (the game has no secret knowledge so it playable on a single computer or, at worst, via screen sharing). Also I'm implementing it in Scala.js with Indigo [1], and part of the reason for the project is to have an excuse to learn Indigo, so i wouldn't change the technical stack. Thank you, though. It seems like a nice platform! [1] https://indigoengine.io/ https://indigoengine.io/
- JoeOfTexas 5y agoI think it could be made compatible. Will look into indigo engine, didn't know about it until now. Thanks and good luck!
- d0m3 5y agoInitially I thought I would be able to do it with webRTC but it turns out you still need some kind of specific server to connect clients. Instead I cheated a little bit and used a messaging service https://ably.com/ https://ably.com/. It was easy to setup and use, and their free plan is generous. Another thing I didn't achieve is to find a RNG I could configure with a seed, so amongst my client I have a special one, the "host" who is drawing the cards, etc. Overall it's been working really well. There is one thing that is particularly difficult without a server, that is debugging. Especially if using a mobile phone, you're in the dark when a bug happens. And with Ably and the free tier, you have to be connect in debug mode beforehand to see the logs, very unpractical. Good luck with your game!