Search Unity

[RFC] Async challenge-based multi-player - advice?

Discussion in 'Multiplayer' started by randomizer86, Aug 1, 2014.

  1. randomizer86

    randomizer86

    Joined:
    Aug 1, 2014
    Posts:
    1
    Greetings,

    Quite a few of the top grossing games on iOS and android are async
    challenge-based multi-player.
    I was wondering what does it take to build a good multi-player game.

    I've been playing around with Unity for some time now (nothing fancy - just n00b stuff). But, I'd like to learn more about multi-player games.

    Primary target platforms are iOS and android - Windows Phone may follow later
    on. Given Internet latencies, real-time seems out of question - hence, going
    down the async route.

    I would like to hear from the experts here who have built multi-player games
    before - what has been their experience and major pain points they've faced.

    Typical features used in existing multi-player games that I have seen include:

    1. social integrations with FB and/or G+
    2. ability to send/receive challenge notifications - both push as well as in-app (for larger payloads - since, APNS supports very small payload)
    3. match-making based on user attributes - level, scores, friends etc.
    4. leaderboards - both app-level global and social (among friends)
    5. achievements

    Questions:

    1. Clearly, you need some sort of server to be able to connect players together.
    Any options there? I've heard about Photon server - would like to know how
    easy/difficult is it to integrate with.

    2. Looking at Photon Turn-based documentation, it seems to implement
    match-making based on rooms concept (and attached attributes) and
    not based on user attributes.
    Am I correct in this interpretation?
    How does one implement match-making which is based on user attributes?
    Is there any existing solution? or have you built it in-house?

    3. How do we implement the results computation logic - in case of photon or
    otherwise? What options have you considered/come across?

    4. How to implement leaderboards and achievements? any existing solutions?
    Google Play Game services provide both leaderboards and achievements.
    I've not yet explored it much - but, would like to hear about your
    experiences with it.
    Does it work across platforms (i.e. iOS, windows phone)?
    Does it support users logged in with say, FB - or does it require google accounts?

    5. Looking at the Google Play Game services documentation, it seems like
    the developer needs to write code to keep posting score updates to leaderboards
    including tracking of the leaderboard id to which to submit the score.
    Also, for achievements, the developer needs to keep posting the progress
    to the achievements and needs to keep track of the achievement id in the app.

    I think this is too complicated. I think having a single point to post/submit
    the score is important - which should internally trigger the required updates
    to leaderboards/achievements/others.
    Comments?

    Please feel free to add any other points or attributes I might have missed.

    PS: I've also posted the same thread on Unity Answers - don't know how the forums and Answers are linked.
    Please forgive me if it's not advisable to do so.

    thanks.
     
  2. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    3,070
    I am too biased to answer question one. Better ask someone else.

    2. Yes, we use Room attributes (Custom Properties). But if a user sets them when he/she creates a room, then they can actually be the same as the user's attributes. The difference is that we don't match everyone against everyone. You try to find a suitable game, might try again with less rigid filtering and if all else breaks, the client creates a room and waits for others to match.
    This behaves very much like player based matchmaking.
    We added a feature where you can create a room and leave it open, even if the creating player is not active in the room. So players are no longer stuck waiting in a room until someone joins it. They could play another game, etc...

    3. Photon Cloud allows you to define an external (web/http) server which could provide game logic, too. For turnbased games, the extra lag is usually not a problem and you have all the choices how to implement this. Of course, there are demo projects, so you don't have to start from scratch.
    If you expect a lot of players or a lot of server-side computations, you can also get in touch about a Private Cloud. There we allow you to run "Photon Plugins", which is C# code that handles in-room events.

    4. There are some communities. Maybe the one you want to use has leaderboards, then you could use them. Directly by client or by "WebRPC". Check out PlayFab. Maybe that's a fit.
     
  3. pabloruiz555

    pabloruiz555

    Joined:
    Feb 17, 2014
    Posts:
    1
    Hi Tobiass, thanks for the answers you provided for the OP.

    I have a question regarding #2:

    Say you want to implement what the OP wants, with turn-based Photon, where user A logs into the app with FB and wants to challenge user B to a match.

    How would you do that? From what I read from the docs, I might be inclined to create a Room with custom properties which correspond to user A's FB id and user B's FB id. So the challenger creates the room with those 2 custom properties and when the user B gets the notification and goes to the lobby (a screen with a list of current games) they are shown the Room player A created as it matches both their FB ids.

    Would that work? Is there a better way to do that?

    Best,
    Pablo
     
  4. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    3,070
    @pabloruiz555: Actually, I don't know if you can send invitations via FB. If so, you could set the room name as described and then send it along with the invitation.
    As long as the invited players know the room's name, they can enter it - no matter if the other players is active or not.
    At the moment, this would be done with a rejoin, which is a bit odd naming-wise.

    You don't have to join the lobby to join the room, if you know the name anyways. And turnbased games drop out of the lobby listing some time after the last player became inactive.

    Hope that helps.