Search Unity

Google Play Services Real time Multi player and Unity HELP NEEDED

Discussion in 'Multiplayer' started by nitroy2k, Apr 24, 2014.

  1. nitroy2k

    nitroy2k

    Joined:
    Jun 27, 2013
    Posts:
    7
    Hello guys, I believe this is my first post in here so wee! :)

    Any way I have to ask for little help because I got stuck @ point..

    I am using google's unity3d google play services plugin...

    I have implemented everything from sign in achievements leader boards...

    Now where I'm stuck is starting real time multiplayer game.

    In google documents they say to call Quick Game
    But I have lost all idea's how to do it I tried 100 options I always have some script error...

    Can some one help out? Point to good direction ..
    I tried to find tutorial online but no luck...

    Thanks..
     
  2. xxhalfpint

    xxhalfpint

    Joined:
    Jul 11, 2014
    Posts:
    1
    Hey I just bumped into the same issue with creating games.

    PlayGamesPlatform.Instance.RealTime.CreateQuickGame(MinOpponents, MaxOpponents,
    GameVariant, listener);

    The fourth parameter in that call is a listener.
    My issue was that you had to have an instance of the listener (RealTimeMultiplayerListener)

    I did some digging and found that the RealTimeMultiplayerListener class is an interface so you can't instantiate it.
    That being said you'll have to write a script to implement that interface.
    You will also have to override the methods to do what you want.
    Then you should have a working listener.

    I'm currently implementing it now. I'll post some code if you need it when I'm done.
    (Also I'm a coder by trade so let me know if you'd like me to talk at a higher level)
     
  3. Sharkboy19

    Sharkboy19

    Joined:
    Oct 3, 2014
    Posts:
    2
    Plz can you post your code, i have the same problem with nitroy2k.
     
  4. agray427

    agray427

    Joined:
    Apr 8, 2013
    Posts:
    5
    You have to inherit your class from GooglePlayGames.BasicApi.Multiplayer.RealTimeMultiplayerListener. Then you add the functionality. You CANNOT attach this class to an object. Make a static and public method called CreateQuickMatch as well. You'll need to make a reference (instance) of the Listener.

    For example:
    public class MultiplayerManager : GooglePlayGames.BasicApi.Multiplayer.RealTimeMultiplayerListener
    {
    private static MultiplayManager sInstance = new MultiplayerManager;

    public static void CreateQuickMatch ()
    {
    PlayGamesPlatform.Instance.RealTime.CreateQuickGame (<minPlayers>, <maxPlayers>, <gameVarient>, sInstance);​
    }​

    public static MultiplayManager Instance {
    get { return sInstance; }​
    }​
    }

    So from another class, to call CreateQuickMatch you just call MultiplayerManager.CreateQuickMatch(); that's it. I hope this helped somebody.
     
    Last edited: Dec 19, 2014