Go Back   Zuneboards > Zune Discussions > Zune Games and Applications > Development Discussions

Development Discussions All developers who are coding games may stop by here for any help, suggestions, and everything development related.

Reply
 
LinkBack Thread Tools
Old 05-09-2008, 02:38 PM   #1 (permalink)
Squirt
 
Join Date: May 2008
Posts: 12
ionman is on a distinguished road
Default Zune Multiplayer Stuff

Ok, so I am definitely on board with games for Zune and hoping this thing really takes off.

The killer feature will definitely be multiplayer here. I really want to develop some multiplayer apps to carry the Social to an all new level.

The only thing is, all of the current multiplayer code is for Windows and Xbox. Does anyone have any pointers as to where I could start to see how multiplayer works on the Zunes?

Working sample code would be awesome if there is any out there.

Thanks,

- ionman



ionman is offline   Reply With Quote

Advertisement [Remove Advertisement]
Old 05-09-2008, 02:42 PM   #2 (permalink)
Experienced Zuner
 
collver's Avatar
 
Join Date: Sep 2007
Location: some where left of the right
Posts: 121
collver is on a distinguished road
Send a message via MSN to collver
Default

is there nothing in the documentation as to how you would take advantage of the wireless in game dev?
__________________
Noob Patrol : Locked and Loaded




collver is offline   Reply With Quote
Old 05-10-2008, 04:05 AM   #3 (permalink)
Squirt
 
Join Date: May 2008
Posts: 12
ionman is on a distinguished road
Default

There really isn't. I only found one page of stuff on the Zune in the MSDN docs that come with the new version. All of the multiplayer docs are currently for Xbox and PC, which include stuff that the Zune doesn't have, I am pretty sure.



ionman is offline   Reply With Quote
Old 05-10-2008, 07:56 AM   #4 (permalink)
Administrator
Ultimate Zuner
 
Join Date: Jul 2006
Location: Fullerton, CA
Posts: 5,893
lpxxfaintxx is a name known to alllpxxfaintxx is a name known to alllpxxfaintxx is a name known to alllpxxfaintxx is a name known to all
Default

Doesn't seem like anyone from anywhere knows yet. Perhaps Microsoft will release the info soon.
__________________




lpxxfaintxx is offline   Reply With Quote
Old 05-10-2008, 09:30 AM   #5 (permalink)
Experienced Zuner
 
Join Date: Feb 2008
Posts: 172
Nathaniel is an unknown quantity at this point
Default

Maybe in a couple weeks



Nathaniel is offline   Reply With Quote
Old 05-10-2008, 06:48 PM   #6 (permalink)
Where!
Retired Staff
Jr. Member
 
Bman22's Avatar
 
Join Date: Oct 2007
Location: Albuquerque, NM
Posts: 358
Bman22 is on a distinguished road
Send a message via Yahoo to Bman22
Default

i don't believe that the networking stuff was added into the CTP version. I think we might have to wait until the next release
__________________

thanks to stkr for the sig







Bman22 is offline   Reply With Quote
Old 05-11-2008, 01:54 PM   #7 (permalink)
Squirt
 
Join Date: May 2008
Posts: 17
Adrian Vinca is on a distinguished road
Default

I've started writing a small multiplayer game and I've managed to get 2 Zunes connecting through XNA. Actually it's quite easy using the XNA, I used System Link as the type of connection.

It's quite unreliable at this point (e.g. it crashes many times when trying to join, in some cases I have to restart the game on both zunes to make it work). I don't know if that's because I'm doing something wrong or if there are some issues in the CTP.



Adrian Vinca is offline   Reply With Quote
Old 05-11-2008, 05:53 PM   #8 (permalink)
Squirt
 
Join Date: May 2008
Posts: 12
ionman is on a distinguished road
Default

Would you mind sharing the source code that connects the two devices, or explaining how you did it? Thanks!



ionman is offline   Reply With Quote
Old 05-12-2008, 02:18 AM   #9 (permalink)
Squirt
 
Join Date: May 2008
Posts: 17
Adrian Vinca is on a distinguished road
Default

Here it is.

This is my first attempt to write any networking code using XNA so please take it with a grain of salt. My code is quite unreliable at this point (e.g. connect than disconnect than try to connect again throws exception - the only solution I found so far is to restart both zunes). But, if the stars are properly aligned, it will get the 2 zunes connected. If they don't connect, restart both zunes and try again.

I don't have any code to send any data between the 2 zunes.

Instructions:
- Deploy the code on both zunes (you need to make the Zune active in the Device center).
- Launch the application on both zune
- 1st zune (host): Press Up on DPad so that it hosts the game. The background will turn blue and the Zune will start hosting a game
- 2nd zune (client): Press Down on DPad so that it tries to join an existing game. The background will turn red and the Zune will stat looking for a game. If it finds one, it will try to connect to the first one it finds.

If everything worked fine, the 1st zune should say "Player joined".

http://cid-a912b1c0a524f973.skydrive.../TicTacToe.zip

Hope this helps! I can't wait to play multiplayer games on the zune!
Adrian



Adrian Vinca is offline   Reply With Quote
Old 05-12-2008, 05:05 AM   #10 (permalink)
Squirt
 
Join Date: May 2008
Posts: 12
ionman is on a distinguished road
Default

Sweet. Thank you so much. I will try it out later today or tomorrow and see if I get anywhere with it.

- ionman



ionman is offline   Reply With Quote
Old 05-12-2008, 12:34 PM   #11 (permalink)
Experienced Zuner
 
Join Date: Nov 2007
Posts: 133
MarcusMaximus is on a distinguished road
Default

wow! nice. I've been searching everywhere to try to figure out how to do this.



MarcusMaximus is offline   Reply With Quote
Old 05-13-2008, 02:26 PM   #12 (permalink)
Zuner
 
Join Date: May 2008
Posts: 64
amoo3 is on a distinguished road
Default

Awesome. I've been using this as my base code for multiplay; Man, this stuff is confusing! From my understanding, there is no way for the server to simply say
player2.get(xPosition);
//based on xPosition, modify game's screen
drawScreen(this, player2)

Man, that would be nice... Someone prove me wrong!




amoo3 is offline   Reply With Quote
Old 05-13-2008, 02:56 PM   #13 (permalink)
Experienced Zuner
 
Join Date: Nov 2007
Posts: 133
MarcusMaximus is on a distinguished road
Default

Umm you can't do that but I'm pretty sure you can have player2 send a packet with their x position and have player1 receive it and then use it.



MarcusMaximus is offline   Reply With Quote
Old 05-13-2008, 03:04 PM   #14 (permalink)
Zuner
 
Join Date: May 2008
Posts: 64
amoo3 is on a distinguished road
Default

I've been trying to do that, but apparently the NetworkGamer class, unlike the LocalNetworkGamer class, does not have a sendData() method.




amoo3 is offline   Reply With Quote
Old 05-13-2008, 03:18 PM   #15 (permalink)
Squirt
 
Join Date: May 2008
Posts: 12
ionman is on a distinguished road
Default

Quote:
Originally Posted by amoo3 View Post
I've been trying to do that, but apparently the NetworkGamer class, unlike the LocalNetworkGamer class, does not have a sendData() method.
I think I have almost completed some code that will send data back and forth. I will post as soon as I have a working example.

Thanks!

- ionman



ionman is offline   Reply With Quote
Old 05-13-2008, 04:14 PM   #16 (permalink)
Zuner
 
Join Date: May 2008
Posts: 64
amoo3 is on a distinguished road
Default

Awesome, that would great. A friend of mine made a sweet game that I was planning on adding network support and porting the Zune. It'd be a huge help to have some real code to go off of. Microsoft's documentation really sucks.




amoo3 is offline   Reply With Quote
Old 05-13-2008, 05:57 PM   #17 (permalink)
Squirt
 
Join Date: May 2008
Posts: 12
ionman is on a distinguished road
Default

Ok. I got it!

Download the Sample

Here is a working example that is pretty simple but does the job. Just launch the app, and if you are lucky enough to have more than one Zune to play with, launch it on the other one a few seconds later, and they will automatically connect.

Pressing the D-Pad will send a string with the Gamertag of the user that clicked the pad, and the direction they clicked. Just a simple illustration; you would want to do it a bit differently in a game.

The code is based primarily off of Adrian Vinca's example posted above, the tank example on the XNA site, some coffee and some of my gray matter.

Please feel free to look through this code, adapt it to your needs, use it in your games etc. Also, if someone finds mistakes or better ways of doing things, please let me know!

Enjoy!

- ionman



ionman is offline   Reply With Quote
Old 05-13-2008, 06:00 PM   #18 (permalink)
Expert Zuner
 
Soccerfreak24's Avatar
 
Join Date: Nov 2007
Posts: 3,042
Soccerfreak24 is just really niceSoccerfreak24 is just really niceSoccerfreak24 is just really nice
Default

Quote:
Originally Posted by ionman View Post
Ok. I got it!

Download the Sample

Here is a working example that is pretty simple but does the job. Just launch the app, and if you are lucky enough to have more than one Zune to play with, launch it on the other one a few seconds later, and they will automatically connect.

Pressing the D-Pad will send a string with the Gamertag of the user that clicked the pad, and the direction they clicked. Just a simple illustration; you would want to do it a bit differently in a game.

The code is based primarily off of Adrian Vinca's example posted above, the tank example on the XNA site, some coffee and some of my gray matter.

Please feel free to look through this code, adapt it to your needs, use it in your games etc. Also, if someone finds mistakes or better ways of doing things, please let me know!

Enjoy!

- ionman
Good work! +rep.
__________________





Soccerfreak24 is offline   Reply With Quote
Old 05-13-2008, 06:10 PM   #19 (permalink)
Experienced Zuner
 
Khao's Avatar
 
Join Date: May 2008
Location: Qu�bec, Canada!
Posts: 104
Khao is on a distinguished road
Default

AWESOME MAN! I love you! I will try to port it to pong as soon as I can (exams suck) +rep




Khao is offline   Reply With Quote
Old 05-13-2008, 06:29 PM   #20 (permalink)
Squirt
 
Join Date: May 2008
Posts: 12
ionman is on a distinguished road
Default

Happy to help!

As a side note, that code is configured to allow up to 8 Zunes to connect. I have tested it with up to 3 at a time and it worked just fine.

- ionman



ionman is offline   Reply With Quote
Reply

Bookmarks

Thread Tools