5

I want to develop an Android multiplayer real time game. But I'm still confuse what is the best way to do the communication. I found a few options:

  1. TCP
  2. UDP
  3. Ajax/Comet/Messaging services i.e. pubnub.com, beaconpush.com
  4. Push notification
  5. XMPP
  6. Android Cloud To Device Messaging
  7. The Pubsubhubub Protocol
  8. Smartfoxserver

I just wondering how the other realtime games did it? I would like to know the most common way of doing it with acceptable result.

I appreciate your thought. Thanks!

Denys Séguret
  • 372,613
  • 87
  • 782
  • 758
karl
  • 63
  • 1
  • 7
  • I'd use push notifications (take a look at MQTT)... however, most of those services use TCP. Maybe you have to read more to understand what those technologies are. – Cristian Dec 04 '10 at 13:42
  • Thanks Christian for the MQTT. Although I have experience in web development, but I'm new with real time development. – karl Dec 04 '10 at 15:44
  • The big multi-player games with which I am familiar are all using UDP for the bulk of the network code. Everquest, EQ2, WoW, Lord Of The Rings and Warhammer. Otherwise latency is too high. When it's necessary to send a lot of data and it's not time sensitive TCP is used. Think of the player vendors in everquest or the bank interface in WoW (I think...) – JimR Dec 04 '10 at 18:02
  • JimR, thanks for your comment. Appreciate it. I'm new in game development concept. This is certainly helpful. – karl Dec 05 '10 at 01:40

1 Answers1

2

You can generally get better performance for a specific goal by using UDP and handling more of the network issues yourself. TCP and fancier things built on top of it try to give you reliable, ordered communications with a sense of connected sessions, but their means of insuring reliability aren't necessarily going to be the ones that are most optimum for you. On the other hand, they are easier since they do more of the work for you.

Chris Stratton
  • 39,853
  • 6
  • 84
  • 117
  • Hi Chris, thanks for your reply. But I'm wondering how the other realtime games do it. Do they use UDP as well? – karl Dec 04 '10 at 15:40
  • In general, realtime games use UDP or TCP depending on their needs. A realtime strategy game, for example, might use TCP because those packets have to go through. But a realtime FPS might use UDP because a couple of dropped packets are ok. – Steve Blackwell Dec 04 '10 at 15:59
  • I see. Do I need a special software for the server to run UDP? Is there any third party who provide UDP service like pubnub.com. Do you think "push notification" can be used for real time game? – karl Dec 04 '10 at 16:04
  • You should probably start very small with a simple prototype and gain some experience before you make key design decisions for a large project. – Chris Stratton Dec 04 '10 at 16:30
  • Yes, currently I'm testing it with small prototype. I'm using the easiest one, push notification by beaconpush.com. But there was a delay in getting the response. That's why I want to know how other games done it. Is push notification is acceptable for realtime game? – karl Dec 04 '10 at 16:44
  • I would be surprised if a push notification was fast enough. But I think a mobile network might itself be slow at times... so it may depend on what you mean by "real time" – Chris Stratton Dec 04 '10 at 16:55
  • It's a simple 2D tank shooting game. Something like the old nintendo game. The game can be played by up to 4 players. Each player can see the oponent movements. – karl Dec 04 '10 at 17:04
  • But you have to figure out what kind of communication latency is acceptable – Chris Stratton Dec 04 '10 at 17:13
  • hmmmm.. I also don't know. Basically I want to follow other games. It doesn't need to be the fastest. Even though there are some latencies, I can live with it. I want to avoid a technique that's uncommon in real time game. If no one us using push notification, then I should avoid it also. – karl Dec 04 '10 at 17:29
  • I'm the author of beaconpush.com and yeah, sure, our solution or similar should work just fine if you use the WebSocket transport. As we offer an array of different transports for compatibility purposes, some are faster some are slower. WebSockets is by far the most performant. – cgbystrom Dec 04 '10 at 21:49
  • Chris, thanks for all of your valuable input. – karl Dec 05 '10 at 01:18
  • cgbystrom, do you mean the current android webkit support websockets? Can you show me the link on how to implement the websockets? Does iphone support websockets? – karl Dec 05 '10 at 01:20
  • user530438, unfortunately Android's browser does not yet support WebSockets. However, we do offer alternative transport methods that uses traditional long-poll. So yes, Beaconpush works on Android. iPhone on the other hand do support WebSockets in version 4.2. – cgbystrom Dec 10 '10 at 08:45