networked multi-player games (with peer discovery)

View previous topic View next topic Go down

networked multi-player games (with peer discovery)

Post  geekschmoe on Tue Jul 14, 2009 5:58 pm

Is anyone using peer-to-peer networking with a multi-player SIO2 game? Can you recommend any framework or anything? I don't think sio2 addresses this issue (although maybe it should).

I saw the socket wrapper stuff but I doubt you want your buddy to type in your internet protocol address every time you want to play. Any help is appreciated.

geekschmoe

Posts : 14
Join date : 2009-06-22

View user profile

Back to top Go down

Re: networked multi-player games (with peer discovery)

Post  sio2interactive on Tue Jul 14, 2009 6:06 pm

I saw the socket wrapper stuff but I doubt you want your buddy to type in your internet protocol address every time you want to play. Any help is appreciated.

>> SIO2socket is perfect for this... you just have to wrap an interface in order to connect... any other library will give you the same access to the API.

_________________
SIO2 Interactive
Free Open Source 3D Game Engine for iPhone and iPod Touch
http://sio2interactive.com
avatar
sio2interactive

Posts : 1526
Join date : 2008-08-26
Age : 38
Location : Shanghai

View user profile http://sio2interactive.com

Back to top Go down

Re: networked multi-player games (with peer discovery)

Post  geekschmoe on Tue Jul 14, 2009 7:00 pm

I'm totally missing something.

The example code in tut 13 has a hard-coded ip address endpoint. It looks like just a straight socket API. Nothing for handling the discovery of other devices. I'm talking about discovering other instances of the game that is running on other devices via the local WLAN.

Consider this:

1. we're standing next to each other at my house and both our phones have the same multi-player game installed
2. we both open the game at the same time and start a new multi-player game
3. the game (on both devices) looks for local peers
4. whichever game instance finds the other one first becomes the host (server) and the other is the client
5. if a 3rd person opens their phone during this initialization period, then the host (server) node has already been designated and it falls in line as another client
6. During game play all the clients broadcast their events to the server (including the server broadcasting back to itself)
7. etc etc..

The important part here is the boilerplate discovery protocol stuff. This is at a much higher level than just straight socket programming isn't it? Does SIO2 provide this? Maybe this code to implement the aforementioned steps is just so trivial its not worth including in SIO2? Like I said, I'm missing something and I probably just need a dope slap.

geekschmoe

Posts : 14
Join date : 2009-06-22

View user profile

Back to top Go down

Re: networked multi-player games (with peer discovery)

Post  sio2interactive on Tue Jul 14, 2009 7:08 pm

Dude the discovery is like SOOOO easy... simply make the client or the server ping the other devices within your gateway parse the command line output (or simply | grep) and list the IP....

Or simply try to connect using socket to all the devices at a specific port running the game... the whole process to scan the gateway is a few sec.

For internet play... you have to enter manually the IP but even then that's easy...

_________________
SIO2 Interactive
Free Open Source 3D Game Engine for iPhone and iPod Touch
http://sio2interactive.com
avatar
sio2interactive

Posts : 1526
Join date : 2008-08-26
Age : 38
Location : Shanghai

View user profile http://sio2interactive.com

Back to top Go down

Re: networked multi-player games (with peer discovery)

Post  geekschmoe on Tue Jul 14, 2009 7:56 pm

Thanks for the reply. I guess since everything else in sio2 is so nicely abstracted and high-level in sio2, I just figured that the network stuff would be too. Honestly, whatever multi-player networking code I write will function almost identical to others' network code, which to me seems like a giant opportunity for abstraction but I digress.

Is the only advantage to using sio2 sockets over the CFNetwork or C api directly is for portability purposes?

whats this grep output? are you implying that you can do system calls on the iphone/ipod to command line network utilities? or?

geekschmoe

Posts : 14
Join date : 2009-06-22

View user profile

Back to top Go down

Re: networked multi-player games (with peer discovery)

Post  sio2interactive on Tue Jul 14, 2009 8:46 pm

Honestly me I would go with an SIO2thread that loop using an SIO2socket and try to connect to the other devices contained in your gateway... every successful discovery list the IP address and then I would use that address with some SIO2widget & SIO2font.

The whole code should be pretty small...

Cheers,

_________________
SIO2 Interactive
Free Open Source 3D Game Engine for iPhone and iPod Touch
http://sio2interactive.com
avatar
sio2interactive

Posts : 1526
Join date : 2008-08-26
Age : 38
Location : Shanghai

View user profile http://sio2interactive.com

Back to top Go down

Re: networked multi-player games (with peer discovery)

Post  Sponsored content


Sponsored content


Back to top Go down

View previous topic View next topic Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum