0
\$\begingroup\$

I am working on a FPS game for Android and I want to make a support for local multiplayer with no additional devices or server required. One of the player's devices would serve as a server, getting and distributing all the messages, OR every device broadcasts messages to everyone inside the group. First I was thinking bluetooth or wifi direct, but I am running into many problems with both. The plan was to support up to 10 players, so I am not sure bluetooth can handle that (broadcast messages and similar). If it is possible, let me know. Also, I heard of an option to make a wifi hotspot on one device, and connect all other devices to it that way, but I have no idea how that would work. Does anyone have any real experience with this, or any advice on how to implement it? Thanks in advance.

PS. yes, I've ran through everything on android developers site, but their wifi direct example is kinda bad and only supports 1-way data transfer.

\$\endgroup\$
0
\$\begingroup\$

Wifi communication via sockets would be the way to go. You will need to implement the higher-level stuff yourself, such that you won't have network discovery out of the box.

\$\endgroup\$
  • \$\begingroup\$ Thanks for the response. I do know how to do stuff on socket level, but what I need is just getting devices in my proximity and getting their IP addresses or whatever needed to initiate socket connections. With wifi direct I had this problem that I couldn't really get IP addresses of peers connecting to group owner, only their MAC addresses. Found a couple of answers here regarding easy MAC->IP mapping but none of them worked for me, so I gave up wifi direct soon afterwards. \$\endgroup\$ – Milos Lajic Jan 20 '14 at 13:26
  • \$\begingroup\$ Each device hosting a server would listen for events. A client wanting to know which servers are available would send its IP address and basic info through the Broadcast Address, and then each potential server would send a message to the client with their IP and any additional server info (player count, ping, etc). \$\endgroup\$ – Thebluefish Jan 20 '14 at 13:28
  • \$\begingroup\$ @Thebluefish this should be the in answer... \$\endgroup\$ – FxIII Jan 20 '14 at 14:46
  • \$\begingroup\$ You should look at Kryonet. \$\endgroup\$ – nathan Jan 20 '14 at 16:47
  • \$\begingroup\$ Thanks for comments. I will look more into it, also I googled Kryonet and will check that out too. Gonna inform you if I make some progress. Still open for new ideas, if none come, I will mark this as answer. \$\endgroup\$ – Milos Lajic Jan 20 '14 at 18:22

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.