GLBasic forum

Main forum => GLBasic - en => Topic started by: djtoon on 2011-Jun-14

Title: iphone game over wifi
Post by: djtoon on 2011-Jun-14
hi, i whant to make a game where people connect to a single phone, and all of them are on the same wifi connection.

can i do that ?

if yes, where sould i start whats the commands

thanks
dan
Title: Re: iphone game over wifi
Post by: Slydog on 2011-Jun-14
Well, trucidare created a bluetooth wrapper for the iPhone:
http://www.glbasic.com/forum/index.php?topic=4380.0 (http://www.glbasic.com/forum/index.php?topic=4380.0)

I don't know exactly how to do it via WiFi.
I think 'Game Kit' handles this:
http://developer.apple.com/library/ios/#documentation/NetworkingInternet/Conceptual/GameKit_Guide/Introduction/Introduction.html (http://developer.apple.com/library/ios/#documentation/NetworkingInternet/Conceptual/GameKit_Guide/Introduction/Introduction.html)

But if nobody created a wrapper yet, that may get difficult.
Title: Re: iphone game over wifi
Post by: Crivens on 2011-Jun-14
Yeah, I thought the latest version of Gamekit automatically chooses the communications method depending on what's available. So if wifi is good then go for that, otherwise fall back on Bluetooth etc. The BT wrapper was pretty good so would be excellent to have an updated version for this.

Cheers
Title: Re: iphone game over wifi
Post by: quangdx on 2011-Jun-14
A good place to start is the Networking for Cowards tutorials
http://www.glbasic.com/forum/index.php?topic=2775.0
Title: Re: iphone game over wifi
Post by: matchy on 2011-Jun-15
Bluetooth is peer-to-peer and it's not the same as WiFi. The glb networking is what has been used to create a server/client for any platform. So any platform device can connect to each other. No need for wrappers and GameCenter is another issue.
Title: Re: iphone game over wifi
Post by: mentalthink on 2011-Jun-15
Well I connect my Palm whit my iPhone via wifi, whitout problems, and to PC, only it´s make a Server and a client like this.

Server:
systempointer true
autopause flase

createhostgame(0)

While
..
...
wend

Client
systempointer true
Autopause false

Netjoingame("ip of the server machine // Local not Global (I don´t try this last yet)", here the number of the create Host Game, in this case 0)

while true
..
..
wend

And this is all.

Kinds Regards,
Iván J.

On the tutorial net for cowards, it´s explained very well.
Title: Re: iphone game over wifi
Post by: Moebius on 2011-Jun-16
You can get networking games to work without known IP addresses as well.  In IPv4 there are broadcast addresses - see wikipedia.  "255.255.255.255" sends a message to all devices in the local network, and can be used to search for other devices running your game.  You can then use the NET framework or whatever you want, having the IP addresses of other instances of your game.

Mr TAToad has posted code that could help you - http://www.glbasic.com/forum/index.php?topic=2760.msg20361#msg20361 (http://www.glbasic.com/forum/index.php?topic=2760.msg20361#msg20361)

EDIT:  It also seems "NETJOINGAME( "", 0 )" connects to a game started somewhere on the network as well (remembered reading something about this).