Enable and change sandbox mode on Windows Phone 10

We had to test our Windows app Rocket Riot in sandbox mode to make sure in-app-purchases and such are working correctly, but on the internet it was impossible to find how to do this! So we mailed Microsoft and they helped us. First of all we had to update our phone to the latest version of Windows 10, so it’s a new feature too!

Turn on Developer Mode and the Device Portal

First of all your phone needs to be in Developer Mode, and the Device Portal needs to be turned on. See this page for more info on that.

Set Device Portal to On

Set Device Portal to On

Log in to the Device Portal

Open a browser on your PC and go to the IP address displayed on the phone, in this case http://192.168.10.157/. You will see a web page with several menu options, choose Xbox Live on the bottom. You can also open this page on your phone by opening the browser and going to http://127.0.0.1/ or http://localhost/.

Enter your sandbox ID

Enter your sandbox ID

Set the Sandbox ID

Then press Change a thousand times (it gives me an error every time I do it), close some apps, and restart the phone. For some reason this was the only way to do it for me, clicking it once didn’t work, and I had to restart the phone. After that the phone is in sandbox mode! Yay! If you want to turn off sandbox, set it to RETAIL.

Other stuff

You can also do other things in the Device Portal like

  1. Change settings
  2. Sideload apps by uploading them
  3. Kill running apps
  4. Browse files
  5. View processes
  6. View performance statistics
  7. ETW tracing
  8. Performance tracing
  9. View connected devices
  10. Connect to wifi networks and change wifi settings
  11. And of course change sandbox modes
Rocket Riot

Help us launch Rocket Riot

Soon we will be launching our beloved party shooter Rocket Riot (www.rocketriot.com) to Steam and Windows 10. We’d be immensely flattered if you could give us a hand and write a social media post about Rocket Riot on Nouncy. That way you allow us to control when your post is published, and thus amplifying the message.

As a token of gratitude, we’ll do a sweepstake after the campaign and give away 10 Steam keys for Rocket Riot (PC) !

Help us here: http://codeglue.nouncy.com/rocketriot

Rocket Riot

Rocket Riot

Thread is waiting for init_thread_header and init_thread_wait

The other day I ran into an issue where a thread got stuck on accessing a singleton. It was quite curious because there was no locking with mutexes or critical sections going on, yet the thread stalled. The callstack showed init_thread_header and init_thread_wait as the top most functions of the callstack, so the thread was definitely waiting for something… As it turns out, the constructor of the singleton class was calling some functions, which in turn would try to access the singleton again, this would of course result in an endless loop, depending on which implementation of singletons you use.
If you would instantiate the singleton with new, there would be an endless loop, and the stack would overflow. But if you used a static instance, the thread would simply stall at completion of the first loop, and Visual Studio would not complain, warn, or break.

Here is a simple example of how you can recreate this issue.

class MySingleton
{
public:
	static MySingleton& GetInstance()
	{
		static MySingleton instance;
		return instance;
	}

	MySingleton()
	{
		MySingleton::GetInstance(); // This is obviously bad
	}

	~MySingleton()
	{
	}
};

int main(void)
{
	MySingleton::GetInstance();
}

Of course the code I was working with was not so straightforward. So you would definitely have to look at the entire callstack to find the source of the problem.

Interesting issue, something to look out of in case your code stalls while accessing a singleton. But then again, we probably shouldn’t be calling any functions in constructors anyway… ūüôā

Unity blurry or fuzzy icons

Lately I have been using Unity and today when I ran the editor on my laptop I noticed that most of the icons were very fuzzy or blurry.

Example of blurry or fuzzy Unity editor icons

Example of blurry or fuzzy Unity editor icons

I tried to mess around with the quality settings in the Unity Editor itself, but that didn’t to fix the problem, so I looked around on the internet and several people reported the same issue, only after updating their graphics drivers. I’m using a quite old laptop with two video cards in it (NVIDIA GT555M and Intel HD Graphics 3000), unfortunately the NVIDIA card died a while back so I can only use the slower Intel card. Because it’s such a slow graphics chip I used to set all graphics settings to prefer performance over quality. So I checked to see if that may have caused the blurry icons. I opened the Intel Graphics control panel and set the 3D Preference slider from “Performance” to the middle setting.

Prefer performance setting

Prefer performance setting

Middle performance setting

Middle performance setting

After this, the icons were sharp again ūüôā So I guess the graphics settings were influencing the method in which the icons are rendered.

ARM NEON C++ Cheat Sheet

