I'm in the process of making a physics intensive multiplayer game. Naturally I use a UDP to transfer packets regarding rigidbodies between client and an authoritative server.

However non-essential packets I'd prefer to use a more reliable connection like WebSockets. This would be for things like voice chat, text chat, scoreboard, etc. It also seems the be a nice approach to checking if the client is still connected and if not, stop sending it UDP packets.

I'm actually unable to find use cases of this dual connection approach online and I was wondering how this is typically handled in similar games. Is it very far fetched or unconventional?

Another question would be how far do I take relying on the WebSocket connection? Lets say for managing remaining bullets in a guns magazine, would it be better over UDP or WebSocket?

I feel like WebSockets would be best in this case because if the bullet was successfully spawned and the server needs to remove a bullet from the client's gun's magazine, if that packet doesn't arrive at the client, then they shot a free bullet...

The UDP equivalent for this scenario would be to always send the client's magazine state as packets and the client just updates it's magazine whenever the packets get to them. My concern here is overloading the network traffic data that might not have even changed...

  • \$\begingroup\$ Did you try implementing your solution? Did it work? If it ran into a problem, what specific problem can we help you solve? If it works with no problems, then what does it matter whether it's a "typical" solution or not? \$\endgroup\$ – DMGregory Oct 23 '19 at 19:30
  • \$\begingroup\$ Haven't had issues implementing the solution. So I guess I don't have any problems, I've just realized that there are other ways of doing non-essential network traffic and that I might be over engineering my netcode infrastructure. \$\endgroup\$ – Fanus du Toit Oct 24 '19 at 14:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.