Game Maker Studio Setup Firebase Tools

This tutorial details Game Maker Studio Setup Firebase Tools.

Creating a Firebase Project

For creating a firebase project, head over to Firebase Console. If you haven’t logged-in with your Google account yet, you’ll be greeted with a login screen. After that Projects screen will be presented to you.

Select Add project, you’ll then be shown a window.

Project name : The name of your project, you can write it as your Game’s Name.
Project ID : Identifier of your project, must be unique.
Locations : These are the location centers that’ll be used for some of the Firebase Tools. For Analytics, I recommend you to choose your own country or where you live. For Cloud Firestore, I recommend you to choose whichever serves you to best. Your database will be located in this area and therefore serve better for the players living close to it.

Click Create Project Button to proceed. Now, Firebase usually changes its UI but you should get the context easily. We will create an Android App on our Firebase project now.

On the Project Overview screen, you’ll see a big area. Click the Android Icon (Marked in dashed circle on the image above). This will bring a new screen, there we will fill our Android App’s details.

Android package name must be the same as your Android package name that you set on Game Maker Studio IDE. Click to Register app button to proceed.

Finally, you’ll get to the page where you will download your google-services.json file.

Download this file and put it on your Desktop. We will use this file in a moment.

Now, we’re done with Firebase Panel. We can now move onto the Game Maker Part.

Setting Up Game Maker Studio for Firebase Tools

Unfortunately, Game Maker Studio does not include “changing runtime files on the IDE”, we must do it manually. First, check your Game Maker Studio Runtime version.

My current version is 2.2.1.291. By the time you’re reading this, the version may be different. We need this information because we will go to that folder.

C:\ProgramData\GameMakerStudio2\Cache\runtimes

Now select the folder which contains your runtime : For me, it’s 2.2.1.291

Now, first thing to do is to backup your original android folder. Copy paste it and rename the new one as android_original.

Now, go to the android folder. There you’ll see runner folder, open it. We must edit two files inside of it.

In here, we only need to change two things;

  • RootFiles\build.gradle
  • ProjectFiles\build.gradle

Now, go to RootFiles\build.gradle (You can open it with Notepad). Insert the following code inside the dependencies bracket.

 classpath 'com.google.gms:google-services:4.0.1' 

The final version the file should look like this (The code inserted at 12th line)
Be careful as Yoyogames sometimes update this code. Try to insert the code above to the correct place instead of just copying the code below!

// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
    repositories {
		mavenCentral()
		maven { 
			url "http://repo.spring.io/plugins-release/" 
		}
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.2.0+'
        classpath 'com.google.gms:google-services:4.0.1'
    }
}
allprojects {
    repositories {
		maven {
            url "https://maven.google.com"
        }
		maven { 
			url "http://repo.spring.io/plugins-release/" 
		}
        jcenter()
    }
}

The second file we must edit is ProjectFiles\build.gradle. You can open it with Notepad. Add the following code to the very end of the file

apply plugin: 'com.google.gms.google-services'

The final version of the file should look like this

apply plugin: 'com.android.application'

android {
    compileSdkVersion ${YYAndroidCompileSDKVersion}
    buildToolsVersion '${YYAndroidBuildToolsVersion}'

	${YYAndroidJavaMaxHeapSize}

    defaultConfig {
        applicationId "${YYAndroidPackageName}"
        minSdkVersion ${YYAndroidMinSDKVersion}
        targetSdkVersion ${YYAndroidTargetSDKVersion}
		multiDexEnabled true
    }

	signingConfigs {
        release {
            storeFile file("${YYAndroidKeyStoreFile}")
            storePassword "${YYAndroidKeyStoreFilePassword}"
            keyAlias "${YYAndroidKeyAlias}"
            keyPassword "${YYAndroidKeyPassword}"
        }
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
			signingConfig signingConfigs.release
        }
    }

	${YYAndroidSplits}
}

dependencies {
    compile 'com.android.support:support-v4:${YYAndroidSupportLibVersion}'
	compile 'com.android.support:multidex:1.0.1'
    compile files('libs/ini4j-0.5.2.jar')



	${YYAndroidGradleDependencies}

}
apply plugin: 'com.google.gms.google-services'

Finally, remember the google-services.json file we downloaded and put it on the Desktop ? Drag and drop this file to the ProjectFiles\ folder.

Congratulations!

You have finished implementing Firebase tools to Game Maker Studio. Now you can use GMDevBlog Firebase Extensions in your apps.

Share

Marty

Truely speaking, I don't know what am I doing most of the time.

