views:

51

answers:

2

I'm fairly new to multiplayer games. I have made a few for my own fun, but nothing profound.

Anyway, I want to make a game that is very cross-platform. The clients would be connected with their facebook accounts on the devices I release the game for (most likely computers (via flash), iPhone, and android). I am a solo developer on a shoestring budget (actually more like no budget). So, I want to make the game with a peer-to-peer connection. I would like to avoid using a client/server setup because of the cost to maintain a server. The problem I am running into is there is no way to connect peers over the internet, and the game is not meant to be played over a local wifi.

So, I have an idea. Can I use facebook's built in xmpp chat to send the game's multiplayer communication over the internet? I have head of xmpp being used for multiplayer games before. Does anyone have any other ideas? I understand that xmpp can be connected peer-to-peer, but can it be done over the internet somehow. I don't want the users to have to mess with router settings to play.

Thanks for your help!

A: 

The main problem in P2P systems are NATs and firewalls. Firewalls can be locally opened, NATs cannot in 99% of the cases. In the IPv6 world there will be no NATs, so P2P will be free for all.

Now you want to use Facebook's XMPP APIs for P2P multiplayer. Well... Facebook's XMPP is practically client/server because of the above reason. All Facebook's APIs do is to hide the transport layer to applications, meaning that you can send messages to "another user" while they actually transit through Facebook server. Skype is another example of P2P+server environment. If two users stand behind a NAT, it automatically uses a proxy server.

This is mostly the same with FB's XMPP, so you can go with that, unless your facebook users will see lots of strange messages in their chat window :)

djechelon
Grr. I was afraid of that. Is there a way to grab the messages before they get to the chat window. Probably not. Do you have any ideas on how to make peer-to-peer communication over the internet. I wanted to use facebook's chat server so that it would be their bandwidth that is getting used :P I read somewhere that you can use a server to connect your users and the game can be peer-to-peer after that. Of course, I have no idea how to do that. Thanks for your quick answer!
Lance
Sorry, I don't know too. You might try to experiment by yourself, mabye chat messages have a special format which is filtered. XMPP is a protocol, and doesn't do only chat. I'm not expert in that. I caught your NATting problem and answered to you from that point of view. But I'm no expert in Facebook APIs
djechelon
Okay, thank you. I just realized I have another problem... The game needs to be able to connect more than two people at a time.
Lance
A: 

Hi Lance,

I think you cannot build a multi-player game just by using facebook jabber servers. You will need to have a custom jabber component sitting at your own server to enforce your game business logic on the xmpp packets transferred between the game users.

This will (probably) involve writing custom Jabber Component Protocol XEP-0114 and Bosh Connection Manager component at your end. If you are looking to use PHP for developing your application you can have a look at Jaxl library (XMPP component and client library in PHP)

Abhinav Singh
Okay, thank you. I think I have decided to drop the idea of using xmpp for syncing the game (at least for peer-to-peer). Wishful thinking, but I don't think I could pull it off.
Lance
I think I am going to try and build a simple matchmaking server that uses a very small amount of bandwidth (at least, compared to a full-on client/server setup). One of the users will be a super peer or essentially a server. I'm going to take a look at NAT punch-through to see if I can introduce peers and let them take over afterwords (eliminating the need for a full-on dedicated server).
Lance