building social games

50
developers Prashant Sridharan github.com/CoolAssPuppy @CoolAssPuppy Building Social Games Thursday, May 2, 13

Upload: ankit-nigam

Post on 16-May-2015

651 views

Category:

Technology


0 download

DESCRIPTION

Presentation by FB engineer on using FB in social games

TRANSCRIPT

Page 1: Building social games

developers

Prashant Sridharangithub.com/CoolAssPuppy

@CoolAssPuppy

Building Social Games

Thursday, May 2, 13

Page 6: Building social games

!"#MGamer MAU

$"%MMobile MAU

%.%B+Global MAU

Thursday, May 2, 13

Page 7: Building social games

Facebook Provides Unique Social Channels

2012

Requests Sharing Scores &Achievements

Open Graph

Thursday, May 2, 13

Page 8: Building social games

Scenarios for Using Facebook Social Channels

2012

(. Invites$. Sending Gifts%. Leaderboards). Tournaments". Bragging+. Challenges

Thursday, May 2, 13

Page 9: Building social games

Sending InvitesCustomFriend Picker

Thursday, May 2, 13

Page 10: Building social games

Sending GiftsInvitationswith Value

Thursday, May 2, 13

Page 11: Building social games

Sending GiftsInvitationswith Value

‣Q: Why use this over native push notifications?

- Cross-Platform- Works with users who’ve not installed your app

Thursday, May 2, 13

Page 12: Building social games

Social LeaderboardsPeer Pressure

Bubble WitchSaga

Thursday, May 2, 13

Page 13: Building social games

Weekly TournamentsBuild regular engagement

DiamondDash

Thursday, May 2, 13

Page 14: Building social games

BraggingFinding natural moments to share

new share dialog screenshot needed

Thursday, May 2, 13

Page 15: Building social games

Start with Facebook Login

User’s identity Appearing in SearchUser’s friends Getting Distribution

Thursday, May 2, 13

Page 16: Building social games

Make Facebook Login Prominent

Explain what you’re going to do with user data and upsell on the value of Facebook Login

Thursday, May 2, 13

Page 17: Building social games

Ask for Read Permissions First

