Search Unity

Handling game login GameSparks

Discussion in 'Multiplayer' started by gavinb80, Jun 25, 2015.

  1. gavinb80

    gavinb80

    Joined:
    Nov 4, 2012
    Posts:
    98
    Hi all,

    I was just looking for some advice from any people that may have used GameSparks before. I am developing a simple turn based game and am handling the users & turn based mechanics with GameSparks (or at least hope to).

    What is the best way to handle user login / registration with the framework? I am offering people the choice of using either Facebook, Twitter or Email to login with. But when a user leaves the game and returns later, should I just save their last login method via PlayerPrefs and check that, or is there a more robust / foolproof way to do this as of course I don't want to be asking their preferred sign in method every time they open the game?

    Any help or guidance much appreciated
     
  2. Meltdown

    Meltdown

    Joined:
    Oct 13, 2010
    Posts:
    5,822
    Glad to see more people using GameSparks. I absolutely love it.

    Firstly, you need to register a user on GameSparks using DeviceAuthentication. This is to get them into the game, and playing it, generating ad revenue etc. I'm sure you will have other data you want to store for this player on GameSparks, DeviceAuthentication allows you to do this from the beginning.

    Note : Do not create an 'authentication wall', forcing the player to login with facebook or email. This can chase many players away who haven't even played your game yet. This is why device authentication is important, it registers them with GameSparks, but they don't need to do anything.

    If a player moves over to a Facebook or other special login type, the facebook account will be linked and the details will be stored in the ExternalAuth collection in the NoSQL database. So they will move from a device authenticated user, to a facebook authenticated use. Their player record in the Player collection in the NoSQL database will stay the same.

    You can create a field in PlayerPrefs which is a simple bool, i.e IsFacebookUser, or isTwitterUser
    When you load up the game, check this value, and if say isFacebookUser is true, automatically initiate the Facebook login.
     
    ilmario and gavinb80 like this.
  3. gavinb80

    gavinb80

    Joined:
    Nov 4, 2012
    Posts:
    98
    Perfect, thank you. I was going to present a dialogue box at first start up with "connect with facebook" "connect with twitter" and "skip" and allow linking accounts later. So then do a check at the start and if PlayerPrefs has an isRegistered flag and isFacebookUser and isTwitterUser are both 0 then user device authentication.

    So far I really like the look of GameSparks, which is great and it seems to cover everything I need so very happy there. Only concern so far is that if by some miracle the game downloads take off and it gets used a lot, it is potentially going to cost me a fortune and potentially make me no return on revenue, but one hurdle at a time!