And Engine is the Open Source Android 2D OpenGL Game Engine created by Nicolas Gramlich. This post gives the steps for getting started with this cool game engine if you are keen on developing killer games for the world.
If you are already developing in Android then you probably have Eclipse. The entire source code for AndEngine has been moved to the Github. So the first thing you need to do is to get the Eclipse Git plugin. To do this open Eclipse and select Help-> Install New Software and type in http://download.eclipse.org/egit/updates in the Work with text field and hit enter. You should see the following
Since I was on Linux I chose only EGit. If you are on Windows you will also have to probably install the Win32 plugin. Once this installed close Eclipse and open it again. Now you will have to clone all the AndEngine’s code from Github. The site is AndEngine Site.
Now all the AndEngine source has to be cloned along with the set o AndEngine Examples from this site.
To do this select File->Import->Git->Projects From Git and click Next.
Select URI from the next screen and select Next.
In the Source Git Repository screen enter the URI for each of the AndEngine files and extensions as shown below
Click Next. Choose all the default settings for all the next few screens. This will create a copy of the contents of the folders for each of the AndEngine code. Repeat the step for the AndEngine and all of its extensions
The list is as below
- AndEngine
- AndEngineAugmentedRealityExtension
- AndEngineLiveWallPaperExtension
- AndEngineMODPlayerExtension
- AndEngineMultiplayerExtension
- AndEnginePhysicsBox2DExtension
- AndEngineRobotiumExtension
- AndEngineScriptingExtension
- AndEngineScriptingExtensionGenerator
- AndEngineSVGTextureRegionExtension
- AndEngineTexturePackerExtension
- AndEngineTMXTiledMapExtension
Once you have cloned all of the above you will need to build each of them individually. Make sure you perform the following
- Select Project->Properties->Java Compiler. Check the ‘Enable project specific settings’ and choose compiler compliance level as 1.6
- Select Project->Properties->Android and choose Android 4.2 API level 17
- Select Project->Properties->Android, click Add button under Library and add AndEngine and other libaries AndEnginePhysicsBox2DExtension etc.
And then build the project. It should build cleanly. I did get some errors as mentioned below. A lot of time I clicked ‘Fix project’ or ‘organize imports’ and the issues went away. Anyway here are the main issues I faced
In AndEngineRobotiumExtension for the AndEngineSolo.java I had to fix the imports. The imports were erroneously showing up as org.anddev….. I had to replace it with the following
Replace
import org.anddev.andengine.engine.Engine;
import org.anddev.andengine.engine.camera.Camera;
import org.anddev.andengine.entity.IEntity;
import org.anddev.andengine.entity.IEntity.IEntityMatcher;
import org.anddev.andengine.input.touch.TouchEvent;
import org.anddev.andengine.input.touch.controller.ITouchController;
import org.anddev.andengine.ui.activity.BaseGameActivity;
import org.anddev.andengine.util.constants.Constants;
with
import org.andengine.ui.activity.*;
import org.andengine.engine.Engine;
import org.andengine.engine.camera.Camera;
import org.andengine.entity.IEntity;
import org.andengine.entity.*;
import org.andengine.input.touch.TouchEvent;
import org.andengine.input.touch.controller.ITouchController;
import org.andengine.ui.activity.BaseGameActivity;
import org.andengine.util.Constants;
After this clone AndEngineExamples and build as before. You will run into the following errors once you have fixed the imports. (If you are looking at this post a couple of months afterwards it is likely that these issues have been fixed and you do not need to worry about them)
Next there were couple of errors in the
TextBreakExample.java, line 106
BoundCameraExample.java, line 220
SplitScreenExample.java, line 179
The fix for this is given in this link
http://www.andengine.org/forums/tutorials/andenine-examples-showing-error-t9883.html
I also had to fix an error where I had to replace IEntity.getChild() with IEntity.getChildByIndex() don’t recollect where it was
Finally I had to replace the following line with the line below. This is more of a hack
Replaced the line in TexturePackerExample.java
//final TexturePack spritesheetTexturePack = new TexturePackLoader(this.getTextureManager(), “gfx/spritesheets/”).loadFromAsset (this.getAssets().toString(), “texturepackerexample.xml”);
with this
final TexturePack spritesheetTexturePack = new TexturePackLoader(this.getAssets(),this.getTextureManager()).loadFromAsset (this.getAssets().toString(), “texturepackerexample.xml”);
At this point the build should be clean. To run the examples you will have to connect your android phone to the laptop using a USB cable. The AndEngine Examples do not work on the AVD.
I have to admit the AndEngine examples are really cool. Some clips are shown below
<a href=”https://plus.google.com/103077316191161424665/?rel=author”>Find me on Google+</a>