Tales from the mdevcon archives: Ronald Warners on creating Android games
Today, we have Ronald Warners talking about creating Android games using AndEngine and Box2D physics. Ronald worked in the banking industry as Java developer for seven years and is now consultant at Xebia (Java and mobile enterprise). He was always interested in creating games, it’s how he got interested in programming in the first place. Less than a year ago he started creating a game in Android as a hobby/pet project in his free time. During development he learned a lot about mobile games and programming for mobile devices in general. But even more important: it is really fun trying to create a game for a mobile device. Ronald wants to share his experience so more people get enthusiastic and get some directions when they are going to create a game themselves.
Ronald about his session: Game development is hard, it’s not your average ListView application and there is no standard way to design and create a game. At the same time, creating a game on android is fun, you need to be creative on every level. You need to think about gameplay and graphics, but you also need to make sure your game performs well on all those devices.
So where do you need to start? I started developing a game using AndEngine: an open source 2D OpenGL Game Engine library and used Box2D for simulating physics (also used in Angry Birds). Using AndEngine you are able to create a game in Java on Android without being bothered too much by the underlying OpenGL. It is set up in a very object oriented way. Still some concepts might be hard to understand and there is not much documentation. There are other libraries or even complete GUIs in which you can create or script a game, however I liked using AndEngine because it’s a nice way to learn about the concepts when creating games on a mobile device. For me it is the right starting point for development: between hardcore OpenGL and some graphical tool/engine.
In this presentation I will cover some AndEngine and Box2D basics and highlight my findings when creating a 2D scrolling game for Android phone and tablet.
- Canvas2d and OpenGL
- Introduction to AndEngine (library, concepts, UI thread, examples)
- Game loop
- Bitmap and vectors
- Level editor?
- Introduction to Box2d
- The Box2d ContactListener
- More about performance (GC is not your friend, Batching, Java and C (JNI), Box2d)
There are also slides available for this talk, you can get them here.