Open source asynchronous multiplayer minesweeper

Repository: https://bitbucket.org/NathisGreen/minesweeperbattle


A project I worked on awhile ago using LibGDX and the engine I made for FlyBy was an asynchronous multiplayer minesweeper game based off the MSN instant messenger game Minesweeper:Battle. I decided to try creating an asynchronous game as at the time I had never worked with databases before and it seemed like a fun challenge. I chose minesweeper because it is a game with very simple game logic, which would allow me to focus more on the asynchronous aspect of the project.

Since I had the project lying around with no intention of doing much with it I decided to open source it in the hope other people who want to try something similar might be able to take away some value from it. The end result used three different database tables. One for accounts, matches, and player turns. The structure for the tables is included in the repository as well as all the SQL files in the SQL folder in the root of the repository.

Repository: https://bitbucket.org/NathisGreen/minesweeperbattle

FlyBy released on iOS!


Its taken awhile, but FlyBy has finally been released on iOS! Check it out!

Of course, the game is still available on Google Play too!

appstore

appstore2

When I first started developing FlyBy, LibGDX had no support for iOS. I had decided I would just make an Android game and it would never be released on iOS. So its pretty amazing to be able to say the game is available on iOS. But there were quite a few challenges even once LibGDX added its RoboVM backend for iOS. For starts, I don’t have a mac, or any iOS devices and I’m not a registered Apple Developer. Three essential requirements for making an iOS game! Luckily fellow game developer Matt Taylor offered to help out with the iOS version, and he had access to all three of the things required. Due to the way LibGDX works, where each platform has its own project that shares a common core project, it was possible for me to work on the core game, adjusting game play elements and re-factoring certain areas that would allow Matt to work on implementing game center support for the iOS version. The process essentially had me exposing certain elements of the game into interfaces so they could be accessed by the iOS project (for example achievement unlocks). This worked well, since Matt was not familiar with the code base at all, and allowed him as little  direct interaction with it as possible, making it possible for him to focus on getting the core game center implementation to work.

For the most part, the core game worked almost without any adjustments, once the initial setup of deploying to iOS was overcome. However, there was a few quirks, mainly with sound. If serveral sounds were playing at once, there was a noticeable drop in FPS on the iOS version. Debugging issues such as this was very difficult. As they lied with the base engine classes, I had to essentially guess at what the problem could be, ask Matt to try out some changes, wait for him to do it, and then wait for him to tell me the results. This made for quite a slow and tedious development cycle and made it nearly impossible to tackle the problems to an acceptable standard. In the end, to overcome the sound issue, all sounds except the background track was removed from the iOS version, a less than ideal solution.

However, against all odds, the game is now released on iOS, and works decently on most devices we know about! So if you haven’t yet, download the game!

FlyBy Post-Mortem

FlyBy has been on the Google Play store for nearly 4 months now.  The game has been downloaded over 23,000 on the Google Play store and scored an average rating of 3.8 out of 155 reviews at the time of writing.

What went right

  • People actually played the game
  • Press and reviews of the game on various websites
  • “Piracy” in China

What went wrong

  • Game Difficulty
  • Giftiz
  • Crashes

People actually played the game

When we released the game we really had no idea what to expect. I had read developers posting on various websites and forums saying how they were stuck with only a handful of downloads and were struggling to get any attention at all. At the same time I had seen similar games on the store with what seemed like really high downloads in comparison. I had decided that 1,000 downloads would have been a good result before release. So with 23,000, I am really pleased with the reception FlyBy has received.

Press and reviews of the game on various websites

Before the release of FlyBy we put together a press pack to try and make reviewers life as easy as possible. It include screenshots of the game, information about its development, and even a PC version of the game for press use only. I believe this helped us get reviews on some websites, and although non of the reviews had too much of a dramatic effect on the download count, they definitely helped. Our biggest feature happened when one of the other developers wrote to a local newspaper on a whim. We honestly didn’t think there would be a response, but to our surprise the newspaper decided to write an article about FlyBy. The online version of the article can be found here. Please excuse some of the quotes, the guy doing the telephone interview was a little nervous/excited, and not fully in the loop with the development of the game!

Some other reviews are as follows:

Super Gamedroid

Fettspielen lets Play Video

Jumpcraft Review

“Piracy” in China

One of the events that had the biggest impact on FlyBy’s download count was when the game got uploaded to some Chinese app stores. I noticed this was happening due to integrating Google Analytic’s. There was a few days where Google Analytic’s was showing very high new users but Google Play wasn’t showing information that agreed with all these new users.

Graph of new users from Google Analytic’s

Although these downloads didn’t get added to the Google Play page and potentially impacted the visibility of the game on Google Play, it was still positive to get a few thousand extra downloads.

Game Difficulty

FlyBy is probably too difficult. I was very keen on integrating Google Analytic s into FlyBy to collect more detail information about the users who would play the game, to hopefully be able to use to make improvements in later updates. One of the challenges in the game is called “Flying License” and is basically an achievement for completing what is considered the tutorial section of the game (flying through the first two caves for the first time). To date, this achievement has been earned 1,562/23,000 (more like 25,000 if you count the Chinese downloads). Considering most of the content in the game cannot be seen until this section is completed, and this section is suppose to be easy compared to the rest of the game, this is a tiny percentage of players. Most the people who downloaded the game never saw the ‘good’ parts of the game.

Giftiz

Giftiz is a company that has created an app discovery service. It largely evolved around users being rewarded to download apps from their app. The rewards can be built up for real prizes too apparently. Giftiz contacted us presenting us the opportunity for a free feature in their app, in exchange for putting a button that advertises their app in FlyBy. The featuring did give us quite a big spike in downloads.

GiftizGraph

Giftiz Spike from Google Analytic’s

So why was it bad? Well part of the agreement is you have to keep their button in your app for at least 6 months after the featuring. That is quite awhile considering the featuring only gave about 2-3 days worth of extra downloads. The company also claimed there was no pop-ups to go with the button. When I was integrating their SDK into FlyBy using a developer key they gave me, I never saw any pop-ups either. However it became apparent once released, that on the first time the game is ran, Giftiz forces a full screen page explaining about their product. Interactions with the company were often unprofessional. In e-mails they referred to FlyBy by the name of a completely different game (one that was getting featured around the same time), and they pushed back the feature date of FlyBy very near the agreed date (due to a paid featuring, which is understandable) meaning we got featured after our first month on the store had passed. All in all, this featuring was not worth the time it took to integrate their SDK or communicate with the company.

Crashes

Since release there has been 10 different crashes reported roughly 150 times. Although I feel this number is relatively low, I think it could of been lower. The most common crash report is in “android.opengl.GLSurfaceView$EglHelper.throwEglException” which has been reported 110 times. 94% of these reports come from devices running Android 2.3.3-2.3.7. Considering the game probably does not run very well on these phones at all, I feel setting the minimum Android version higher and not allowing these devices to download the game could of had an impact on the overall rating of the game, by avoiding as many 1 star reviews from users who the game did not work for.

 Conclusion

I feel there are more improvements that I could of made to improve the release of the game, such as working on updates after release. The game was released right before my final year of University began, meaning I did not have as much time to continue developing it. However, as mentioned before, the game has received far more downloads than I had anticipated and has been a great learning experiencing. I hope to use the what I have learnt from this process in the future, when I hopefully release more games.

 

 

FlyBy is Released!

After around 7 months of work, I have released FlyBy onto the Google Play Store! Check it out!

FlyBy On Google Play

SS0 SS1 SS2

FlyBy On Google Play

FlyBy is an exciting, fast paced, arcade style mobile game with a variety of exciting obstacles and challenges to complete! With randomly generated levels and online leader boards powered by Google Play. FlyBy offers many hours of plane flying fun! We hope you will enjoy playing and share our game with your friends!

Check out our website at www.FireFreeGames.com for more information about us or follow us on Twitter at @FireFreeGames!

Features:

Collect coins to buy power ups and upgrades in the in game store
Randomly generated caves and levels for endless game play
Many different exciting obstacles to avoid and fly through
Online leader-board powered by Google Play Services
Thrilling challenges to complete

Development

