Setting up the project

The first few tutorials will work like this: we’ll provide you a sample project, and explain the various aspects of how it works.

From there, we’ll guide you through building new features and enhancements on to the game.


We have written a little helper project, which you can find at It contains a template layout for setting up a Libgdx application, as well as various utility functions.

We install this via gradle, which you will need on your machine. Once you have got that, run the following commands:

git clone
cd MyGdxClasses
gradle install

Getting the source code

We are assuming you’re familiar with Git. To directly check out the example project, run the following command:

git clone -b Base_project

This checks out a specific branch for just the Base_project – in future we’ll check out different branches to see different examples.

Android Studio

We created this tutorial in Android Studio, and all examples are going to assume that is your IDE, but in reality most stuff should be the same with other IDEs. This may vary when it comes to exporting the project to Android or iOS.

We’re assuming you have Java set up properly on your machine – this tutorial isn’t going to cover that.

Once you’ve checked out the code and opened Android Studio, choose ‘Open an Existing Android Studio project’ and locate the project.

Run configurations

Start the game by opening the file ‘Desktop Launcher’ and Run. This will probably fail first time, but that’s just because we haven’t set up the run configuration yet. Click the down arrow next to ‘DesktopLauncher’ to open it up.

Screen Shot 2016-07-09 at 18.37.38

Make sure you have the following settings:

Main class:

Working directory:[path]/zombiegametutorial/android/assets/

(for example, on my Mac the path is /Users/dave/git/zombiegametutorial/android/assets/)

Use classpath of module: Desktop

Now try running the game again. If all has been set up correctly, you should see something which looks a bit like this:

Screen Shot 2016-07-09 at 18.41.33

If you see this – success!

What am I looking at?

This is the base project, which is just a randomly-generated map. At the moment, there’s not much you can do here. Try navigating around with the arrow keys, try zooming in and out with the Z and X keys.

Also – try pressing R to regenerate the map. Neat eh?

Why does it look so crap?

We haven’t provided any logic for drawing edges properly, so it looks quite blocky at the moment. You can decrease the ‘blockiness’ by changing a couple of parameters.

Open up and look for:

float viewWidth =32;

Try changing the value to something bigger, and you can see the effect. Have a play around with the other variables in there and see what happens. You can make it look like this:

Screen Shot 2016-07-09 at 18.51.59

Why wouldn’t you just make it really high-definition? Well, further down the line we’re going to introduce some path-finding. Each block on the map is a node, and the higher number of nodes, the slower it is going to be to generate paths. This is a real issue we came across when creating Dinowar, so we had to find a balance between the detail of the map and the speed of path-finding on a mobile device.

But in the end, you can make the map look a lot better by drawing edges properly:

If you like these tutorials, or want to see a game that was written in much the same way, please download Dinowar from the Google Play Store. It costs nothing and is ad-free.

5 thoughts on “Setting up the project”

  1. I am getting this error in Android Studio: “Failed to resolve com.boondog.imports:core:0.1.0-SNAPSHOT” in my android/build.gradle and core/build.gradle files. How to resolve those? Thanks.

  2. Thanks Dave. Sorry for the late reply but, yes, that worked…I see that you’ve already incorporated that in the post. Another thing, in, on line 45, shouldn’t it be “assets_general + images” instead of “assets_general + tiles”?

    Thanks again for the tutorials. Keep ’em coming!

    1. Yes you are correct, thanks for pointing that out. I realised I’ve made the same mistake in most of the project branches and corrected them all. On line 28 I’ve had boolean packTextures = false for ages (it makes it quicker to launch – you don’t need to create the atlas every time, only if something changes) and so I hadn’t noticed. Woops! Have you got it running successfully now?

Leave a Reply