Newer ARM processors have their own flavor of SIMD instructions called NEON. In my little Android application Arashi, NEON is used a lot to speed up the simulation of particles.

Here is a table explaining some of the NEON functions that are used:

C++ NEON functions
NEON Explanation Pseudocode
vdupq_n_f32(a) New NEON value a
vsubq_f32(a, b) Subtract a – b
vaddq_f32(a, b) Add a + b
vmulq_f32(a, b) Multiply a * b
vmlaq_f32(a, b, c) Multiply and add a + (b * c)
vmlsq_f32(a, b, c) Multiply and subtract a – (b * c)
vrsqrteq_f32(a) Reciprocal square root 1 / sqrt(a)
vcgtq_f32(a, b) Compare greater than a > b ? 1 : 0
vcgtq_f32(a, b) Compare less than a < b ? 1 : 0
vbslq_f32(mask, a, b) Select by mask mask != 0 ? a : b
vminq_f32(a, b) Get minimum a < b ? a : b
vmaxq_f32(a, b) Get maximum a > b ? a : b

Compiling Unreal Tournament 4 from GitHub source

I am just writing down the steps I take to compile Unreal Tournament 4 from the GitHub source and mention any problems I encounter.

If you plan to use these steps as a guide on how to compile UT4 for yourself, I recommend reading through the steps first! I made some mistakes, so make sure you don’t make the same mistakes ūüôā

Prerequisites

  1. TortoiseGit https://code.google.com/p/tortoisegit/
  2. Visual Studio 2013
  3. A GitHub account associated with an Unreal Engine 4 account

Downloading the source

Use TortoiseGit to download all UT and UE4 sourcecode from https://github.com/EpicGames/UnrealTournament.git

Use right mouse button on a folder and choose “Git Clone…”.

 

TortoiseGit

Log in with your GitHub username and password and it will start downloading.

TortoiseGit2

Download additional necessary binary content

Run [UnrealTournament\Setup.bat] to download necessary additional binary content.

SetupBat

 

SetupBat2

Compiling the Unreal Tournament project

  1. Open up [UnrealTournament\Engine\Source\Programs\UnrealSwarm\UnrealSwarm.sln] with Visual Studio 2013.
  2. Select “Development” as the Solution Configuration.
  3. Compile the whole solution, why not.UnrealSwarm
  4. Then you can close the solution.
  5. Run [UnrealTournament\GenerateProjectFiles.bat] to generate UE4.slnGenerateProjectFiles
  6. Open [UnrealTournament\UE4.sln] with Visual Studio 2013.
  7. Set the Solution Configuration to “Development Editor”.DevEditor
  8. Build “ShaderCompileWorker” and “UnrealLightmass”.ProjectsToCompile
  9. When that’s done, compile the “UnrealTournament” project. This can take quite a while.
  10. After it is done compiling, rightclick the “UnrealTournament” project and select Debug > Start new instance.
  11. The UE4 editor will start.
  12. Press “Launch” to start Unreal Tournament. The first time this can take a long time.LaunchBtn
    1. This took like forever, only to be greeted by this error:Error
      LogPlayLevel: Running AutomationTool...
      LogPlayLevel: RunUAT.bat ERROR: Visual studio and/or AutomationTool.csproj was not found, nor was Engine\Binaries\DotNET\AutomationTool.exe. Can't run the automation tool.
    2. Apparently we also needed to compile this “AutomationTool”!
    3. Close the editor, and compile the “AutomationTool” project under “Programs”.
    4. Once again, start the editor and press “Launch”.
    5. Hurrah! More errors:Error2
      LogPlayLevel: Program.Main: ERROR: AutomationTool terminated with exception:
      LogPlayLevel: Program.Main: ERROR: Exception in AutomationTool: AutomationScripts.Automation.dll was not found or could not be loaded, can't run scripts.
      LogPlayLevel: Stacktrace: at AutomationTool.ScriptCompiler.LoadPreCompiledScriptAssemblies(List`1 OutScriptAssemblies) in d:\my_projects\UnrealTournament\Engine\Source\Programs\AutomationTool\ScriptCompiler.cs:line 256
      LogPlayLevel: at AutomationTool.ScriptCompiler.FindAndCompileAllScripts(List`1 AdditionalScriptsFolders) in d:\my_projects\UnrealTournament\Engine\Source\Programs\AutomationTool\ScriptCompiler.cs:line 87
      LogPlayLevel: at AutomationTool.Automation.Process(String[] CommandLine) in d:\my_projects\UnrealTournament\Engine\Source\Programs\AutomationTool\Automation.cs:line 324
      LogPlayLevel: at AutomationTool.Program.MainProc(Object Param) in d:\my_projects\UnrealTournament\Engine\Source\Programs\AutomationTool\Program.cs:line 168
      LogPlayLevel: at AutomationTool.InternalUtils.RunSingleInstance(MainProc Main, Object Param) in d:\my_projects\UnrealTournament\Engine\Source\Programs\AutomationTool\Utils.cs:line 705
      LogPlayLevel: at AutomationTool.Program.Main() in d:\my_projects\UnrealTournament\Engine\Source\Programs\AutomationTool\Program.cs:line 115
      LogPlayLevel: Program.Main: ERROR: AutomationScripts.Automation.dll was not found or could not be loaded, can't run scripts.
    6. Perhaps we also need to compile the “AutomationScripts.Automation” project.
    7. Close the editor, and compile ALL PROJECTS under Programs/Automation, just to be sure.
      Automation
    8. Again, start the editor and press “Launch”.
    9. Now it starts compiling UnrealTournament from within the editor. Once more¬†this will take a while…
    10. After a loooong time, I get this error! ūüôĀError3
    11. I have no idea how to fix this error!
    12. I asked on the forums what the deal is: https://forums.unrealtournament.com/showthread.php?16535-UnrealTournament-exe-incompatible-with-64-bit-windows-(16-Bit-Application)
    13. Apparently you cannot start the game from within the editor (yet).
  13. To start the compiled UT4 game, in the UnrealTournament project, set Command Arguments under Debugging to “unrealtournament -game” and¬†start debugging it!¬†Again,¬†rightclick the “UnrealTournament” project and select Debug > Start new instance.
  14. Hurrahh

