LibGDX, Legends of Yore and getting to iOS (again)

Well, I told Mario over at badlogicgames that I’d write up my experience using the wonderful LibGDX to port Legends of Yore and get it back on iOS – finally!

So, first up, have to set the scene. Legends of Yore is a large RPG/Roguelike with a very simplistic graphical style. It is available on iOS, Android, Desktop, Playbook and Touchpad – all from the same code base. I developed against an abstract API I created before there was any decent way of getting on to iOS – the Touch API. This API meant that all uses of images, sounds, network connections and everything else was already abstracted away from the game code. 

Unfortunately it never performed very well on iOS – that was due to the method of getting it there, XMLVM which while extremely cool uses a method of compiling the byte code into C code then recompiling. As you imagine those layers make things pretty slow. Worse still, when iOS 6 came out it broke my code in a way that I couldn’t fix without rewriting chunks of XMLVM – something I wasn’t able to do, at least not well.

LibGDX

So, enter LibGDX – an API I’ve been aware of for many reasons. First I know some of the folks working on it from past java gaming projects. Second, Slick (my game library) got compared to it regularly as thought there needed to be some competition between the two. Finally, I was hearing great things about how it worked. Then came the new it could now get to iOS via a much smarter method than mine (more on that later).

My customers are/were needing an iOS 6 update so I decided to port Legends over to LibGDX. Things really couldn’t have been much easier. Screen setup is pretty much done for you by the sample code provided. SpriteBatch is wonderfully simple to use to splat sprites from textures onto the screen. Sounds are a very simple API and all that worked flawless straight off the bat even when I ported to iOS. 

Lets talk more about that, compiling to iOS, how does LibGDX do that? It builds the Java, then uses IKVM to get C#, then finally uses MonoTouch to get to iOS. Now, you can go as far as the iOS simulator with just your Mac and the trial version. However, the minute you want to actually get to the device or the AppStore you need to fork out $300 to get a MonoTouch license. For me, that was a no brainer, Legends has paid much more than that over the years and my customers deserved to have it back. Re-invest some cash and get the license.

EDIT: Mario informs me that the trial version of MonoTouch actually lets you deploy to devices too! Just need the license for the App Store.

Does it work?

I had one, yes read it, one problem with LibGDX. The HTTP API wasn’t working correctly on the iOS backend. It was simple enough to fix and thats now been worked back into the code base.

Other than that, yes it works! It works damn well. I have a Java project that I change how ever I want. Once my changes in Eclipse are complete I move to MonoDevelop – hit clean and build. Run on the simulator and I’m testing! Round trip from code change to simulator is around 20 seconds. This is close to perfect for me!

Ok, there are some limitations on which bits of Java API you can use and you want to try and make use of the GDX API as much as possible since that is intended to be portal. However, you can read all that on the LibGDX Wiki

That said, Legends is a pretty code base for a pretty complicated and expansive game and it ported straight over. 

I’m sure there will be problems to resolve that come up once people start playing it again – but without further ado – Legends of Yore is back on the AppStore here and here.

All I can really say is thank you LibGDX Team, you really do rock!

Tags :
Categories : Uncategorized

Leave a comment