So after the release of the first Beta for Tanker, I have pretty much put development of Tanker on hold; the only thing I have time to worry about is TouchMagic and getting the game released in time to the Android market in order to gather a good set of results before I get to writing my dissertation. As I’m currently put on for 3-4 days a week at my current job as a phone salesman, this isn’t easy.

But it is coming along OK. My third mini game is now complete: a game that has a set of light bulbs wired together with only one light bulb on. The player must drag power from the first light bulb to power on all the lights. A simple game in concept, but the number of lights and positions are randomly generated, so sometimes it becomes a bit difficult to see which wire goes to which light!

With this complete, it is now time to gather data. Figuring out how to do this was a pain in the neck. I initially wanted to fire an object file over a TCP connection to a Java server that I had running on a static IP. For a number of reasons this idea crumbled as I did more and more research. However the main factor was thus: I was building this for a mobile application. Instead of designing my own TCP protocol, I was much better off using HTTP which would handle packet loss much better. The java server also seemed a bit heavy of an implementation for what I was doing, so I am instead writing a PHP server. Lastly comes how to package and send the data. I have decided to send the data as an XML document.

Now there are multiple ways to serialize XML documents from Java. I intially started doing this using JAXB, and all was going well until I realised one problem again relating to mobile development: The libraries for JAXB were over 12MB in size. For a mobile application, that is a lot of memory. I soon hunted around for something better and more lightweight. Eventually I stumbled across Simple and this tutorial on how to use Simple with Android. The library totals up to around 300KB in size; a lot more ideal for a mobile application. And personally, I found it a little easier to learn and understand than JAXB even though there seems to be a lot more support for JAXB on the internet. Bottom line though, if you ever want to write any XML files on the fly in Android, use Simple.

Now that is done, I can now move on to saving the XML files to my server which is dead easy, and then creating a few more minigames for TouchMagic.

Leave a Reply