Working on FlyBy has been a long and at times challenging project. When I began the game I was just trying to make something small I could get done in a weekend. I made a little engine using LibGDX and put together a very rough prototype. After showing the prototype to Liam Bower we decided to work together (him doing art and me doing programming) and turn it into a full game. Our main goal always being to create a finished, released game. We figured it would take about a month to do. In reality it took us closer to 7. Along the way Luke Avery began doing small contributions on and off, mainly working on the in game menus, working with Liam to make them look the way Liam envisioned, while I worked on most the engine and core game play elements of the game. Adam Brown generously composed a few sound tracks and created some sound effects for the game as well.


Time lapse video of key versions of FlyBy’s development

 

There was a range of challenges I had  to overcome during the development, such as the procedural generation of the caves, game design decisions, performance optimization to improve the speed the game ran, integrating the Google Play Services into the game and countless other difficulties. Each challenge forced me to learn a lot about a wide range of topics.

FlyBy grew into a bigger project than I could have ever imagined when I started working on it, and I am proud of the way its turned out and the work everyone involved contributed to the game. So please, give it a go!

Tutorial: Integrating Google Play Services with LibGDX

Source Code for tutorial on Github

Over the past week I have been working on adding online leader boards to my game FlyBy using the Google Play Services game API’s. As I ran into a few things that caught me out I thought I would write up how I got it working in hope it helps other people. So here we go:

Prerequisites

  • a Google developer account (this requires paying the $25 registration fee)

It is probably a good idea to have downloaded and got the Type-A-Number example from the Google developer site (which you can find here) working before you try integrating with LibGDX just to make sure you know how to handle the backend stuff on the website like setting up an OAuth 2.0 client ID and linking it to your app (which isn’t as hard as it may sound!). I’d highly recommend following that tutorial before this one. Some things to watch out for on Type-A-Number tutorial:

  • BaseGameUtils doesn’t import as a library, have to click the toggle box “isLibrary” on the projects properties (right click BaseGameUtils go to Properties>Android and tick the “isLibrary” box)
  • If you get “NoClassDefFoundErorr” when trying to run the project make sure to go the android projects properties > Java Build Path and make sure to tick the check box’s next to the dependencies your project uses.
  • Logging in with my developer account in game didn’t work for me, even with it set to be a tester (which happened automatically). If you are getting “Unknown Error” when attempting to sign in try using a different Gmail account (Be sure to add the account as a tester)

LibGDX Intergration

If you have got the Type-A-Number tutorial running your in a pretty good position, theres only a few changes needed to make it work with LibGDX. You can get the source code for this tutorial here. This tutorial assumes you are using Eclipse.

Step 1 - Import BaseGameUtils and google_play_services_lib into your LibGDX project.

  • The BaseGameUtils project is located from the Google Play Game Services Sample Games located here. It also came with the Type-A-Number tutorial so you can just grab it from there too.
  • google_play_services_lib is located in your android SDK folder at android-sdk\extras\google\google_play_services

To import the projects go to file>import>android>Existing Android Code into Workspace. Browse to the location of the lib your importing. The project should show up in the “Project to import” section. Make sure to click copy projects into workspace. Do this for both projects.

Step 2 - Add google_play_services_lib as a dependency for BaseGameUtils.

  • To do this right click BaseGameUtils and then click properties>Jave Build Path>Project>Add . In the popup box tick the google_player_services_lib and click ok. This should remove the errors BaseGameUtil was complaining about. If not try Project>Clean and hopefully that will help.

Step 3 - Add google_play_services_lib and BaseGameUtils as build dependencies for your Android project. To do this:

  • Make sure BaseGameUtils is set to “isLibrary” to do this right click BaseGameUtils go to Properties>Android and tick the “isLibrary” box.
  • Now add them to your Android project. Right click your Android project and go to Properties>Android in the library section click add and add both projects. They should appear in the pop up window after clicking add.
How it should look

How it should look

  • Right click your Android project and go to Properties>Java Build Path>Order and Export and make sure to tick the box next to ‘Android <your android version>’ and ‘Android Private Libraries’ as well as any others your project relies on (this is required for the newer Android Developer Tools).
How it should look

How it should look