18 Responses

  1. Dragonaz says:

    hello can you please help me it says :
    * What went wrong:
    A problem occurred configuring project ‘:com.dragonpirates.piratesbattle’.

    The library com.google.android.gms:play-services-measurement-base is being requested by various other libraries at [[16.3.0,16.3.0], [16.4.0,16.4.0]], but resolves to 16.4.0. Disable the plugin and check your dependencies tree using ./gradlew :app:dependencies.

    • Marty says:

      Hello Dragonaz. I believe you also use Yoyogames’ Google Play Services Extension. It occurs that both extensions conflict. One member reported this before on our Discord channel.

      Try this:
      Remove : apply plugin: ‘com.google.gms.google-services’ from ProjectFiles\build.gradle. See if the extension still works.

      • Dragonaz says:

        thanks marty it fixed the problem ! but when i launch the game on my android phone , firebase dont get any signal from the game ! i check the package name it is the same ! do i need to publish the game on google play first ?

        • Marty says:

          No need to publish your game on Google Play.

          I believe Google Play Services extension conflicts with my Firebase extensions.

          I am currently waiting for Yoyogames’ Game Maker Q3 Update, which will update Game Maker’s Android SDKs. This means that I’ll be able to update my Firebase extensions as well.

          A question, which Firebase Extension are you using?

          • Dragonaz says:

            im using the Analytics one !
            so do i need to wait for the gm’s and ur extension’s updates to be able to link the app with firebase ?

          • Marty says:

            I’m on vacation now, away from my computer. Once I got back, I’ll look for a solution. I have to check which version works better with Google Play Services extension.

            Sorry for now 🙁

    • Marty says:

      I have verified here that they updated the gradle version of Game Maker (See the report here https://forum.yoyogames.com/index.php?threads/gms2-google-updates-2-2-4-feedback.67329/#post-401465)

      This means that I can update all my Firebase Extensions to their latest versions.

  2. Hello i am using yoyr extension want to send these events how i can do this.
    a) level_up: when users get through a level
    b) game_fail: when users fail a level
    c) fullads_show: when an interstitial ad is
    shown successfully.
    d) videoads_show: when an rewarded
    video ad is shown successfully.

    • Hello Manjeet. The documentation for the Analytics is included here https://gmdevblog.com/game-maker-firebase-analytics/ please check it. For your questions;

      A) You can use level_start & level_end functions. An example would be,
      firebase_analytics_event_level_start(“boss_level”); //When starting the level.
      firebase_analytics_event_level_end(“boss_level”, true); //When finishing the level. Argument1 = true means that user successfully finished the level. False is failed!

      B) Same as above. Only change the second function as
      firebase_analytics_event_level_end(“boss_level”, false); //False because failed.

      C) No need to log this as my extension automatically logs this for you on Firebase panel.
      D) No need to log this either because my extension also automatically logs this for you.

      Enjoy 🙂

  3. ZigZag says:

    Hi I have some issues compiling for Android with this, I suspect it’s due to the new yoyo notification extension since I get some duplication errors and they use firebase for that extension, are you able to look in to this? It works perfectly without 🙂
    Kind regards

    • Hello ZigZag. I am aware of this issue. It is caused because both parties try to initialize Firebase.

      The only solution is to use my Firebase Notifications extension which is way more powerful than Yoyogames’ extension. I’m currently working on it and will share it in couple days.

      Thanks 🙂

      • ZigZag says:

        Hi Marty

        Thank you for the reply, just wondering how far you are with the notification extension?
        I need notification, so as long you don’t support it, and I can not use your analytic extension with the one from YoYo, then I can not use your excellent analytic extension 🙂

        Kind regards

        • Marty says:

          I’ve yet seen your comment, so sorry for the delay. My last 3 months have been really really busy. I’m back now, and continue working on firestore extension.

          Once it’s finished, I’ll reshape the notification extension(Along with a custom server written with Golang)

  4. Kay Win says:

    Good job on this extension. I saw some requests for an iOS version. I have also written a simple firebase extension for Android but have no idea how to modify AppDelegate in GameMaker. It would be great if you can provide me some guidance. Thank you in advance

    • Marty McFly says:

      Hi Kay. Sorry to reply late. I haven’t had the chance to work on iOS extension yet. Simply, I don’t own an iPhone and it gets kinda harder for me to do the testing and things etc. So, I’m in the dark as well. Let me know if you find anything useful

  1. 17th April 2019

    […] Setup Firebase Tools for Game Maker Studio (Please also read “Setting Up” section below as it needs two more steps to include the library. […]

Leave a Reply