References

  1. https://github.com/epicgames/unrealtournament
  2. https://wiki.unrealengine.com/Getting_Started_With_Unreal_Tournament#Building_the_Editor_and_Game
  3. https://code.google.com/p/tortoisegit/
  4. https://forums.unrealtournament.com/showthread.php?16535-UnrealTournament-exe-incompatible-with-64-bit-windows-(16-Bit-Application

 

Open source Skeletal Animation and Software Skinning

tl;dr I wrote a tiny open source skeletal animation and software skinning library for C++: https://github.com/FakeTruth/SkeletalAnimation

Why Skeletal Animations?

Animations can really bring life to projects, that’s why for some projects I am working on I want to have¬†skeletal animation. Looking around on the internet I could not really find an open source solution that did what I wanted. I was looking for something really simple.

ozz-animation

On my Google adventure I came across ozz-animation which I thought would do exactly what I was looking for. A complete package for animating skeletons and software skinning. There was a problem though. This library added tools to convert FBX files to skeletons and animations, and one tool to convert FBX files to a skinned mesh. The mesh however does not contain materials or texture coordinates or any other things you might be interested in, just vertices and normals. The source of the converters also seem really complicated so I was not sure how to add materials and texture coordinates to that. Instead I decided to roll out my own library, which may be useful to other people as well.

My own open source solution

As it turned out, it was really easy to write a library that handles skeletal animation and skinning. Following a simple tutorial that actually included skinning in vertex shaders I was able to write a library that does the skinning on the CPU.

Included in my library is also a converter that converts loaded Assimp scenes to models that can be animated, as well as (de)serialization functions to store and load these models on and from disk.

Why software skinning? Just for the sake of simplicity. I am not looking to animate models with millions of vertices, just simple models which can easily be skinned on the CPU. It is also easier to port to different platforms without worrying about shader languages.

It is really easy to load a model from Assimp:

void LoadModel()
{
    Assimp::Importer Importer;
    const aiScene* pScene = Importer.ReadFile("some_animated_model.fbx",
        aiProcess_LimitBoneWeights |
        aiProcess_Triangulate |
        aiProcess_JoinIdenticalVertices |
        aiProcess_SortByPType);

    AssimpConverter::Convert(pScene, g_AnimatedModel);
}

Then to make the model animate, just call the Update function:

void Update(float a_Dt) // a_Dt is the elapsed time since last frame in seconds
{
  g_AnimatedModel.Update(a_Dt);
}

Rendering the model is very straightforward because you have direct access to the model’s vertices and normals. As an example here is one way how you could render the model with OpenGL.

