May 19, 2011

Writing games using GWT and Eclipse


Finally Angry Birds is available on the web platform! I was not so impressed by the news from Google I/O until I heard that the implementation was done using Google Web Toolkit (GWT), a technology that has caught my interest lately. The good thing with GWT is that I don't need to hack Javascript and HTML5, but rather continue using Java with my favorite editor/debugger: Eclipse.

The Google I/O session Kick-Ass Game Programming with Google Web Toolkit explains further that Angry Birds is using the Box2D physics engine, which according to the presenter's guess 90% of all iPhone games are using. The Google guys took the Java version of Box2D, ported it and optimized it for GWT (in 30 mins!), and wrote a cross-platform game abstraction library, called ForPlay.

The idea is really compelling; instead of writing and maintaining several codebases of your game for different platforms, a ForPlay game can be run on the web platform (HTML5), as a Java program or even using Flash. Thrilled to try out this new platform, I wrote my first "game", well ... not really a game, but I thought it would be interesting to see how our company logo behaves in free fall. The result is on http://findoutlogo.appspot.com. It is based on the "Hello Game" demo you get when checking out the ForPlay source.

The FindOut Logo game (hint: click to drop a new logo or click and drag to "throw it")
I am very glad to see that you can leverage the existing ecosystem of components, even when doing game programming, and that GWT seems to be a great technology for managing code sharing when dealing with many target platforms.