[FBSession      openActiveSessionWithReadPermissions:@[@”email”]                                                    allowLoginUI:YES                                          completionHandler:    ^(FBSession  *session,  FBSessionState  status,  NSError  *error)      {          //handle  result      }];

Thursday, May 2, 13

Page 18: Building social games

Ask for Write Permissions In Context

FBSession  *fbSession  =  [FBSession  activeSession];                            [fbSession            requestNewPublishPermissions:@[@"publish_actions"]                                                                                              defaultAudience:FBSessionDefaultAudienceFriends    completionHandler:^(FBSession  *session,  NSError*  error)  {        //handle  result                                      }];

Thursday, May 2, 13

Page 19: Building social games

Support Free & Paid Versions of Your App

FBSession  *fbSession  =  [[FBSession  alloc]  initWithAppID:@"480369938658210"                                                                                        permissions:permissions                                                                                urlSchemeSuffix:@"free"                                                                          tokenCacheStrategy:nil];

Thursday, May 2, 13

Page 20: Building social games

Requests

Thursday, May 2, 13

Page 21: Building social games

Get Existing Users to Recruit New Users

Thursday, May 2, 13

Page 22: Building social games

User Flow for Requests

Sending Receive Push Notification Light up notification jewel

Thursday, May 2, 13

Page 23: Building social games

User Flow for Requests

Sending Receive Push Notification Light up notification jewel

Thursday, May 2, 13

Page 24: Building social games

User Flow for Requests

Receive Push Notification Light up notification jewel Appear in notification list

Thursday, May 2, 13

Page 25: Building social games

User Flow for Requests

Receive Push Notification Cross-Platform(Web / iOS / Android /

Mobile Web)

Light up notification jewel Appear in notification list

Thursday, May 2, 13

Page 26: Building social games

Sending a Request

NSString  *message  =  [NSString  stringWithFormat:@"I  just  smashed  %d  friends!  Can  you  beat  it?",  nScore];                    [FBWebDialogs  presentRequestsDialogModallyWithSession:nil                                                                                            message:message                                                                                                title:@”Invite  Friend”                                                                                      parameters:params                                                                                            handler:nil];

Thursday, May 2, 13

Page 27: Building social games

Frictionless Requests

▪Automatically sends future requests without prompting the user

▪Useful for Games to send a “Your Turn” notification, to send lives/gifts to friends

Thursday, May 2, 13

Page 28: Building social games

Request Filtering

GET https://graph.facebook.com/USER_ID/friends?fields=devices

▪What if you don’t support all platforms?

▪Restrict Requests only to users that support your platforms...

▪Can query the set of devices a user has via the Graph API

▪Send the result of the query to your native Friend Selector

Thursday, May 2, 13

Page 29: Building social games

Demo: Sending Requests

Thursday, May 2, 13

Page 30: Building social games

Advanced Filtering

NSString  *fql  =  @”SELECT  uid,  devices  FROM  user  WHERE  uid  IN  (SELECT  uid2  FROM  friend  WHERE  uid1  =  me())  and  is_app_user  =  0”;

[FBRequestConnection  startWithGraphPath:@"/fql"                                                          parameters:@{@”q”:  fql}                                                          HTTPMethod:@"GET"                                            completionHandler:^(FBRequestConnection  *connection,                                                                                    id  result,                                                                                    NSError  *error)  {                                            //parse  list                                            }];

▪Remove friends who are already using the app

▪Send the result to to your custom Friend Selector

Thursday, May 2, 13

Page 31: Building social games

Deep Linking from Requests

fb[APP_ID]://authorize#expires_in=[ACCESS_TOKEN_EXPIRATION]        &access_token=[USER_ACCESS_TOKEN]        &target_url=https://apps.facebook.com/[APP_NAME_SPACE]/?request_ids=[COMMA_SEPARATED_REQUESTIDs]&ref=notif&app_request_type=user_to_user

Thursday, May 2, 13

Page 32: Building social games

Build Your Own Friend Selector

▪Build your own friend selector for better results

▪Use your game’s artwork for a more consistent user experience

▪Native dialogs will perform better

▪Send the selected friends to the Facebook Requests Dialog

Thursday, May 2, 13

Page 33: Building social games

Thursday, May 2, 13

Page 34: Building social games

Sharing

Thursday, May 2, 13

Page 35: Building social games

Using the New Native Share Dialog

[FBDialogs presentShareDialogWithLink:[NSURL URLWithString:@"http://yoururl.com/"] name:@"Checkout how awesome I am" caption:@"See if you can beat me!" description:[NSString stringWithFormat:@"I just scored %d points!] picture:[NSURL URLWithString:@"http://youurl.com/yourimage.jpg"] clientState:nil handler:nil];

Thursday, May 2, 13

Page 36: Building social games

Sharing

Thursday, May 2, 13

Page 37: Building social games

Demo: Feed Dialog

Thursday, May 2, 13

Page 38: Building social games

Share Interesting Moments

Thursday, May 2, 13

Page 39: Building social games

Support Deep Linking when Sharing

▪ Feed and Timeline stories link directly to the native app

▪ Don’t just send users to a generic title screen, provide context

▪ Parse target_url to provide a contextual experience

Thursday, May 2, 13

Page 40: Building social games

Scores & Achievements

2012

Thursday, May 2, 13

Page 41: Building social games

Graph API for Scores▪ Simple API, only for

games

▪ Post an integer score for a player

▪ We generate stories automatically

▪ These stories are only for desktop Facebook

▪ ...but the Scores API is still useful for mobile...

Thursday, May 2, 13

Page 42: Building social games

Example: Publishing Scores

NSMutableDictionary*  params  =      [NSMutableDictionary  dictionaryWithObjectsAndKeys:                                                                                          [NSString  stringWithFormat:@"%d",  nScore],  @"score",                                                                                          nil];                        FBRequest  *req  =  [[FBRequest  alloc]  initWithSession:[FBSession  activeSession]                                                                                    graphPath:[NSString  stringWithFormat:@"%@/scores",  playerFBID]                                                                                  parameters:params                                                                                  HTTPMethod:@"POST"];

[req  startWithCompletionHandler:^(FBRequestConnection  *connection,  id  result,  NSError  *error)  {}];

Thursday, May 2, 13

Page 43: Building social games

Creating a Social Scoreboard

GET https://graph.facebook.com/APP_ID/scores? access_token=USER_ACCESS_TOKEN

"data": [ { "user": { "name": "Christine Abernathy", "id": "1424840234" }, "score": 106, }, { "user": { "name": "Amir Naor", "id": "627802916" }, "score": 57 }, ... ]

Thursday, May 2, 13

Page 44: Building social games

Demo: Social Scoreboard

Thursday, May 2, 13

Page 45: Building social games

Creating a Tournament

DELETE https://graph.facebook.com/USER_ID/scores/

DELETE https://graph.facebook.com/APP_ID/scores/

Delete individual user score

Delete all user scores

Easily delete scores, per-user or all users and run weekly tournaments

Thursday, May 2, 13

Page 46: Building social games

Achievements API

▪Define a set of achievements a player can earn in your game

▪Each achievement can be earned only once

▪Publishes on user’s Timeline, appears in News Feed

Thursday, May 2, 13

Page 47: Building social games

Managing Achievements

<html><head><meta  property="og:type"  content="game.achievement"/><meta  property="og:title"  content="50  Score!"/><meta  property="og:description"  content="Smash  50  friends  in  1  round"/><meta  property="og:url"  content="http://www.friendsmash.com/achievement_50.html"/><meta  property="og:image"  content="http://www.friendsmash.com/images/achievement_50.png"/><meta  property="game:points"  content="50"/><title>Friend  Smash!  -­‐  Achievement:  50  Score!</title></head><body><p>Friend  Smash!  -­‐  Achievement:  50  Score!</p>

<img  src="http://www.friendsmash.com/images/achievement_50.png"  /></body></html>

POST https://graph.facebook.com/me/achievements& achievement=http://site.com/ach1.html& access_token=USER_ACCESS_TOKEN

Thursday, May 2, 13

Page 48: Building social games

Open Graph

Thursday, May 2, 13

Page 49: Building social games

Custom Open Graph Actions for Games

▪Custom actions and objects, tailored to your game

▪Publishes on the user Timeline and Newsfeed

▪Represents core gameplay interactions

▪Allows you to differentiate your game

Thursday, May 2, 13

Page 50: Building social games

2012

Requests Sharing Scores &Achievements

Open Graph

Thursday, May 2, 13