void Render()
{
    for (unsigned int i = 0; i < g_AnimatedModel.GetNumMeshes(); ++i)
    {
        const SA::sAnimatedMesh& AnimMesh = g_AnimatedModel.GetMesh(i);

        glBegin(GL_TRIANGLES);
        for (unsigned int i = 0; i < AnimMesh.NumIndices; ++i)
        {
            unsigned int Index = AnimMesh.pIndices[i];
            glm::vec3 n = AnimMesh.pNormals[Index];
            glm::vec3 v = AnimMesh.pTransformedVertices[Index];

            glColor4f(n.x, n.y, n.z, 1);
            glVertex3f(v.x, v.y, v.z);
        }
        glEnd();
    }
}

The license I decided to go with is the MIT License, so why not check it out? https://github.com/FakeTruth/SkeletalAnimation

References

  1. https://code.google.com/p/ozz-animation/
  2. http://ogldev.atspace.co.uk/www/tutorial38/tutorial38.html
  3. http://assimp.sourceforge.net/

Qt 5.1.1 with OpenGL for Windows 32-bit Visual Studio 2012

In case you would like to use the latest version of Qt using OpenGL instead of ANGLE in combination with Visual Studio 2012 and target a 32-bit platform you will be disappointed to find out that there are no precompiled libraries available from the Qt-Project website…

Instead of using precompiled libraries you need to compile Qt yourself if you still want to use Qt with Visual Studio 2012.

Requirements

In order to compile Qt you first need a couple of prerequisites, be sure to get the 32-bit versions.

  1. Download and install Python http://www.python.org/getit/ (x86).
  2. Download and install Perl http://strawberryperl.com/ (32 bit).
  3. Download jom http://qt-project.org/wiki/jom.
  4. Download and extract the Qt sources from http://qt-project.org/downloads.
    • You need to find the zip for windows, it’s below all the installer downloads.qtdownload
  5. Copy the jom contents to the Qt sources directory.
  6. Make sure python and perl are accessible everywhere from the commandline by testing “python –version” and “perl -v”.qtcheck

Compiling the Qt sources

  1. Open the Visual Studio 2012 command prompt.
    • It should be located in Start >¬†Microsoft Visual Studio 2012 > Visual Studio Tools >¬†VS2012 x86 Native Tools Command Prompt.
    • Be sure you are opening the x86 version and not the x64 version!
  2. Navigate to the Qt sources directory by using “cd <directory here>”.
  3. Type “configure -developer-build -opensource -opengl desktop -nomake examples -nomake tests”
    • It should ask you to accept the terms of the license.
    • Then it should start configuring the Qt sources for compilation, this will just take a minute.
  4. Finally type “jom” to compile Qt.
    • This can take a long time, around 30-60 minutes depending on how fast your computer is. It took me 50 minutes to compile…

Integrating Qt with Visual Studio 2012

After you compiled the Qt libraries you can install the Visual Studio 2012 Add-in for Qt to make life easier. You can get the Add-in from the downloads page under “Other downloads”:¬†http://qt-project.org/downloads.

In Visual Studio 2012 I pointed Qt to the qtbase directory in the Qt sources directory by going in the Qt Options. Qt5 > Qt Options. Add a new Qt version and select the qtbase directory, pick a suitable name and press OK. Use this Qt version in your project and you should be able to compile for 32-bit platforms.

References

  1. http://zulis.blogspot.nl/2013/03/compiling-qt-501-with-visual-studio-2012.html
  2. http://stackoverflow.com/questions/15826893/downloading-and-integrating-qt5-with-visual-studio-2012
  3. http://qt-project.org/downloads

Create something like the Widget Box as in the Qt Designer

Widget Box

Widget Box

Widget Box

There is something called the Widget Box in the Qt Designer. It contains a list of widgets separated by categories. Each category button can be clicked in order to expand and collapse the list below the button.

You might want something like the Widget Box for one reason or another, to display your own collapsible list of items.

Tree Widget

In my approach in recreating the Widget Box I used a Tree Widget because it already has the basic idea of expanding and collapsing items in the list to display and hide its child widgets. The gist of turning the Tree Widget into a Widget Box is adding buttons as top level items and adding a frame with a layout as the child of those top level items. The button should then expand and collapse its own Tree Widget Item when clicked to display and hide the contents of a category. The button will require a custom class inheriting the QPushButton class in order to expand and collapse the Tree Widget Items.

You might want to disable root decoration and set indentation to 0 on the Tree Widget to turn it into a flat list. The custom button type is named QtCategoryButton in this snippet.

