6. Demographic Trends
• More female
gamers
• More younger
(ages 8-15) gamers
• More older (ages
50+) gamers
Friday, October 23, 2009
7. FB Games are Social
• Trend #1: Virtual Worlds
• e.g.,YoVille, PetSociety
• Trend #2: Customization & Personalization
• e.g., Nintendo’s “Mii” avatars, Buddy Poke
• Trend #3: Collections and Wish Lists
• e.g., Mafia Wars
• Trend #4: Interaction and Engagement
• Farm Town, FarmVille, Barn Buddy
• Trend #5: Narrative and Missions
Friday, October 23, 2009
8. FB Games are Social
• Trend #6: Gift Invites
• e.g., Lil Green Patch, Give a Heart
• Trend #7: Donations as Revenue
• e.g., SpareChange, PayPal
• Trend #8: Virtual Goods
• e.g., Mafia Wars, PetSociety
• Trend #9: Recruiting Users
• e.g., FarmVille, Restaurant City, Tycoons
• Trend #10: Capitalizing on Player Resources
• e.g., All that Glitters, Photo-of-the-Day
Friday, October 23, 2009
10. Facebook apps on Rails
• Rails 2.3.3
• Facebook API via Facebooker
• Hosted on Heroku
• Monitor via NewRelic
Friday, October 23, 2009
11. User model
Facebook UIDs are 64-bit, so need bigint for User#id
create_table :users, :id => false do |t|
t.column :id, "bigint PRIMARY KEY", :null => false
...
t.timestamps
end
Associations can be done based on user_id
create_table :balloons
t.column :user_id, :bigint
...
t.timestamps
end
Friday, October 23, 2009
12. Facebooker
• Wrapper for Facebook API
• Facebooker::User to query user data
• Facebooker::Publisher for feeds/notifications
Friday, October 23, 2009
13. Facebooker
• Wrapper for Facebook API
• Facebooker::User to query user data
• Facebooker::Publisher for feeds/notifications
Friday, October 23, 2009
14. Preload FQL
• Facebooker::User to query user data
• Since query can take 500ms or more, use
Preload FQL to pre-query the data
preload_fql = Hash.new
preload_fql[:preload_user_data] = {
:pattern => ".*",
:query => "SELECT name,birthday_date
FROM user WHERE uid={*user*};"
}
Facebooker::Admin.new(Facebooker::Session.create).set_app_pro
perties({:preload_fql => preload_fql.to_json})
• Obtain the preloaded data on every page:
params[:fb_sig_user_data]
Friday, October 23, 2009
15. Open Stream API
• Facebooker::Publisher for feeds/notifications
• Facebook has deprecated template bundles
• Instead use the Open Stream API:
<script>
var attachment = {'media':[{'type':'image', 'src':'http://
cardinalblue.com/images/cblue_logo_white100.png', 'href':'http://
cardinalblue.com'}]};
Facebook.streamPublish('Hello Cardinal Blue', attachment);
</script>
Friday, October 23, 2009
16. Functional tests
with facebook_get
test "requires-login page, logged in" do
facebook_get :install
assert_response :success
assert_nil facebook_redirect_url
end
test "requires-login page, not logged in" do
# access a page that requires login
facebook_get :install, :fb_sig_user => nil
assert_response :success
assert_not_nil facebook_redirect_url
assert facebook_redirect_url.match("http://www.facebook.com/install.php")
end
Friday, October 23, 2009
21. Can set up
custom tracers:
Facebook/query
Facebook/notify
Facebook/feed
class NewrelicTracer
def self.query
yield
end
class << self
add_method_tracer :query, 'Custom/Facebook/query'
end
end
NewrelicTracer.query do
location = facebook_session.user.current_location
end
Friday, October 23, 2009
22. Observations
• Facebook is growing
• Facebook games are social
• Rails + Facebooker = Facebook app
• Heroku is fun (and scalable)
Friday, October 23, 2009
23. Thank you.
http://cardinalblue.com/about
jobs@cardinalblue.com
Friday, October 23, 2009