Skip to content
This repository has been archived by the owner on Apr 12, 2021. It is now read-only.

Online multiplayer support #36

Open
PlytonRexus opened this issue Aug 12, 2020 · 5 comments
Open

Online multiplayer support #36

PlytonRexus opened this issue Aug 12, 2020 · 5 comments

Comments

@PlytonRexus
Copy link

Using socket.io and node.js, it would be possible to create an online multiplayer version of this game.
I agree this might make things unnecessarily complicated for the beauty of chain reaction is in its simplicity. But consider the improved utility.
I had difficulty in sharing my mouse while playing. Might others have had similar problems?

If not over the internet, then a local setup can be created to play over LAN.

@geetp98
Copy link

geetp98 commented Oct 4, 2020

So what could be the plan? MySQL, simple APIs and FCM + background jobs to clean up abandoned games? @PlytonRexus

@PlytonRexus
Copy link
Author

PlytonRexus commented Oct 5, 2020

So what could be the plan? MySQL, simple APIs and FCM + background jobs to clean up abandoned games?

@geetp98 Let me just confirm this FCM is Firebase Cloud Messaging? I guess that's a fair model. Like I mentioned in the OP, a more barebones approach could be using sockets with/without a database. By the way, I recently created a version.

But your approach could be cleaner!

@geetp98
Copy link

geetp98 commented Oct 5, 2020

Yes, FCM = firebase cloud messaging. With a sockets model, we could run into trouble of one of the players disconnecting and need of creating a robust model to handle that. With fcm, it should be easy considering if a message is not sent successfully, the player has disconnected. We can let all the players know, and the game can continue. Although as of now, I haven't dived into game logic properly, but we would potentially need a nosql to store the game state as well.

@PlytonRexus
Copy link
Author

@geetp98 I guess that's true about disconnecting. However, even FCM, uses a socket-based model. That is, if instead of socket IDs, we use Usernames/UIDs to track players, recreating a game state for that username should be easy enough.

For storing a game state, yes, we will need a database. I was thinking we could just make a simple map and store states corresponding to rooms in it. Of course, this will erase data once the server is turned off and will, I guess, keep a child process running indefinitely. The database solution is more elegant.

May I ask, are you making a version?

@PlytonRexus
Copy link
Author

@geetp98
Oh, I didn't see a game state sort of thing in this version of Chain Reaction. So, making a multiplayer version is slightly difficult with this one.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants