简体   繁体   中英

XNA : WP7 vs PC

I'm currently developing a turn by turn multi player game for a proof of concept. What I want is that a player from a WP7 can play against a PC player. I'm using the push notification to contact the phone, that's ok for this part.

But I'm hitting a wall when I want to contact the PC. I wanted to use the same approach, but the Push Notification Server Side Library is using the Windows.Phone DLL, which is unavailable on PC-XNA.

Any ideas of how I should proceed or suggestions?

Thanks for your time.

The Push Notification Service is intended for communication between a server and a Windows Phone 7 device, which is why there is no assembly available for you to use it from a desktop PC application. In order to add support for Phone to PC multiplayer gaming you will need to run your own server to handle the communications that both devices can contact and communicate through.

One thing you could look at is using Growl for Windows:
http://www.growlforwindows.com/gfw/developers.aspx

There's a C# API to respond to notifications, which you can think of as being similar to the push notifications on the phone. The server can then decide which notification system to use based on what kind of client it is. So using the native push notification if it's a phone, or using growl if windows (or mac if you end up making a mac client as well using something like monomac ;-) ). I've never used it myself, but it seems like the ideal solution.

I would follow this How-To to get push notifications working from server --> phone. That should not be all that difficult, and it sounds like you may already have that working.

What you need to do is setup a polling mechanism on the PC game in order to update the state. You could simulate push style notifications with some type of long-polling , since you're using .NET/XNA I presume you'd also be using WCF.

A combination of these two approaches should get all of your clients talking to the server, and the server correctly dishing out responses, either pushing them to WP7 and/or long-poll responses to the PC.

If you are ok with targeting only Win8; Win8 will support push notification service very much like the phone. This is a tutorial I've found: http://blog.jayway.com/2011/10/12/implementing-windows-8-push-notifications-an-example/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM