Internet Technologies Wiki
Advertisement
SimCity Social

SimCity Social is an online social-network game created by Playfish (a part of EA) launched in 2012. It's gameplay is very similar to CityVille and other city-building social networking games, and is built on the Playfish standard flash platform, using a custom RPC protocol similar to The Sims Social and Hotel City.

Game Preloader[]

The flash container that is loaded in the Facebook canvas iframe is in fact a pre-loader application, which contains the logic to download the actual game engine and other image and sound assets. URLs to the Resource Manifest and other parameters are passed in to the pre-loader as flashvars.

flashvar Parameters[]

Name Value / Meaning
facebook_application_id 225496380820004
The Facebook Application ID
facebook_user_id Your Facebook User ID
gsc_enabled true
???
is_on_close_beta false
???
og_url https://simcity.game.playfish.com/g/fb/simcity/actions
URL used for Facebook Open Graph actions
pf_billing_config
pf_bookmark_url
pf_canvas_name simcitysocial
pf_canvas_url http://apps.facebook.com/simcitysocial/
pf_client_get_new_mail_time 300
pf_client_save_time 30
pf_console_config_url
pf_console_gameloader_url https://d13px3umnb4fz8.cloudfront.net/game/simcity/d/02qf7td3fK
The URL of the game pre-loader itself
pf_console_height undefined
pf_console_rpc_url
pf_console_swf_base_url
pf_console_width undefined
pf_facebook_url popup:submitFacebookOrder
pf_fan_page_url http://www.facebook.com/simcitysocial
pf_feed_url popup:addFeedSystem
pf_game_ask_gift_url popup:addSendGiftIFrame
pf_game_id 39
??? Internal Game ID
pf_game_onetoone_url popup:inviteOneToOneIFrame
pf_game_swf_url http://static-cdn-simcity.playfish.com/game/simcity/d/
pf_invite_url popup:addInviteFriendsIFrame
pf_javascript_domain_urls https://d2syub29v5lge2.cloudfront.net/bankui/res/2.0.0.3,
https://simcity.game.playfish.com/g/fb/simcity/
pf_lang en
pf_lang_url
pf_locale_refresh_url undefined
pf_manifest_url http://static-cdn-simcity.playfish.com/game/simcity/d/MKfieAbrzy
The URL of the Resource Manifest
pf_moneybookers_url popup:addPurchaseIFrameMoneybookers
pf_network facebook
pf_nucleus_enabled true
pf_onebip_url popup:addPurchaseIFrameOnebip
pf_paymo_url popup:addPurchaseIFramePaymo
pf_permissions_url
pf_ping_letter_time 80
pf_playspan_url popup:addPurchaseIFramePlayspan
pf_profile_base http://www.facebook.com/profile.php?id=
pf_profile_image_url
pf_ref
pf_res_base_url http://static-cdn-simcity.playfish.com/game/simcity/
pf_res_config res_config.xml
pf_retry_url http://apps.facebook.com/simcitysocial/
pf_send_gift_url popup:addInviteStickersIFrame
pf_session_id a unique session ID
pf_static_base_url http://static-cdn-simcity.playfish.com/game/simcity/
pf_stream_url popup:addStream
pf_superrewards_url popup:addPurchaseIFrameSuperRewards
pf_support http://support.playfish.com
pf_trialpay_currency_url popup:addPurchaseIFrameTrialPayCurrency
pf_trialpay_url popup:addPurchaseIFrame
pf_url http://simcity.game.playfish.com/g/rpc/simcity
The RPC URL
pf_use_fb_graph_api true
pf_user_country 2 letter country code
pf_user_last_time ?? last time logged in
pf_user_population 10
pf_user_xp 10
pf_visitus_url http://www.playfish.com/

The iframe URL is typically: https://simcity.game.playfish.com/g/fb/simcity/


Resource Manifest[]

The Resource Manifest is loaded by the game pre-loader, and is used for estalishing the url and size of various in-game resources, including the GameEngine which contains most game logic. The Resource manifest is a plain XML file in the format:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<config>
  <paths>
    <path src="http://a.static-cdn-simcity.playfish.com/game/simcity/d/" name="2" />
    <path src="http://c.static-cdn-simcity.playfish.com/game/simcity/d/" name="1" />
    <path src="http://b.static-cdn-simcity.playfish.com/game/simcity/d/" name="0" />
  </paths>
  <resources path="3">
    <resource length="1439890" src="ly8igoiUcp" name="GameEngine" />
  </resources>
</config>

RPC Packet Format[]

SimCity Social uses a binary RPC format similar to most other Playfish games. All messages are sent over a HTTP POST to the URL specified by the pf_url flashvar, typically http://simcity.game.playfish.com/g/rpc/simcity. Packets sent are usually batched up, containing many smaller packets of different types. Standalone packet bodies start with a NULL byte (00) followed by a 1-byte message type (or 0xFF for a batch) and then the session id, followed by the message-specific bytes. The Session ID and other strings are encoded in Length + Data format, where the length is encoded as a uintvar32 (see below).

Uintvar32 encoding[]

Decompiled ActionScript code:


 public function writeUintvar32(param1:uint) : void
 {
   var _loc_2:* = 0;
   if ((param1 & 4026531840) != 0) {
     _loc_2 = 28;
   } else if ((param1 & 266338304) != 0) {
     _loc_2 = 21;
   } else if ((param1 & 2080768) != 0) {
     _loc_2 = 14;
   } else if ((param1 & 16256) != 0) {
     _loc_2 = 7;
   } else {
     _loc_2 = 0;
   }
           
   while (_loc_2 > 0) {
     this._output.writeByte(param1 >>> _loc_2 | 128);
     _loc_2 = _loc_2 - 7;
   }
   this._output.writeByte(param1 & 127);
   return;
 }

Advertisement