Angry Birds Chrome, Java->Javascript, Google Web Toolkit

Discussion in 'Game Development (Technical)' started by jpoag, May 17, 2011.

  1. jpoag

    jpoag New Member

    Joined:
    Mar 15, 2008
    Messages:
    806
    Likes Received:
    0
    Canvas vs. DOM
    Recently I've been researching HTML5 Canvas vs. DOM Manipulation speed for developing web games and I ran across Angry Birds for Chrome!

    Naturally curious, I went looking through the javascript to see what Rovio decided was the best option. Obviously, the script was obfuscated but after a little work and a lot of 'find and replaces', I discovered that the scripts are created using the Google Web Toolkit.

    The script is a bootstrap loader that loads the correct javascript file based on the browser. Using the built-in Chrome developer tools, I was able to figure out how the bootstrapping sequence worked and view the loaded javascript (obfuscated again).

    Google Web Toolkit
    Next, I went looking into the Google Web Toolkit (GWT). Did you know you can write client/server side programs in Java and generate highly optimized client-side javascript code? Sorry, write and DEBUG client side programs in java and compile to javascript (JS)!

    The java servlets assume you're using Google App Engine (GAE). However, the GWT RPC uses JSON as the wire format so I'm sure you could write the server side code in PHP/Python/whatever. (GAE has a Python Environment).

    When you're debugging, you're running the client side code in Java and Eclipse will let you set breakpoints and step through the code. GWT spawns a local server (two actually, one serving the HTML and another running the GAE sandbox for the server side code).

    GWT comes with full DOM manipulation support including Canvas, HTML5 and CSS3!

    Angry Birds
    GWT isn't new. But Angry Birds Chrome is (less than a week).

    Load Angry Birds in Chrome, click on the wrench and select "Tools->Developer Tools." From there you can browse all the assets, the local store, the javascript (obfuscated by GWT) and execute commands in the console.

    Looking at the resources you can find texture atlases. These could easily be CSS Sprite sheets, but I noticed that the sizes are pow2. i.e. optimized for OpenGLES loading on embedded devices.

    I'm 95% sure that the game uses canvas.

    Also, I think the background sound track is a hidden Flash window.

    Thoughts...
    1. What do Java developers think of generating JS/HTML5 applications?
    2. Do you think Angry Birds will provide the weight to tip in favor of HTML5/Canvas games?
    3. The generated Javascript(s) are optimized for each browser and heavily obfuscated. GWT also has documentation on Security practices (for server/client communication). How Many people are worried about their code being stolen or hacked by being written in JS? Does the GWT generated code alleviate your worries?
     
  2. wicharek

    wicharek New Member

    Joined:
    Mar 11, 2011
    Messages:
    2
    Likes Received:
    0
  3. CJX

    CJX New Member

    Joined:
    Mar 27, 2011
    Messages:
    10
    Likes Received:
    0
    I'm 5 months into my HTML5 game, with about 4/5 months left before it'll be finished. I've been checking the web periodically for new HTML5 games that might compete with my own, and I've definitely noticed a huge increase in the frequency of new games, even over that short period of time. New releases are of a much higher quality than they were, too. It's got me a little worried - 5 months ago my game would have stood head and shoulders above the rest; in 5 months it might be little more than mediocre.

    Code theft isn't an issue. The web is about sharing anyway - no-one will be able to reproduce my game from the code they can see (much of it is server-side), and I have no problem if they delve into it in order to inform their own programming choices (as you have with Angry Birds). In fact, I think that programming on the web is the easiest way to beat the pirates.
     
  4. CasualInsider

    CasualInsider New Member

    Joined:
    Dec 22, 2008
    Messages:
    355
    Likes Received:
    0
  5. Indiepath

    Indiepath New Member

    Joined:
    Aug 22, 2004
    Messages:
    999
    Likes Received:
    0
  6. jpoag

    jpoag New Member

    Joined:
    Mar 15, 2008
    Messages:
    806
    Likes Received:
    0
    #6 jpoag, May 24, 2011
    Last edited: May 24, 2011

Share This Page

  • About Indie Gamer

    When the original Dexterity Forums closed in 2004, Indie Gamer was born and a diverse community has grown out of a passion for creating great games. Here you will find over 10 years of in-depth discussion on game design, the business of game development, and marketing/sales. Indie Gamer also provides a friendly place to meet up with other Developers, Artists, Composers and Writers.
  • Buy us a beer!

    Indie Gamer is delicately held together by a single poor bastard who thankfully gets help from various community volunteers. If you frequent this site or have found value in something you've learned here, help keep the site running by donating a few dollars (for beer of course)!

    Sure, I'll Buy You a Beer