New Project started: Tower Defense Game for Android

Last weekend I started a new Project. I am now developing a Tower Defense game for Android. It will be a classic Tower defense game, where the enemies will walk predefined paths in multiple waves. Your task as the player is to stop them to reach your Castle by placing defending towers on the map. Until now I haven’t found a proper name for the game – but this will follow soon.

This time I’ll use the Andengine Game Engine and will share my experiences here in the blog.

 First Steps

Even if the start was a bit difficult, because of the way Andengine works with textures and Atals objects, the first impression on Andeninge is very good. A lot of functionality that I had to work on for long times in e3roid are already available in Andengine (e.g. letting an enemy walk along a predefined path). This will reduce the development time a lot.

 What’s done so far

Here you see a first screen-shot, where you see some enemies and defending towers. The graphic is still draft, especially the level design, as it’s mainly build to code and check the logic.

Letztes Wochenende habe ich ein neues Projekt gestartet. Ich habe begonnen ein Tower Defense Spiel für Android zu entwickeln. Bei dem Spiel wird es sich um ein klassisches Tower Defense handeln, bei dem die Gegner vordefinierten Wegen folgen. Deine Aufgabe als Spieler ist es mit Verteidigungsanlagen, die Ihr kaufen könnt und auf der Karte platziert die Gegner davon abzuhalteneuer Schloss anzugreifen. Noch ist kein Name für das Spiel gefunden, aber der wird sicher bald folgen.

Bei der Entwicklung werde ich nun die Game Engine Andengine nutzen und meine Erfahrungen damit hier teilen.

Use of Wakelok and Stand-By in Android Games

When to suppress the Stand-By Mode in Games?

This depends on the kind of game you want to develop. If the player has to interact with the game constantly or if he only has a limited time to draw, the stand-by mode usually doesn’t need to be disabled.

It’s relevant to disable the stand-by mode only in video-or demonstration modes, when the player doesn’t need to interact at all for a certain time. It’s more important, how the game reacts on the stand-by mode. It’s the best solution if a game automatically switches to the pause-menu on a stand-by, where the player can easily resume the game.

How to suppress the Stand-By Mode?

You use so called “Wakelocks” to suppress the stand-by mode on a Android Phone. Here I show you a sample implementation using the game-engine e3roid. It’s very important to release the Wakelock before exiting the game.


You need to request the nessesary permision:

<uses-permission android:name="android.permission.WAKE_LOCK" />

Main Class:

public class StoneSetter extends E3Activity {
private PowerManager.WakeLock wl;
public E3Scene onLoadScene() {
   PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
   wl = pm.newWakeLock(PowerManager.FULL_WAKE_LOCK, "SomeTag");
public boolean onKeyDown(E3Scene in_scene, int keyCode, KeyEvent event) {
if((keyCode == KeyEvent.KEYCODE_MENU || keyCode == KeyEvent.KEYCODE_BACK)){
   return true;
   return false;
public void exitGame(){

Game Development Considerations

If you want to develop a game, you have to think first about the genre to develop the game for. Should it be a puzzle game / board game or an action game? After answering this question you have a lot of follow up questions to answer.

If you choose an action game (Jump&run) you have to take care of a lot more things than in a turn based game. You always have to take care that your programming is really performant, to achieve high frame rates. In a turn-based-game it’s less important as the user usually doesn’t notice if a calculation takes a little longer. A good overview on this topic is documented in this article, which is unfortunately only available in German language: Real Time vs Turn Based Games.

My first Android-Game-Project was such an Action Game. But the performance itself wasn’t the biggest problem for me (after I found some good 2d Game Engines). The biggest problem has been the level design, which take a large amount of time. That is why I postponed this project. After the start phase the level design took up about 80% of the development time.

Sample of my first Project(Graphics mainly from – a really good source for grafics and more)

Continue reading

e3roid example: Score handling – displaying the score

Something nearly every classic game needs, is the display of a score. A simple text doesn’t look “game like” – so a normal “textsprite” wasn’t my choice for displaying the score.

In this article you find my implementation a score-display class for e3roid based on animated sprites. I could also have used “TiledSprites”, but I still have the vision of letting the numbers change with animation – but I haven’t started implementing this yet.

To use the source code below you first need a e3roid body. Best is to extend the code of the Tutorial “Handle touch events” on the e3roid-page. If you follow the instructions below, the course will be increased with each touch-action.

Here you see how a sample coding could look like:

Continue reading

Game Engines: Including the the first game elements in my Android project

The next step after setting up an Andorid project was to include the first game relevant elements into a prototype. The target is to put multiple moving or animated graphics (sprites) and paint them into a canvas that will regularly be displayed on the screen. To accomplishing this, a nice class hierarchy has to be created to easily handle and organize sprites.

By coincidence i stumble over two freely useable 2d game engines, which handle exactly these topics – and even more. I have had a detailled look at both engines. Here you find a short summary of my experiences, that I’ve made with these engines:


E3roid is a relatively easy to learn 2d game engine for the Android. There are a lot of example source code available that perfectly describes the way to use the engine. There is a good Tutorial in the e3roid-Blog available, which makes the start even more easy.

Basic functionality is in addition to sprites and animated sprites also an easy menu-function and the support for so called “Tiled-Maps”, which helps you in building game-worlds quite easy.


Andeninge is, like e3roid, a 2d game engine for Andorid. The engine seems to be more difficult to understand as e3roid. Many functionalities are quite similar to e3roid (because e3roid is been inspired by Andengine in some places). But it’s not only more difficult, but also looks more professional and complete than e3roid. Additional functions in Andeinge are for example: Audiosupport, a* (a-star) algorythm for path-finding on tiled maps, and a multi-touch onscreen controller.

The Andengine-Community is very active, so that you can quickly find solutions for your problems or get some inspiration by others.

My conclusion:

Who prefers to have a quick start should have a look at e3roid. You can have nice results within a short time. Especially if you are new to the topics, I’d really recommend to use this engine.

If you prefer the more professional way and you require a more complete game engine, you should prefer to use Andengine. The more difficult start-phase will soon be rewarded when more complex questions arise.