Beginning Android game programming with libGdx

Since I now have had an Android smartphone (Galaxy S2) for a few weeks, I decided to try developing apps for it. Games, to be precise. I looked around the web for game development libraries for Android and discovered libGdx. It is a cross-platform game development API written in Java and uses OpenGL for graphics. I decided to implement the classic rotating cube as my first Android app. I followed this video tutorial and after a while, this was the result:

Probably the most difficult part to date was figuring out how to get the app to my device (phone). The Eclipse ADT plugin has a device chooser dialog, but my device was not listed in it and thus it could not upload the app to my device. After a bit of googling, I found out that I needed to check the USB debugging option (to enable USB debugging) in the Applications -> Development menu in my phone. Quite counter-intuitive option, I think…

So, now that I have an overview of the basics, I will look into developing an actual game, something 2D for starters!


Overview of my past programming projects

This post is an overview of my past programming projects that I have completed. I consider myself an advanced Java and C/C++ programmer (I do know web programming and design as well) and I like to program graphical applications and games, since they give immediate visual feedback of the programming progress and they are just fun to make.

Java 3D: Rubik’s Cube

Since I like 3D graphics so much, I’ve always wanted to program a 3D game from scratch. In the beginning of 2007 (can’t remember exactly, silly brain!) I decided to try out Java 3D and create a Rubik’s Cube solving game. I’m not very good at solving the cube in real life, I’ve only solved it a few times altogether but that doesn’t mean I couldn’t create a simple game about it.

So, I researched the ways one can do 3D in Java and found this library called LWJGL (Lightweight Java Game Library) which uses OpenGL to render 3D graphics. LWJGL is not a game engine, it just enables the developers to get access to 3D graphics, input and sound to write their own game code.

It can’t say much about the experience writing the game with LWJGL since it was quite a long time ago and I don’t remember the particulars any more (silly brain is silly again). I do remember that getting the whole thing up and running was not as hard as I imagined.

Download the source code and binaries (currently for Windows only) here: RubiksCube.zip (3 MB)


Java: Kalah

In University, I took a course called Artificial Intelligence (AI) which was an introductory course to AI and had home assignments where we had to program various games and use some AI method for the game logic. One of those games was Kalah, and my version used ther Minimax algorithm. The graphical user interface is made with Swing and the graphics is made by me. The interface text is in Estonian.

Download the Kalah game binaries and source code: AI-Kalah.zip (376 KB)


Java: Traveling Salesman Problem

Another AI project, where we had to solve the Traveling Salesman Problem. My solution is quite dumb, basically it is a simple heuristical search, where the tour of the cities is calculated by alwasy traveling to the nearest not yet visited city. I guess I put more effort into the graphics than into solving the problem itself, nevertheless I got max points to the assignment. The program uses Swing to draw graphics and the interface is in Estonian again.

Download the source code: TravelingSalesman-
Source.zip
(4.6 MB)


Java: Noughts and Crosses

Yet another AI project, a classic Noughts and Crosses (Tic-tac-toe) game. I guess this one does not need any comments. Built similarly as the previous AI games.

Download the source code: NoughtsAndCrosses.zip (113 KB)


C++: Card games BlackJack and Video Poker

In my C++ course in University, I had to make card games as the course final project. They had to be graphical games and had to use the Allegro Gaming Library. So, the result was a library that supported building card games and two games – Poker and BlackJack – realized using that library. This was my first 2D game written in C++, I had only created simple OpenGL 3D apps before. The game uses only keyboard and the interface is again in Estonian.

Download the source and executables (Windows only): CardGames.zip (5 MB)

This concludes the overview of some of my programming projects. There are of course other projects that I have developed as well, but I consider them less worthy for this post.


Java: Noughts and Crosses

Yet another AI project, a classic Noughts and Crosses (Tic-tac-toe) game. I guess this one does not need any comments. Built similarly as the previous AI games.

Download the source code: NoughtsAndCrosses.zip (113 KB)


Java: Traveling Salesman Problem

Another AI project, where we had to solve the Traveling Salesman Problem. My solution is quite dumb, basically it is a simple heuristical search, where the tour of the cities is calculated by alwasy traveling to the nearest not yet visited city. I guess I put more effort into the graphics than into solving the problem itself, nevertheless I got max points to the assignment. The program uses Swing to draw graphics and the interface is in Estonian again.

Download the source code: TravelingSalesman-
Source.zip
 (4.6 MB)


Java: Kalah Game

In University, I took a course called Artificial Intelligence (AI) which was an introductory course to AI and had home assignments where we had to program various games and use some AI method for the game logic. One of those games was Kalah, and my version used ther Minimax algorithm. The graphical user interface is made with Swing and the graphics is made by me. The interface text is in Estonian.

Download the Kalah game binaries and source code: AI-Kalah.zip (376 KB)