heroiclabs / nakama-js

JavaScript client for Nakama server written in TypeScript.
https://heroiclabs.com/docs/nakama/client-libraries/javascript/
Apache License 2.0
181 stars 54 forks source link

[Feature Request] Tutorial of Nakama-JS integration with Boardgame.io #36

Open crypto-rizzo opened 5 years ago

crypto-rizzo commented 5 years ago

As of now I think the introductory docs are a little sparse, especially for newer developers. I think it'd be great a way for the community to see first hand how Nakama would be implemented with another framework. I think BoardGame would be a good fit since its UI agnostic (among other things)

I'm actually trying to doing this myself but I just wanted to open up a dialogue here in case anyone had any advice or suggestions for getting started.

novabyte commented 5 years ago

Thanks @camus-code. This is a great idea but I'll see what I can do to assign an engineer to put an example together. What difficulty have you had so far with Boardgame.io?

crypto-rizzo commented 5 years ago

@novabyte Thanks for responding man! To be honest I find Boardgame.io rather straightforward. The problem I have, though, is figuring out how exactly to fit Nakama inside of it.

Basically, I have a simple multiplayer example built from the multiplayer docs. From what I understand, it's just using a simple Node.js server to host the game master. Is this where Nakama would come in?

novabyte commented 5 years ago

@camus-code Yep absolutely. Nakama takes the place of the server API which is here:

https://github.com/nicolodavis/boardgame.io/blob/master/src/server/api.js

It's changed a fair bit since I last looked but you can see the familiar create/join/leave/etc functions which Nakama also has. Now it looks like they maintain some state on the server now which I'd recommend our authoritative match handler to achieve if you want although I remember they also supported client relayed convergence of game state as well.

crypto-rizzo commented 5 years ago

@novabyte Ok sweet thanks so much for a link pointing me in the right direction. There's just a lot going on in both the codebases so it's a little difficult for me to parse through. I should have some free time this week so hopefully I'll be able to get something going in the meantime.

Just to be clear, I would basically try and replace the server API code with the code from the JS client guide? https://heroiclabs.com/docs/javascript-client-guide/

crypto-rizzo commented 5 years ago

Just keep me posted if you have any dialogue with your team about this issue @novabyte ! Thanks again for your interest in the idea

nicolodavis commented 5 years ago

Just chiming in: boardgame.io supports pluggable transport adapters. This is the current implementation that talks to the boardgame.io server component. Another adapter that talks to Nakama instead can be added (and I'm happy to bundle it in as an official integration if it works well).

novabyte commented 5 years ago

@nicolodavis That would be great to build an official adapter for Boardgame. I'll see if one of the client team can tackle it ahead of Christmas. 😄

crypto-rizzo commented 5 years ago

@novabyte Really glad this is coming together like this. Keep me updated on any developments or if you need an extra pair of hands for some of the code 👍

crypto-rizzo commented 5 years ago

@novabyte Hey man, just wanted to check in and see if there's been any progress made and see if I can assist in any way. I know this is a super busy time of the year, so no worries at all if not.

mofirouz commented 5 years ago

Hi @camus-code - no progress has been made on this yet. You'll see activity on this ticket as soon as we've had the chance to investigate further.