libgdx and Kotlin – Classes [2D Platformer Prototyping]

This post is a follow up of the libgdx and Kotlin post.

I have decided to prototype a simple 2D platformer (along the lines of Star Assault from my early posts), but instead of Java, I am using and learning Kotlin along the way.

For this tutorial, the project should be in its initial state from the previous post. A bare-bone libGdx Java project turned into a Kotlin project. We’ll be jamming away in our main Game.kt file, formerly Nemo.kt.

The project source for the initial state can be found here.

Kotlin doesn’t require the file name to be the same as the class name, or even to be in the directory structure equivalent to the declared package.

Without further ado, here’s is the first change to the code.
Read more…

LinkedInRedditTumblrDiggTechnorati FavoritesShare

libGDX and Kotlin

Using libGDX with Kotlin

I’ve been reading lately about different languages and what they can bring to the already crowded table of software developers, and one language stood out for me: Kotlin. (

It’s a relatively new language (est. 2011) and these are just a few reasons why I picked it over the multitude of other more mature languages:

  • Runs on the JVM and has full Java interoperability
  • It’s neither a pure OO nor functional language, it accommodates both styles naturally
  • It supports procedural programming with the use of functions
  • It has type inference and support for both nullable and non-nullable datatypes
  • Its syntax is lovely, especially the Pascal style variable declarations (data types come after the variables)
  • It is very concise and I found code written in Kotlin to be very readable

Read more…

LinkedInRedditTumblrDiggTechnorati FavoritesShare

Game AI – An Introduction to Behaviour Trees

Game AI is a very broad subject and while there is a lot of material out there, I didn’t find something that introduces the concepts gently and at a slower, more understandable pace. This article will try to explain how to design a very simple but extendable AI system loosely based on the concept of Behaviour Trees.

What is AI?

Artificial Intelligence is the human-like behaviour exhibited by the entities participating in the game. It’s more the illusion of intelligence and thoughtful action performed by the entities than an actual intelligent reasoning driven behaviour. The goal is to try to fool the player into thinking that the other “intelligent” entities are controlled by humans and not by a machine. It’s easier said than done, but we can use a lot of tricks to achieve some really good, seemingly random and “intelligent” behaviours.
Read more…

LinkedInRedditTumblrDiggTechnorati FavoritesShare

Hiatus – The End?

It’s been an unbelievably long time since I wrote or did anything. A lot of things happened in my life lately which kept me away from blogging but my desire to make a game just got bigger.

As most of you noticed, I focused a lot on the libgdx library and even that went through a lot of changes. It recently hit version 1.0 which is amazing news, so go get it while it’s hot. This also means more stability, consistency and the things that are written for it are likely to stay the same and not change. My libgdx related entries need a good refresh and I am pondering if is it worth the effort or I should just migrate everything to the latest version and carry on with Star Assault editing the existing posts with a reference to the new setup and changes.
Read more…

LinkedInRedditTumblrDiggTechnorati FavoritesShare

Getting Started in Android Game Development with libgdx – Tutorial Part 4 – Collision Detection

This is the fourth part of the libgdx tutorial in which we create a 2d platformer prototype modeled after Star Guard.
You can read up on the previous articles if you are interested in how we got here.

Following the tutorial so far we managed to have a tiny world consisting of some blocks, our hero called Bob who can move around in a nice way but the problem is, he doesn’t have any interaction with the world. If we switch the tile rendering back we would see Bob happily walking and jumping around without the blocks impending him. All the blocks get ignored. This happens because we never check if Bob actually collides with the blocks.

Collision detection is nothing more than detecting when two or more objects collide. In our case we need to detect when Bob collides with the blocks. What exactly is being checked is if Bob’s bounding box intersects with the bounding boxes of their respective blocks. In case it does, we have detected a collision. We take note of the objects (Bob and the block(s)) and act accordingly. In our case we need to stop Bob from advancing, falling or jumping, depending with which side of the block Bob collided with.
Read more…

LinkedInRedditTumblrDiggTechnorati FavoritesShare

Getting Started in Android Game Development with libgdx – Tutorial Part 3 – Jumping, Gravity and improved movement

This is the third part in the Building a Game with LibGdx series. Make sure you read the previous articles to build a context for this one.

In the previous article we have animated Bob’s movement, but the movement is quite robotic. In this article I’ll try to make Bob jump and also move in a more natural way. I will achieve this by using a little physics. I will also clean up the code a little and fix some issues that crept into the code in the previous articles.

Read more…

LinkedInRedditTumblrDiggTechnorati FavoritesShare

Getting Started in Android Game Development with libgdx – Tutorial Part 2 – Animation

This is the second part of the Building a Game with LibGdx series. Make sure you read the first part before starting on the second.

There will be a lot of stuff covered in the following articles so I will try to break them down in more digestible sizes.
We left off with a basic world and Bob gliding back on forth when using the arrow keys or touching the screen.
Read more…

LinkedInRedditTumblrDiggTechnorati FavoritesShare


It’s been almost a year since the last post and I don’t really know where the time did go to be honest.
The good news is, that I am planning to add some new material pretty soon.

My focus will be on more libGdx and game theory which will be framework agnostic. I will try to work closely with folks who make learning really easy and will work out a nice roadmap that is achievable with my shrinking free time to provide quality material to share my findings and hopefully one can benefit from.

Keep Calm

LinkedInRedditTumblrDiggTechnorati FavoritesShare

Getting Started in Android Game Development with libgdx – Create a Working Prototype in a Day – Tutorial Part 1

In this article I will take a detour from the building blocks of a game engine and components and I will demonstrate how to prototype a game quickly using the libgdx library.

What you will learn:

  • Create a very simple 2D shooter platformer game.
  • What a complete game architecture looks like.
  • How to use 2D Graphics with OpenGL without knowing anything about OpenGL.
  • What different entities make up a game and how they are tied together in a game world.
  • How to add sound to your game.
  • How to build your game on the desktop and deploy in onto Android – yes, it’s that magic.

Read more…

LinkedInRedditTumblrDiggTechnorati FavoritesShare

Building Games Using the MVC Pattern – Tutorial and Introduction

One useful architecture pattern in game development is the MVC (model-view-controller) pattern.
It helps separate the input logic, the game logic and the UI (rendering). The usefulness is quickly noticeable in the early stages of any game development project because it allows to change things quickly without too much rework of code in all layers of the application.
Read more…

LinkedInRedditTumblrDiggTechnorati FavoritesShare