Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Recommendations for handling the server side of asynchronous multiplayer?

Discussion in 'Multiplayer' started by casimps1, Oct 1, 2015.

  1. casimps1

    casimps1

    Joined:
    Jul 28, 2012
    Posts:
    254
    I'm working on a game where you can asynchronously play and challenge other people to beat your score (think something like SongPop). So you challenge someone and then your playthrough/results are stored on a server. Then the challenged player receives some kind of notification that they've been challenged and then plays at their leisure and can see the challenger's results. This is well-suited to play on Facebook where you can challenge your friends and such, but it would also be nice to be able to challenge random players of a similar skill level (using chess-style Elo ratings perhaps?)

    What's the best way to handle something like this?

    All the built-in Unity networking stuff looks designed around synchronous play and doesn't seem to apply to my situation.

    I'd certainly be willing to pay for some kind of PaaS/BaaS solution, but I do worry about how problematic that becomes if the service provider ever goes out of business. Could I easily migrate to another provider or my own backend?

    I also wonder how hard it would be to just code something up myself. I already have a LAMP web server and know enough PHP/mySQL where I think I could build something, but I don't want to spend tons of time on this and maybe I'm underestimating the work involved.
     
  2. Capn_Andy

    Capn_Andy

    Joined:
    Nov 20, 2013
    Posts:
    80
    I think you're thinking along the right lines. The UNet stuff doesn't support persistence, so async stuff wouldn't really work unless you wrote your own server tracking anyway. PHP/SQL is what I did for this years ago, not sure if you could get better results on appEngine/Amazon nowadays.
     
  3. Meltdown

    Meltdown

    Joined:
    Oct 13, 2010
    Posts:
    5,796
    Take a look at Gamesparks, an awesome BaaS for games that has built in support for asynchronous challenges.

    I'm using them in SuperTrucks Offroad and its a really nice system to work with.

    And I wouldn't worry about them going out of business just yet, they are serving some very well known AAA titles and partners and are constantly hiring new talent as they grow.

    They have a YouTube channel as well and one of their videos goes into depth on how to use the challenge system.
     
  4. casimps1

    casimps1

    Joined:
    Jul 28, 2012
    Posts:
    254
    Gamesparks does look pretty impressive. I'm intrigued.

    Am I correct in reading that they basically handle the problem of cross-platform IAPs and Leaderboards as well? Or is that their own system separate from Google Play and iOS Game Center?
     
  5. Meltdown

    Meltdown

    Joined:
    Oct 13, 2010
    Posts:
    5,796
    They do receipt validation for you when you make purchases on the App Store or Google Play, and based on that validation you can do something server-side, such as increment a players virtual currency coins or add an item to their inventory in the NoSQL db etc.

    They have their own custom leaderboard system, which has nothing to do with GameCenter. Or you can use GameSparks NoSQL database and Cloud Code to roll your own custom leaderboard if the built in one doesn't have the flexibility you need.
     
  6. gfoot

    gfoot

    Joined:
    Jan 5, 2011
    Posts:
    550
    That's what they said about GameSpy - when they closed down, they took a lot of AAA games with them, as well as the whole of Nintendo's DS Wifi Connect service. I think it's always good to be aware of this possibility, even if you conclude that it's not worth proactively guarding against.

    I wanted to suggest Yahoo Games Network too. I haven't published anything using it but I have developed against it and it has a broad feature set and fairly well-designed API, with a predictable pricing policy, and they are one of very few services that let you run your own code on their cloud servers (in a sandbox of course).
     
  7. casimps1

    casimps1

    Joined:
    Jul 28, 2012
    Posts:
    254
    Good point. Sometimes even the big guys surprise you.
     
  8. johngriffin

    johngriffin

    Joined:
    May 5, 2014
    Posts:
    10
    Hey guys,

    John from GameSparks here. As Greg has kindly pointed out we are unlikely to be going anywhere for the foreseeable future. We have thousands of developers with hundreds of live games and many millions of players monthly. The company is on a strong financial footing.

    So I don't think we would leave you stuck. If you would like to discuss further, we can take this offline (please mail me at info@gamesparks.com) and we can put some protection for you into an enterprise agreement.

    Kind regards,

    John.