About 8 months ago, I asked this question, and received a lot of valuable information from the community.
I have switched to nodejs
, since then, and am finishing up my game. I am deeply concerned about networking issues pertaining to the usage of WebSocket data being sent through my current architecture; especially since my game uses an authoritarian server, and doesn't utilize peer to peer.
My game is a Diablo 2 inspired action RPG. As we know, for action RPGs, players utilize a lot of skills, and if games are instanced based, all players in the game need to be notified.
I am worried about scalability. Here is an example:
Shooting a fireball has a 0.5 second cool-down. This is how the data is sent:
- Client [Skill id, Skill rotation] -> Server
- Server [Checks cooldown, notify's players skill is being used]
- Client [If fireball hits monster, send attack signal] -> Server
- Server [Checks cooldown, player's range to mob, calculates damage, etc & spits out damage numbers to all players]
All this happens in less than 1 second. The WebSocket server is not even sending out the Monster AI update packets to do damage to the player, nor the monster's fireballs. So now, basically double the amount of data is being sent through the WebSocket and to all player's in a game. It gets worse; imagine if 20 players are online attacking monsters. My nodejs
server will be on fire.
This method is not even 100% cheat proof, as I'm waiting for the fireball to hit the monster on the client-side to send the attack signal, instead of doing all that on the server. The problem is, I would have to be running a physics engine on the server, which would bog down nodejs
's event loop even more. I'm using the P2 Physics engine from Phaser, and not simple AABB; otherwise, I could just check for collisions server-side.
To close, when a player moves around the map, the server notifys everyone else in the same game. The same goes for when a player drops an item, or when loot is generated from a monster. I just feel like I'm clogging my WebSocket server up, and am doing something wrong with all this data being sent across the pipe.
So with all this said,
Am I worrying too much about the amount of data being sent across WebSockets?
Is this data being sent normal for a games that utilizes an authoritarian server?
Would a Redis Pub Sub system be an ideal solution to my problems?