I've created a little game on Android. Now, I want to add a multiplayer mode which works with bluetooth or WiFi, so you can play together with other "smartphones" in your neighborhood . Which is the best way to offer a fast, good working mulitplayer mode that supports so many devices as possible? I heard about Alljoyn, but Im not quite sure if it fits my needs. Which way do you recommend?

regards Lisa


I would consider the requirements of your multiplayer experience. For a quick two week prototype I put together a couple months ago, I was on the ropes about whether or not to support TCP/WiFi connectivity between devices, or simply go with bluetooth. I chose to go with bluetooth due to the reliability of it in comparison with the local network I was dealing with, and the simple data format I was sending (XML). I wrote the bluetooth connectivity using the native android SDK, and was able to get it up and running within a day or two.

Additionally, consider whether or not you will be hosting the game externally, or requiring one of the devices to act as a host. If you plan on having more than a couple of devices connected at once, you may want to consider an external service (or at least extra device) dedicated to managing connections and processing requests.

edit also, bluetooth has very limited physical range, thus that may eliminate it as an option immediately.

  • \$\begingroup\$ hmm, are there often reliability problems in Wifi connections (is it a serious problem ? Because bluetooth strains much more the engegy resources than Wifi )? PS: native Android SDK means proberbly the SDK not the NDK, right? \$\endgroup\$ – Lisa Vey Apr 7 '13 at 19:32
  • \$\begingroup\$ You will encounter more reliability issues with wifi and tcp than you will with bluetooth, but thats just because you are using a network controlled by other devices, and sharing bandwidth. In the right situation, too many people downloading on the same LAN can cause for less than spectacular performance. Yes I meant the SDK, as opposed to using a third party library. \$\endgroup\$ – Evan Apr 7 '13 at 23:40
  • \$\begingroup\$ Ok , just an other last question: Whats about security ? Do I have to use encoding/authentication to prevent security leaks on the user's phone? \$\endgroup\$ – Lisa Vey Apr 10 '13 at 14:27
  • \$\begingroup\$ Ultimately, the data will be transmitted using an unencrypted protocol whether you use TCP or bluetooth. If you would like encrypted data transfers across public domain protocols like this, then you would have to encrypt the data yourself at the application layer before it is wrapped for transmission. \$\endgroup\$ – Evan Apr 10 '13 at 14:30
  • \$\begingroup\$ But do you think it is necessary to encrypt data or to use secure communication for multiplayer-games at all? \$\endgroup\$ – Lisa Vey Apr 10 '13 at 18:57

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.