At this point the game should compile and deploy to a device without any errors. We can now begin working on the code. We need need to set-up some interfaces for platform specific code. We will pretty much just be doing what is discussed on this page. But to begin with we will setup a xml file to hold some important values needed by Google Play Services.

Step 4 - Setup an xml file to hold values for the application id (that you get from your google developer page). The advantage of using an xml file like this means you don’t have to change the value throughout your project, just one place you put the value in and reference it from there everywhere else in your project

  • In your Android project go to res>values and create a new xml file (right click values folder> new> Android XML File and call it ids.xml then click finish. Either click the add button and create a new String. When the string is created name it  ’app_id’ and give it the value of your games ID from the Google developer page for your game or edit the file directory in the text editor by clicking the ‘ids.xml’ tab at the bottom.
  • Open your AndroidManifest.xml file and click the ‘AndroidManifest.xml’ tab at the bottom to get the text editor. We need to add some code to setup the ‘ids.xml’ to work so add the following code inside your ‘application’ tag. I have it under android:label

PasteBin Version of Code with better formatting

<meta-data android:name="com.google.android.gms.games.APP_ID"
            android:value="@string/app_id" />

PasteBin Version of Code with better formatting
Step 5 – Create the base interface for platform specific code

  • Go to your main LibGDX project and create a new interface. I called it GoogleInterface. I set-up a very basic interface for this tutorial that has some very basic wrapping of some Google Play Services functions. You will most likely need to expand on this or create your own. But mine looks like the following:

PasteBin Version of Code with better formatting

package com.me.gdxGooglePlay;

public interface GoogleInterface {

public void Login();
public void LogOut();

//get if client is signed in to Google+
public boolean getSignedIn();

//submit a score to a leaderboard
public void submitScore(int score);

//gets the scores and displays them threw googles default widget
public void getScores();

//gets the score and gives access to the raw score data
public void getScoresData();
}

PasteBin Version of Code with better formatting

Step 6 - Create a class that implements the GoogleInterface for the Desktop implementation

  • Still in the main LibGDX project create a new class, I called it DesktopInterface and let it implement the GoogleInterface. My version of this class looks like the following:

PasteBin Version of Code with better formatting

package com.me.gdxGooglePlay;

public class DesktopInterface implements GoogleInterface{

@Override
public void Login() {
System.out.println("Desktop: would of logged in here");
}

@Override
public void LogOut() {
System.out.println("Desktop: would of logged out here");
}

@Override
public boolean getSignedIn() {
System.out.println("Desktop: getSignIn()");
return false;
}

public void submitScore(int score){
System.out.println("Desktop: submitScore: " +score);
}

@Override
public void getScores() {
System.out.println("Desktop: getScores()");
}

@Override
public void getScoresData() {
System.out.println("Desktop: getScoresData()");
}
}

PasteBin Version of Code with better formatting

Step 7 - In your projects main game class (the one that extends from ApplicationListener) create a constructor that takes an instance of GoogleInterface as a parameter. My constructor looks like this:

public Game(GoogleInterface aInterface){
platformInterface = aInterface;

platformInterface.Login();
}

As you can see I store the interface in this class, what you do with it once its in the project is up to you. I also call the interfaces Login method straight away so the game attemps to Login when it starts. In practice this probably isn’t a good idea. But for testing its fine.

Step 8 - Change MainActivity in your android project to implement GoogleInterface.

  • There is a lot going on at this stage. You need to make your MainActivity implement both GoogleInterface and GameHelperListener. This class will handle most of the actual talking with BaseGameUtils. I’ve set up a basic implementation that handles logging in, logging out, submitting and receiving scores. It probably isn’t suited to go straight into a game but demonstrates some ways to do these tasks. The main thing to note here is you pass the MainActivity into the Game constructor. Here is my class:

Pastebin version of code

If your getting an error with leaderBoardID you need to add it to your strings.xml file which is located in your Android project at res>values>strings.xml. The value for leaderBoardID should be the value of a leader board from your Google Developers page if you have made a leaderboard for the project.

At this point running the game should prompt you to choose a google account to log in with. If that actually happened, I’m surprised! If it didn’t, I probably forgot something or the tutorial needs to be more clear, so please contact me where you have got lost or what’s going wrong and I will try to help!

Source Code for tutorial on Github