What is AmfPHP?
Version 2.2 – the latest release as of December 2013 – provides several ‘BackOffice’ developer tools such as a service browser, client code generator and a usage profiler. The Service Browser lets you test your server-side logic, and exposes the input parameters. You may elect to test the servers responses by ‘simple’, ‘advanced’ (i.e.: JSON or JSONP, AJAX) and even stress-test your server by selecting the ‘Call Repeater’.
The Client Generator tool is simply the best! It creates all the front-end client interface code for your game. You have several technologies from which to select:
3) IOS – coming soon.
4) Haxe – coming soon.
5) Android – coming soon.
6) Or write your own! This is your chance to integrate Construct2! Even if you do not adopt the AmfPHP remoting technology, it is worth your time spent generating the HTML scripts for your Construct2 projects. By doing so, you eliminate time spent re-inventing the data transfer and serialization ‘wheel’.
The Usage Profiler is the newest BackOffice tool released in 2.2. I spent so time using the stress-test features in the Service Browser; then, I navigated to this new tool. In just a glance, I learned where I needed to focus my attention. I would have spent months of my free-time trying to create such develop tool – time that could have been spent on game invention.
How Does AmfPHP Work?
AmfPHP becomes the target of information requests from players’ browsers, smart-phones or tablets. “OK!” you say,”I could just as easily use node.js or socket.io and do the same thing!” Indeed, you could, but AmfPHP is already written, and can serialize your game data is several different formats for server consumption. Your players send game state information/requests to the AmfPHP scripts on your server; AmfPHP reads those requests, calls the various functions and returns the resulting data. AmfPHP is a cleaner separation of front-end, business login and data access. Gone are those days of writing complicated server socket code, since AmfPHP performs all the “heavy lifting” for you. “Without AmfPHP, there would be one code for the web page, another for the smart-phone app, and maybe another for the tablet app. With AmfPHP, there would only be one code!” (Quote: ibid) All you write are the service classes – business logic and database connections. AmfPHP will execute those services and ensure the players receive game data in a language their browser, smart-phone, tablet understands. “AmfPHP is the best solution for creating accessible services to all terminals. Developers can focus on features unique to their (ed.: game) projects, regardless of the communication between client and server.” (Quote: ibid )
Sounds Wonderful … Show me!
You may borrow my installation @ PBMCube.com ( https://adventurers-of-renown.com/quests/rrte.php ) and logon as either a ‘Guest’ or ‘Member’ with firstname.lastname@example.org as your email and ‘test’ as your password. Everything from my Flash front-end goes through AmfPHP. The ‘member’s area’ accesses AmfPHP – which sanitizes player input; collects the player’s mySQL database records and returns a data type easily consumed as a native flash data object. I could have just as easily written this for HTML5, JSON and jQuery. AmfPHP handles all the ‘heavy lifting’ and connection processes. Here’s my server-side function which executes in 9ms:
Alternately, you might consider installing your own by downloading AmfPHP from silexlabs.org/amfphp .