MyApplication::MyApplication(QWidget *parent, Qt::WFlags flags)
	: QMainWindow(parent, flags)
{
	ui.setupUi(this);

	ui.treeWidget->setRootIsDecorated(false);
	ui.treeWidget->setIndentation(0);

	// First category
	{
		QTreeWidgetItem* pCategory = new QTreeWidgetItem();
		ui.treeWidget->addTopLevelItem(pCategory);
		ui.treeWidget->setItemWidget(pCategory, 0,
			new QtCategoryButton("Category 1", ui.treeWidget, pCategory));

		QFrame* pFrame = new QFrame(ui.treeWidget);
		QBoxLayout* pLayout = new QVBoxLayout(pFrame);
		pLayout->addWidget(new QPushButton("Btn1"));
		pLayout->addWidget(new QPushButton("Btn2"));

		QTreeWidgetItem* pContainer = new QTreeWidgetItem();
		pContainer->setDisabled(true);
		pCategory->addChild(pContainer);
		ui.treeWidget->setItemWidget(pContainer, 0, pFrame);
	}

	// Second category
	{
		QTreeWidgetItem* pCategory = new QTreeWidgetItem();
		ui.treeWidget->addTopLevelItem(pCategory);
		ui.treeWidget->setItemWidget(pCategory, 0,
			new QtCategoryButton("Category 2", ui.treeWidget, pCategory));

		QFrame* pFrame = new QFrame(ui.treeWidget);
		QBoxLayout* pLayout = new QHBoxLayout(pFrame);
		pLayout->addWidget(new QPushButton("Btn1"));
		pLayout->addWidget(new QPushButton("Btn2"));

		QTreeWidgetItem* pContainer = new QTreeWidgetItem();
		pContainer->setDisabled(true);
		pCategory->addChild(pContainer);
		ui.treeWidget->setItemWidget(pContainer, 0, pFrame);
	}
}

Custom button

The custom button is a quite simple class, all it does it catch the pressed() signal and expands or collapses the Tree Widget Item it is bound to.

class QtCategoryButton : public QPushButton
{
	Q_OBJECT
public:
	QtCategoryButton(const QString& a_Text, QTreeWidget* a_pParent,
		QTreeWidgetItem* a_pItem);

private slots:
	void ButtonPressed();

private:
	QTreeWidgetItem* m_pItem;
};

 

QtCategoryButton::QtCategoryButton( const QString& a_Text,
		QTreeWidget* a_pParent, QTreeWidgetItem* a_pItem )
	: QPushButton(a_Text, a_pParent)
	, m_pItem(a_pItem)
{
	connect(this, SIGNAL(pressed()), this, SLOT(ButtonPressed()));
}

void QtCategoryButton::ButtonPressed()
{
	m_pItem->setExpanded( !m_pItem->isExpanded() );
}

Finally

Custom Widget Box

Custom Widget Box

If everything went well you should get something like this. You can of course use any other widgets, not just buttons.

Getting started with Google Play Game Services

Introduction

As I am writing this I am simply noting down the steps I take to get Google Play Game Services to work. I am following this tutorial along with a lot of Googling https://developers.google.com/games/services/android/quickstart

Requirements

  1. Android (Google Play) Developer Account.
  2. Eclipse all set up to work with the Android SDK.
  3. A keystore for signing your apps.
  4. The Type-A-Number Challenge project https://developers.google.com/games/services/downloads/#samples.
  5. Google Play services SDK https://developer.android.com/google/play-services/setup.html.

Import the Google Play services library

Import the Google Play services library project code into your Eclipse workspace.

  1. File > Import > Android > Existing Android Code Into Workspace.
  2. Locate the Google Play services library. Mine was in C:\Program Files (x86)\Android\android-sdk\extras\google\google_play_services\libproject\google-play-services_lib.
  3. Be sure to select the Copy Projects into workspace option.

Import the sample projects

Import the TypeANumber and BaseGameUtils projects code into your Eclipse workspace.

  1. File > Import > Android > Existing Android Code Into Workspace.
  2. Locate the sample projects you downloaded earlier and import them both.
  3. I used the Copy Projects into workspace option for these projects as well. Later I found a problem when I did not do this, I think it is because some projects were located on a different drive and Eclipse (or the Android SDK) had problems with that.
  4. Tell both projects to use the google-play-services_lib project as a library by going in the project properties > Android and add it to the list of libraries.

Errors

At this point I got a whole bunch of errors in Eclipse with this error at the top.

AppStateClient cannot be resolved to a type

