boardgame.io: Insufficient documentation/guide on multiplayer
The Multiplayer guide mentions that
All you need to do is add multiplayer: true to your client config object […] You can open multiple browser tabs and you will find that the game board is synced in realtime across all of them
Apparently, that’s not all that is needed. There’s some magic server code that needs to be written.
Furthermore, its not specified where exactly the code snippet with server.run(8000); is supposed to be put and how it can be executed. The same about the mention of Koa app.
I looked at the examples; multiple games and single/multi player modes are baked in a single app. Inferring the relevant parts from examples, to make just a multiplayer game for example, is difficult. Add to that the Koa and webpack config complexity that is in the examples but nowhere in the guide or documentation.
If the user is expected to already know certain things beforehand (obvious one being React.js) that may not be very obvious, list of such things should be documented.
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 32 (17 by maintainers)
I’ve added a lot more detail in https://github.com/google/boardgame.io/commit/477aaf3a3dc97de361c2b2b5785b000562d55b58 (you can view them on the docs here). Let me know if these steps work for you!
The documentation looks a lot better now. Thanks for bringing this to my attention.
@viranch There are two gitter rooms, discussion takes place in the General one.
@Felizardo correct. I’m now running the server using
./node_modules/babel-cli/bin/babel-node.js.My point here is, the documentation should mention all of these caveats, if not specify how to get it working. Especially the part that says “All you need to do is add multiplayer: true to your client config object” - that’s clearly not the case, and there’s significant amount of server setup that’s required before multiplayer can just work.
So those 4 lines of code goes in a separate
server.jsfile? Its not really clear in the documentation, nor is how to run it.I tried
node server.jsbut got the following error:So clearly, there’s a lot more that the documentation should be specifying, for a beginner who has just finished the tutorial page and wanting to extend the game.
The example server code (4 lines or so) shown in the documentation should work as is.
That’s all you will need to set up a socket server to handle multiplayer. All the other stuff that you’re claiming is necessary is actually not. Sorry if the examples are confusing you.
Everything beyond that is up to individual developers. Some may choose to bundle their apps using Webpack. Others may not. Some may choose to server the web app from the same server. Others may not.
Documenting how to use React or Webpack is beyond scope.
Maybe I’ll add some steps on how to use
create-react-app ejector something like that.