Title: Learning LibGDX Game Development (2nd Edition)
Author: Suryakumar Balakrishnan Nair, Andreas Oehlke
Published: January 2015
Publishers summary: Wield the power of the LibGDX framework to create a cross-platform game
There are ways to simplify game development by using tools and libraries. The problem with most of these libraries is that you need to first be very comfortable with the language of the library. This is something of a conundrum for us if we are totally new to game coding. We want to simplify everything we can and yet we need some experience to be able to use the tools which make things simpler.
But what is LibGDX anyway?
LibGDX is a cross platform game development library that uses the Java language. You can write your Java code once and then deploy your creations to Android, iOS, Web and most major desktop OSs
LibGDX is not new. I first learned of it some years ago via a book, “Learning Android Games” written by the LibGDX creator Mario Zechner. And unfortunately I can recall being disappointed that the book kind of veered off topic into game library creation rather than sticking to the pure making games theme I had been expecting. Don’t misunderstand me, Mario’s book is a highly recommended read but not for a real beginner.
However, LibGDX itself is arguably the easiest to use game library out there. But does it solve our conundrum and is it useful for a complete beginner? Furthermore will the book which is the main subject of this article be appropriate for a beginner also? Before we answer those questions, here is a bit more info about the book Learning LibGDX Game Development and what it could help you do.
Back to the review
This review is for the recently released 2nd edition but I will recall some of my experiences from that of the first as well as talk about the all-new content as well.
The process of setting up a LibGDX development environment is still a pain- it always has been. It is not a case of downloading and clicking install. The book does cover all of the intricacies and a complete beginner will be able to do it. The couple of hours struggle is easily repaid a hundred times over when you start doing things with the library. It took less than half an hour and I had a spinning and bouncing graphic, running with all the power of OpenGL ES. Achieving this, just on Android would have taken at least a few chapters for someone new to OpenGL and I had it running on the Web, Android and my desktop!
The main content
Here are some of the things you will do over the main part of the book
- Setting up your development environment (The only topic which isn’t fun)
- Game engines
- level design
- Hero, collectibles and power-ups
- Menu screens
- Special FX via particles
- Really neat sprite sheet animations
- 2d physics (bouncing and falling etc)
All of the above topics are covered in the context of a single platform game and the flow of the book is very good as each part runs neatly into the next. Just as you find yourself asking, “but what about..” the author seems to have anticipated this and covers it.
The book is brimming with colour pictures. I love pictures in technical books. You can see exactly what the code achieves even if you haven’t gone to the trouble of creating the project for yourself.
The extra content for 2nd edition
So what is new in the 2nd edition? A fair bit but not a truck load. Allot of the content seems improved and there are two completely new chapters. Are these two chapters worth the entire cost of a book? Difficult to say, possibly not. But the two chapters are great. This is what they do.
They show some of the things that can be done with the latest version of LibGDX. Chapter 13 is a whirlwind tour of the 3d API. You can create a genuinely 3d scene with lights and simple objects with a single page of code. I almost fell off my chair. If you have ever made a similar 3d scene with OpenGL before, you will know it takes many dozens of lines of code and you will need to wrestle with multiple classes as well. Not to mention the writing, building and linking the programmable shaders as well. In fact for a beginner it is probably the most simple 3d scene known to man. Even Unreal Engine 4 with its GUI scene builder would take more effort than this!
Then, in the same chapter you can add just a few more lines to import and display a 3d model from the Blender 3d modelling software. Then just a few more and you can even navigate (play) the scene with the WASD keyboard keys.
The final chapter was new too. It looks at the 3d physics library Bullet. And like the chapter I have just described it just left me wanting more. I would not hesitate to buy a book targeted at the same level of reader but that only covered LibGDX for 3d games.
Back to our conundrum
So is it suitable for a complete beginner? Having just finished skimming the chapters I had read previously as well as thoroughly taking in all the new content I have just described, it has been possible for me to reach what might be a useful conclusion about the book’s suitability for game coding beginners.
The code is presented just how I like it, with plenty of context. When a new line is added to an existing block it is shown in bold amongst that code. So many other books lazily tell you to refer to the code download or just present the new idea out of context. This is perfect for beginners. For this reason I can recommend this book for someone who is new to Java but knows the very basics of OOP. What better way to familiarize yourself with interfaces, threads and the like than experimenting with games.
The code is as straightforward as is possible and when you are confronted with code that looks a bit alien there is always enough context to Google a term or refer to your favourite Java beginners guide and you will be right back to building games in no time. So if you have some Java knowledge, why not use this book to practice, learn and improve those skills? Why wait until you are an OOP expert.
However, if you have no Java experience at all the book will likely be too complex. I would suggest reading all of the Level 1 Java tutorials on this site and then dive straight in to Learning LibGDX Game Development.
If you are already a Java maestro but have no game development or LibGDX experience then this book will be an ideal introduction to either or both.