Flax Engine: GWT Asynchronous HTTP communication with PHP back-end

Well here is the first of our successful modular time-boxed tasks which I spoke about earlier this week in Flax HTML5 Game Engine Development Diary Part 6. Earlier this week after I had fixed up a few bugs I committed a completely working build of the Flax Engine. So I uploaded it to a live server to make sure everything was working fine. Unfortantaly this was not the case the GWT RPC wasn’t working and to cut a long story short we realized that the File-handle modulehad never been properly tested on a live server for some strange reason again in an Aglie approach we would of identified the RPC as a high-risk requirement in the beginning of the project and would have developed and tested the code extensively. Mistake are there to be made, we learn from them.

Google Web Toolkit RPC

Using an RPC means a Java back-end for I/O on the server. This servlet has to be configured for different servers and most of all meant you required a servlet to run a game using the Flax Engine. It wasn’t as simple as HTML and JavaScript which is what we want from Flax. So with the help of our new trustly white boards we idenifed the requirments we needed in terms of server I/O. Which are as follows..

  • Reading of JSON maps files to be loaded into the engine
  • Writting JSON map files to the server in the case of the Flax Engine editor Weave etc

Google Web Toolkit Asynchronous HTTP

So with those requirements in mind we modified the file-handle system to use GWT Asynchronous HTTP requests. So that JSON map files could read and loaded into the engine without the need for any servelets. For some apps like the Flax Engine editor Weave we need to be able to write JSON map files to the server so I wrote a PHP backend script to handle this.

Advantages

Code size: The GWT Asynchronous HTTP code is significantly smaller then the GWT RPC.
Simple: Simple upload of complied JavaScript to server and it works, no config.
Experience: PHP was my first language to learn and used it to build many apps over the years so I can in future expand on the functionality of the PHP backend.

About the Author

Ciarán McCann

Flax Project Founder - Ciarán McCann is an extremely passionate and motivated programmer who has been programming for about 4 years now. Currently attending Carlow I.T studying computer games development. He has experience in many different programming languages, markup languages and general technologies. His role in the Flax Project is as a blogger/Web Designer and Flax Engine programmer. Please excuse any bad grammar/spelling, I am a bit on the Dyslexic side. Follow me on Twitter for info on what I am working on.

Visit Website

One Comment

Trackbacks for this post

  1. […] This post was mentioned on Twitter by HN Firehose, Dr Carl Lange and Flax.ie, Ciarán McCann. Ciarán McCann said: I posted an article on why we are using GWT Asynchronous HTTP requests with PHP back-end instead of a GWT RPC in Flax http://t.co/MulKgl5 […]