Use "Google Play Game Services" (Multiplayer feature) with LibGDX

| | August 5, 2015

I’m developing a simple game (for Android, using LibGDX Framework) and I would like to implement multiplayer feature to it.

So, since the main project with the logic of the game in LibGDX is separated from the android project, I have created an interface to allow my game to call the GPGS API in order to implement its services.

But, it doesn’t work. Have someone an example to show me how to do this? However, this is what I have done (premise: GPGS SDK is already installed and its library is linked to my Android project):

  1. Copy the GameHelper class of BaseGameUtils (downloaded from Google) in my Android project.
  2. Make the interface in the main libgdx project
  3. Create a class (named MultiplayerOperations) that implement the interface, in my android project. This class is more similar of the BaseGameActivity available in the BaseGameUtils.
  4. In the activity of my Android project a make an object of the last class type and pass it to the constructor of the main libgdx project.

    mpOperations = new MultiplayerOperations(this);
    initialize(new CloseWall(mpOperations), cfg);

When I start the application, it doesn’t work and it exit with an exception.

Leave a Reply