Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

I'm creating a game on wp7 and it will be an online game played between a max of 4 players. The game will be a turn based game. My question really is what is the best way to do this server wise? is WCF the way to go?

The following is information transferred to and from the server from each player.

  • Player Chat message
  • Chat message from other players.
  • Players points from game.
  • Picture sent to each player for start of game
share|improve this question

closed as not constructive by Oded, gnat, Jarrod Roberson, Walter, ChrisF May 17 '12 at 21:02

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.If this question can be reworded to fit the rules in the help center, please edit the question.

1  
I have no experience with WCF, but maybe it is overkill in your case. Plain old sockets or a remote method invocation should be enough for this. –  arnaud May 14 '12 at 11:32
1  
cheers for that @arnaud, I will look into sockets more. –  Gaz83 May 14 '12 at 11:40
add comment

3 Answers

I have had to implement a chat service in WCF.

The main problem in my eyes was that web services are based on the HTTP query model. That means a client sends a request to the server, the server handles the request and returns the results.

Communication is always coming from the client side, but never from the server side.

In a chat scenario, this implies that the clients constantly have to poll the server for new messages. Usually one would want the server to notify exactly those clients for which new messages should be distributed.

Constant polling from all clients would put the server under quite some stress.

So, in short, I would refrain from using web services to implement a chat.

share|improve this answer
1  
thanks for that, I will take your advice and from what arnaud said in his comments, sockets are a good place to start –  Gaz83 May 14 '12 at 11:38
4  
Check out duplex binding for WCF. That should make for callbacks rather than polling. –  Jesse C. Slicer May 14 '12 at 21:29
1  
@JesseC.Slicer Seems like I've missed this option back then. Do you know which protocol is used to send information back to the client? –  Raku May 15 '12 at 7:19
    
after reading around and playing with code it would seem Windows Phone does not support duplex binding :-( –  Gaz83 May 15 '12 at 13:07
add comment

WCF is definitely a good way to go. I'm currently on a project with a mobile component, which uses live, remote data. I'm using WCF and exposing a JSON endpoint, which works very nice.

Problem with WCF is that it might be just a bit to slow for a live game.

Try taking a look at RabbitMQ as well.

:)

share|improve this answer
    
looks interesting, cheers! –  Gaz83 May 15 '12 at 8:24
    
+1 for the message queue. It'll save quite some work and you don't have to implement the whole communication protocol by hand. –  Raku May 15 '12 at 9:28
add comment

SignalR is a .net library that can do what you want. It bills itself as an "Async library for .NET to help build real-time, multi-user interactive web applications." In fact, one of its most compelling demos is a chat site, which I believe is open source. You can find the source code for JabbR at GitHub.

Scott Hanselman wrote a blog post about SignalR that I feel wrapped up the important parts nicely.

share|improve this answer
    
Cheers for that I will take a look :-) –  Gaz83 May 15 '12 at 8:22
add comment

Not the answer you're looking for? Browse other questions tagged or ask your own question.