Integrating GameSparks into LibGDX (Java)

On this post, I’ll share with you my experience integrating LibGDX and GameSparks, the Backend-as-a-Service with huge adoption among, most commonly, mobile developers.

 

Baas is great way to engage users and acquire more them (and earn more money) for your games. This brings to your game analytics, push notification, social integration, IAP integrations, achievements, leaderboards an so on. Check more on this image featured by GameSparks:

GameSparks features

 

After this humble introduction into BaaS, let’s integrate it with LibGDX. For most platforms supported by GameSparks, the configuration is straight-forward, but Java integration is not. So, on a Gradle project, this is how I get it working:

First, on the project build.gradle, include this repository on allprojects part:

maven { url "http://repo.gamesparks.net/mvn" }

The final code should looks like this:

allprojects {
    apply plugin: "eclipse"
    apply plugin: "idea"

    version = "1.0"
    ext {
        appName = "Speech Colors"
    }

    repositories {
        mavenLocal();
        mavenCentral()
        maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
        maven { url "http://repo.gamesparks.net/mvn" }
    }
}

Next, on project core, add this line:

compile "com.gamesparks.sdk:gamesparks-java-sdk:0.0.+"

It will looks like:

project(":core") {
    apply plugin: "java"

    dependencies {
        compile "com.badlogicgames.gdx:gdx:$gdxVersion"
        compile "com.gamesparks.sdk:gamesparks-java-sdk:0.0.2-SNAPSHOT"
    }
}

After that, sync gradle project and all things should be fine. You’ll be able to use GameSparks SDK into your project, simply by adding:

GS gs = new GS("API_KEY", "API_SECRET", false, false, new CustomPlatform());
gs.setOnAvailable(new GSEventConsumer<Boolean>() {
   @Override
   public void onEvent(Boolean available) {
      if(available) {
         //Game Sparks Available!
      } else {
         //Game Sparks Not Available!
      }
   }
});
gs.start();

The core sdk documentation can be found here: https://api.gamesparks.net/?javasdk

Regards,

Interoperability with LibGDX, Gradle and AIDE

Before we start the interoperability part, let’s dive into the AIDE part. AIDE is an Android IDE you can install on any device running the Android OS. Once you installed it, you can build Android apps using the Android SDK plus you can use the native interface with NDK and also LibGDX. It also supports Gradle build system and Git. But there’s a drawback: lack of gradle support for LibGDX projects.

Screenshot_20160119-161610

So, I came up with a solution based on this post on StackOverflow.

The steps are:

  1. Create a LibGDX project. It will create a Eclipse based project;
  2. Post the recently created project into a Git repo;
  3. On desktop, get the repository and update it to a Gradle project, but keep the .classpath, project.properties and the files related to Eclipse project;
  4. Important step: rename build.gradle on android folder to builde.gradle (I know, it’s a workaround, but worked for me);
  5. Post back the code to your repository;
  6. Update your repo on Android device, and open the android project.

It was I did to keep my game development while moving to work.

PS.:  For some reason, renaming build.gradle to builde.gradle works most time. But I know it isn’t the perfect solution. So if you face some problem, let me know on comments.

 

Hello and hand to the plow

Hello all. I’m proud to finally write my own dev blog and spread some thoughts about game development. My name is Aecio and I’m a brazilian indie game developer (for now, forget about all awkwardness this title brings).

So, in this first post we’re gonna talk about game frameworks (A.K.A SDKs) and how it helps us, indies. There are many options out there and, as indie game developers (read it “I have no money to spend with all this cool stuff just like the big boys”) we must think over how much it will cost to us.

Firstly, I’ll bypass the well known game engines, like Unity 3D and Unreal and go to the frameworks – FYU, the most notable difference between engines and frameworks is that a game engine, usually, has a UI and the framework doesn’t. So, back to our frameworks, I have to notice about two great tools, maybe the best among others, they are Monogame and Marmalade. They are both great tools and I’ve been testing it’s main features but, as I’m a mobile game developer, my first citizen platforms are Android and iOS, and at this point the scenario becomes a lot harder – mainly for Monogame. The problem is: Monogame is based on Xamarin for mobile and it’s paid…and it’s not cheap, really. To be fair, you can build for desktop at not cost. The Marmalade case is a bit different. It dos not cost a penny to start building games for mobiles, but you have to put a splash screen with their logo, which, we must admit, isn’t the apocalypse. Marmalade is cheaper than Monogame, the Community Plan cost $15/month and if you have a fat piggy bank, go on and break it.

 

monogame-marmalade

 

But, we are yet indie game developers, and must think carefully about our money (or the lack of). Fortunatelly, we’re blessed with many others tools that are totally free, and I’d like to highlight three of this. They are Cocos2d-x, OpenFL and Libgdx. They are great and powerful tools and their showcase show it itself. Check it out: Cocos2d-x, OpenFL and Libgdx.

 

cocos-libgdx-openfl

 

Secondly, after some years of testing each one of the tried, if I had an advice, something like ‘Tell it and die’, I would say: “Pick one and be happy”. Oh really, they are great tools, with great community and solid documentation. Everything you need to start. So, we won’t go further on discussion about who has the best frame rate or who is more affectionate to OpenGL, unless you really need to know this specific stuff. Otherwise, pick one of them and be happy.

That’s all folks for now. Enjoy.