3
votes

I would like to develop a multiplayer game in which
1. There are n clients and one server
2. Client should be able to send messages to the server with or without response
3. Server should be able to send messages to clients with or without response

I feel that both TCP and UDP will be very slow. I came across ZeroMQ which seems to have less overhead and is faster than TCP and UDP. Is it advisable to use ZeroMQ here?? what are pros and cons?

1

1 Answers

4
votes

ZeroMq is probably a good fit for your needs. The target application being a game means you can sacrifice reliability for the sake of performance. Here's a few more reasons why:

  • ZeroMQ is not JMS- or MQ-based, so there's no centralized broker slowing things down.
  • Disconnects/reconnects are handled automatically by ZeroMQ library, saving you from writing code to handle peers dropping off and coming back online.
  • Messages are automatically queued in buffers store-and-forward fashion in the event the receiving peer is offline.
  • ZeroMq socket types (PUB, SUB, REQ, REP, PUSH, PULL), offer convenient methods by which to effortlessly enable common messaging paradigms in your application.
  • Synchronous and asynchronous messaging is handled with ease based on the requirements you listed, and you can find examples demonstrating nearly every socket combination in the examples directory.