Well, it’s been almost 3 weeks since we started full time work on our HTML5 game engine, Flax. Some of these days have been quite productive and other days the work just came to grinding halt because of technologies we were hoping to use or features that we where hoping to exploit deciding not to work. However, work is progressing quite well now and the design document is starting to come together nicely.





So what is this Flax Engine which we have heard passing reference to with little detail? The Flax Project is first and foremost a blog, from which we hope many different experimental projects will spawn. The first of which is the Flax HTML5 Game Engine. The Flax engine is our shot at making a web game engine which we can use to rapidly develop simple games for web platforms such as Facebook, the Google Chrome app store, Android, iPhone and basically any device with a modern web browser.





With only 4 weeks left until college starts up again the pressure is on for us to complete this design document, and get even a beta version up and running, because once college starts there will be less time to work on the project.

What I worked on this week

This week I worked on quite a few different engine components but the two most notable and troublesome ones were the Events system and the file handling system. FileHandle was causing us some problems as my original hope to be able to serialize objects client side into something like JSON and save them to a file on the server turned out to be extremely difficult. Now remember we are using Google Web Toolkit, not actual JavaScript, which is where the block comes into play. Converting a JavaScript object into a JSON string is simple, but not when using GWT. Its somewhat hard to explain so I did this quick flow diagram.









The problem lies in the fact we are using GWT to generate our JavaScript code, which converts our highly complex Java class into JavaScript classes, these are then quite difficult to interact with using GWT native methods and currently there exists no working Google Web ToolKit library that has implemented serialization for client side. After 4 days of googling and trying so many different libraries I am pretty confident in saying that we can’t do it. (Though I would be extremely happy if someone could prove me wrong.)

Soluation has been found Flax Engine: GWT client-side JSON serialization and deserialization









Flax Events System

After thinking about how many objects that could exist in a game, I soon realised that registering each object with all the other objects in the game to listen for events from one another would case some spaghetti junction architecture to form, causing quite a lot of messy unscalable code. So after some probing around the internet I was directed to this talk Google I/O 2009 – Best Practices for Architecting GWT App by Ray Ryan. He spoke about an event bus type architecture to achieve more decoupling and reduction in spaghetti junction architecture in GWT apps. Based on that I have taken that root for the events system in Flax.





So that’s me for the weekend. Its finally here so a few pints wouldn’t go astray. The weather is amazing in Carlow at the moment so it’s just as well it’s the weekend. That’s my diary article done for the week and here is Carls Flax HTML5 Game Engine Development Diary Part 2