I have a nginx load balancer with 4 nodejs instances behind it, and one Redis server to share certain memory.
My game is an instance game, similar to Diablo 2. Players can create "games" if you will and other players can join them.
The game data is stored locally on the players node of which who created the game (I was going to store the game data in Redis, but have the following dilemma):
When a game is made from a user that is on node instance #1; and a user that is on node instance #2 wants to join that game. This is where I get confused. I want the players to communicate to each other locally (but they cannot because they are not on the same instance). How exactly can I counter this?
These are some solutions I found:
Use
ZeroMQorNanomsgto send the data locally between processesUse the native
nodejsIPCprotocol to send the data locally between processes
Now, this worries me more. Because I have a feeling I am doing it wrong. When a player is moving around in the map, he needs to send data to all other 5 players in that game. (simple positional packet). This now has to be sent through ZeroMQ (pub subbed) -- or through local sockets (IPC). Isn't this going to be a lot of overhead? Are there other ways to scale an instanced based game with multiple node instances? Or maybe, this is the right way, and I'm underestimating how fast local sockets are (or ZeroMQ's speed)?