Most of the errors came from the BaseGameUtils project. To fix this I simply hovered over the error in the code and selected “Fix project setup…” and *poof* all my BaseGameUtils errors were gone.

There were still two errors left from the TypeANumber project but I simply used the same solution, hover over the error and select “Fix project setup…” it would then add references to the¬†google-play-services lib and jar files.

Perhaps I did something wrong, you might not get these errors since I fixed the above steps after figuring some problems out.

Change the package name

According to the tutorial I should now change the package name of the TypeANumber project in its AndroidManifest.xml file. I changed com.google.example.games.tanc into com.fktrth.typeanumber.

A lot of errors about ‘R’ not being able to be resolved to a variable popped up since I also had to change the package name in the code itself. Then I looked up all the incorrect imports of¬†com.google.example.games.tan.R and changed it to the correct one com.fktrth.typeanumber.R. This fixed all the remaining errors.

Google Play Developers Console

Now we have done a part in Eclipse now it is time to continue on the Developers Console side by following this tutorial https://developers.google.com/games/services/console/enabling#step_2_add_your_game_to_the_dev_console.

  1. Go to the Game services tab.
  2. Accept all the terms and conditions and stuff.
  3. Press the big button in the center of the screen to add a new game.
  4. Select that you are not using Google API’s in your game yet.
  5. Use “Type-a-Number Challenge” as the name of your game.
  6. Select puzzle game and press continue.

Generate OAuth 2.0 key

Following this tutorial I will generate an OAuth 2.0 key https://developers.google.com/games/services/console/enabling#step_3_generate_an_oauth_20_client_id.

  1. Press the “Linked apps” tab (the second from the top).
  2. Choose to link an Android app.
  3. Enter the package name from the AndroidManifest.xml file “com.fktrth.typeanumber”
  4. Press “Save and continue”.
  5. Then authorize the app by clicking the button in step 2.
  6. I ignored all settings in the window that popped up (name, logo and site URL) and pressed continue.
  7. Now you need to enter a Signing certificate fingerprint in the form of a SHA1 hash.
    1. Use a command prompt window and navigate to your keystore’s location
    2. Type “keytool -exportcert -alias [KeyAlias] -keystore [KeyStoreLocation] -list -v
    3. It should print out some info along with a SHA1 hash. Enter this hash in the field in the Developers Console.
    4. You can also use a debug certificate by finding the debug.keystore file. For me it was located in C:\Users\[UserName]\.android
    5. Then type “keytool -exportcert -alias androiddebugkey -keystore [KeyStoreLocation]¬†-list -v”. When asked for a password just press enter so you enter an empty password.
  8. After entering the certificate fingerprint press “Create client”.
  9. You should get an Application ID now, you need to enter this in one of the resources of your game project later.

Add some achievements and leaderboards

Now that is all done I will add a couple achievements like the tutorial suggests along with two leaderboards

Test accounts

Press the Testing tab to add testing accounts. When your app is not published yet only those accounts can log in and use the Google Play Game Services so make sure to add the account you use. For me my account was already added because I use the same account for my developer account as for playing games.

Add Application ID to the source

After generating and entering the OAuth 2.0 key you should have gotten an Application ID. You need to add this ID in res/values/ids.xml of your game project. Enter your Application ID in the app_id field of the ids.xml file. Also fill in all the achievement and leaderboard IDs. This should be easy enough.

Running the game – or so I hoped

When all of that was done it seemed like it was time to actually run the game on my tablet and see if it works. Unfortunately the app immediately crashed. Looking in my console log I found the error

Could not find google-play-services_lib.apk!

A quick look on Google found this page¬†http://stackoverflow.com/questions/16756561/android-could-not-find-google-play-services-lib-apk-error. Apparently the automagic “Fix project setup…” of Eclipse screwed up some settings for Android and I had to remove a project from the build path of the game project. However this created some more errors. After some thinking I remembered I had this problem before when using library projects. Apparently Android could not link properly to the¬†google-play-services_lib project and I think it is because it is not located on the same drive as my workspace (the library is on C and my projects and workspaces are all on D). To fix this problem I re-imported all projects with the option “Copy Projects into workspace” selected.

After that was fixed the game still crashed. I found this post on Stack Overflow http://stackoverflow.com/questions/16595225/initializing-games-client-in-android which said I should enter my Application ID. I forgot to do that step so I entered all the IDs I could find and the app could finally run without crashing!

Really running the game!

Finally I could run the game! Signing in worked, it was pretty exciting. All the achievements and leaderboards worked.