none
What technologies to use for turn-based multiplayer app RRS feed

  • Question

  • Hi,

    I have a wpf .Net app (card game). It incorporates both a client and a service. It is 4 a player game. One client start the server. The 3 others connect join the 1st client's server and can start game afterwards. Note the game is TURN-BASED.


    Now, I want to rewrite the app for Windows8 and WP8 (cross-platform). I intend to make use of Azure to manage the server-side of things. As the clients won't be using, they will be connecting to Azure for server.

    Amongst various features, basic features would be:
    multiple clients (100s) to connect to server
    players can see who are online
    any group of 4 players to start a "game session"
    leaderboard


    I've done some very basic work with WCF and Azure to understand how to get a client use a service on the server.

    I can see how this can work for a few things:
    SQL database will provide backbone of all things that are happening on the server. WFC services will be mostly geared at reading/changing SQL database. Clients then simply change or interpret the SQL data accordingly.
    Hence:
    1) client can connect to WCF service to login/auth and get a cookie or future ID (at the same time, WCF stores data on SQL database for online users)
    2) client can use WCF service to get list of other players online
    3) client can use WCF service to make other SQL queries (add friends, remove friends)
    4) client can use WCF service to initiate a session "room" (SQL)
    5) client can use WCF service to view available session "rooms" (SQL) and join the room

    However, once the game is ready to begin (through client using WCF service to check their status as ready), I am not clear on how to get the game going. Presumably, when a client needs to interact can still use WCF service to update SQL entries to play/record their turn. However, what happens next? How do other clients receive the update that the other client played his turn? How does the server send this info out to the relevant clients?

    I am more concerned about the server-side of things.

    I know there are technologies such as push notifications, but I am not sure where to head from here, how to implement, where to begin to understand incorporating push notification.

    Any advice/resource/link is much appreciated.

    Thank you.

    • Edited by masterAmeel Thursday, November 8, 2012 8:20 AM
    Thursday, November 8, 2012 8:18 AM

Answers

  • Hi, since it is a multiplayer game, consider to use socket. Socket allows bi-directional communication, which means server can call client whenever necessary. If you want to use WCF, you can use NetTcpBinding, however that only stand by Windows 8 environment, not Windows Phone 8. So it would be better if you use socket directly. The StreamSocket class is available on both Windows 8 and Windows Phone 8. You can refer to http://msdn.microsoft.com/en-us/library/windows/apps/hh452996.aspx for more information.

    Best Regards

    • Marked as answer by masterAmeel Saturday, November 10, 2012 4:21 AM
    Friday, November 9, 2012 8:37 AM
    Moderator

All replies

  • Hi, since it is a multiplayer game, consider to use socket. Socket allows bi-directional communication, which means server can call client whenever necessary. If you want to use WCF, you can use NetTcpBinding, however that only stand by Windows 8 environment, not Windows Phone 8. So it would be better if you use socket directly. The StreamSocket class is available on both Windows 8 and Windows Phone 8. You can refer to http://msdn.microsoft.com/en-us/library/windows/apps/hh452996.aspx for more information.

    Best Regards

    • Marked as answer by masterAmeel Saturday, November 10, 2012 4:21 AM
    Friday, November 9, 2012 8:37 AM
    Moderator
  • Thanks Johnson, exactly my thoughts.

    Is there any hard limit on the number of clients that connect to a server on cloud?


    • Edited by masterAmeel Friday, November 9, 2012 11:43 AM
    Friday, November 9, 2012 11:43 AM
  • Hi, There's no hard limits.

    Best Regards


    Please mark the replies as answers if they help or unmark if not. If you have any feedback about my replies, please contact msdnmg@microsoft.com Microsoft One Code Framework

    Wednesday, November 28, 2012 9:53 AM
    Moderator
  • Hi, 

    have a look at http://signalr.net/  . It has a lot of support for stuff like groups etc... in it and is portable to any platform, so if you want to support different devices in the future (web, other phones), your door is not closed by making the wrong decision now.

    With WCF (netTcpBinding) you constraining yourself to Windows Desktop clients - no other operating systems, no phones, no web clients... Even with sockets you would exclude some platforms and ended up having to write a lot of plumbing code for clients that loose connection etc... 

    Just be aware that creating this kind of service is going to take some effort no matter which technology you use. 

    Regards and good luck,

    Stevo

    Wednesday, November 28, 2012 3:49 PM