Tag2D

Introduction to AndEngine – Getting the code

In this series I will tell you how to use one of my favorite Android 2D Game Engines, AndEngine. We will go step by step through the processes, starting at simply getting the code, continuing with drawing sprites, using cameras, physics and so on.

AndEngine was started by Nicolas Gramlich as part of his Bachelor’s thesis in the beginning of 2010. It is an engine that provides lots of powerful features while hiding more advanced things like Open GL calls from the developer. It provides lots of extensions like a  Robotium extension, a Box2D extension, which is mostly written and maintained by badlogicgames‘ Mario Zechner for his libGDX-project, a SVG extension or a TMX tiled maps extension.

It has been used in various featured games like Greedy Spiders, Noogra Nuts or Zynga’s Dream Zoo.

Let’s get started.

 

Getting the code

At the very beginning you’ll need to download the most recent version of AndEngine. To do that, open your console, go to the directory of your choice and do a git clone of the engine by typing

git clone git://github.com/nicolasgramlich/AndEngine.git

That’s all. You now have a powerful game engine, ready to be used on your computer or mobile device.

Now here’s a story: When AndEngine was written, the author had to make a choice: did he want to write lots of useful code or lots of useful documentation? He chose the more fun part and that’s why AndEngine provides little to no documentation, which is one of its most frequent points of criticism. However, the source is all open, you can read it, change it, do whatever you like with it. There are the AndEngine forums and Nicolas tries to write the code in a way that it’s documenting itself.

In order to provide the developers an idea of what AndEngine can do, the AndEngine samples were created. You can get them by also cloning the git repository:

git clone git://github.com/nicolasgramlich/AndEngineExamples.git

As you can now see there are a lot of dependencies to the different extensions. Go ahead and clone them:

git clone git://github.com/nicolasgramlich/AndEngineAugmentedRealityExtension.git
git clone git://github.com/nicolasgramlich/AndEngineLiveWallpaperExtension.git
git clone git://github.com/nicolasgramlich/AndEngineMODPlayerExtension.git
git clone https://github.com/nicolasgramlich/AndEngineMultiplayerExtension
git clone https://github.com/nicolasgramlich/AndEnginePhysicsBox2DExtension
git clone https://github.com/nicolasgramlich/AndEngineSVGTextureRegionExtension
git clone https://github.com/nicolasgramlich/AndEngineTexturePackerExtension
git clone https://github.com/nicolasgramlich/AndEngineTMXTiledMapExtension

Now you have a lot of code. Import them into your IDE of choice. Your workspace should now look something like this:

Let’s start a look at the examples. Connect your device or start an emulator with GPU emulation and run the AndEngineExamples on it.

AndEngine physics example

AndEngine physics example

What you will find is an overview over AndEngine’s many features.

There are two important branches of AndEngine: The GLES2-branch and the GLES2-AnchorCenter branch. Since the latter will become the main branch soon, it is recommended to pull its code too. To do so, just go into each of your AndEngine-projects using your shell and execute

git pull origin GLES2-AnchorCenter

You might want to switch to this branch now by executing

git checkout -b GLES2-AnchorCenter origin/GLES2-AnchorCenter

Now take your time to play, take a look into the code and look forward to the next part of this series in which we will go through the basic parts of the engine.

 

If you are having problems compiling any of AndEngine’s code or issues cloning the repositories, please post a comment.

Wanted: Beta Tester

ANDLABS will soon release a new, terrific 2D game for the Android platform (of course). For this game, we need beta testers. I can’t tell you much about the content, but four things are for sure:

  • It’s an absolutely new concept
  • If you like tower defense games, you will love it
  • If you like physics games, you will love it
  • The beta test will start in the period of mid to end of August.

So if you are interested: Good choice! Just leave your e-mail-adress in the comments (I will delete it before approving your comment).

Thank you very much, I’m convinced you will like this game.

Edit: already 10 sign ups here plus two on G+. You guys are great!

AndEngine

This is a really short post because it is basically a recommendation, not a tutorial.

In the last year I spent some time on game development on Android, especially on for 2D games. About a year ago, a friend of mine, Nicolas Gramlich, also known as plusminus, the creator of anddev.org, published his free, open source 2D game engine called AndEngine. The engine is OpenGL ES-based and uses the Box2D library by Mario Zechner for physically correct animation of sprites.

Since the last year, the engine grew and improved with an astonishing speed, mainly because of Nicolas’ great commitment to the project. I think today it is the most used 2D game engine for Android. This is probably because of it’s great design and quality, which makes great games easy to create.

Some games you might know that use AndEngine are:

  • Wheelz
  • Chalk Ball
  • Farm Tower

While the latter, Farm Tower, is by Nicolas himself. It is great fun for all ages and free, so if you want to support him, please download this game (but beware: it’s addicting).

So, to put the article into one sentence: If you want to develop a 2D game for Android devices, AndEngine probably is your way to go!

Farm Tower (Christmas edition)

Farm Tower (Christmas edition)

© 2024 Droid-Blog

Theme by Anders NorenUp ↑