The game communicates to a server via a custom binary-based RPC protocol, that may or may not also be used in other Playfish games.
The protocol handler is contained within actionscript com.playfish.rpc (there are two subfolders, share, which is expected to be the common RPC protocol used by Playfish games and hotel, the specific protocol used by the game) in the flash file http://static-cdn.playfish.com/game/hotel/swf/hotel_game_0_3_7_3.swf (although newer versions may vary in the future)
Much is not known about the protocol, however portions of it can be recognised by decompiling the actionscript specified above.
Each request has a two byte unsigned integer at the beginning, specifying what type of request it is. CALL_TYPE_getUsers = 6 CALL_TYPE_purchaseCoinsForCash = 8 CALL_TYPE_getUserInfo = 2 CALL_TYPE_firstTimeVisitFriend = 5 CALL_TYPE_init = 1 CALL_TYPE_getBasicUserInfo = 4 CALL_TYPE_saveUserProfile = 3 CALL_TYPE_getFeedUrl = 7
The official game starts by making an 'init' request, followed by a 'getBasicUserInfo' request for the user playing.
Note: I have ported some of the game commands into python, so if you would like to create your own application that uses the Playfish RPC protocol, contact me (email@example.com) and I'll work on sending you the source code. Adammw 11:22, April 18, 2010 (UTC)
init[edit | edit source]
Request[edit | edit source]
First 2 bytes: 00 01 (CALL_TYPE_init) Next 4 bytes: length of capabilities.serverString Following bytes: string of capabilities.serverString Next 4 bytes: length of URL params Following bytes: url params