Game Development Reference
In-Depth Information
The steps are fairly simple as you might have experienced in any standard instant
messenger. The pending notifications are kept on the server until the recipient
(Player B) responds. The pending notification may be purged in case the recipients
don't respond in a certain time period. The friendship relation is kept in a different
object or a database table, shown as follows:
Note that other additional properties may also be tracked, such as the date
when players became friends, a status field to keep track if the friendship is fully
established or is still pending, etc.
Another important function for a game server to perform when an avatar logs into
the game is to send notifications letting the friends know that the avatar is now
online and also to let the entering avatar know of all the friends that are currently
online. The game server also sends out similar notifications when an avatar logs out
of the game.
Friends in Hello World
In Hello World, we leave all the default behavior related to friends up to the PulseUI
framework. That is the reason why we don't see any code in the Hello World project.
The friends API
As you may have seen in any standard instant messenger, making friends starts
with a player requesting to add another player as a friend. The recipient may accept
or reject the offer. If accepted, the friendship is formed until one of them decides to
terminate the relation.
One of the API methods to make new friends or break existing friends is as follows:
public function makeFriend(avatarName:String):void
public function respondToFriendInvite(accept:Boolean,
avName:String):void
public function breakFriend(avatarName:String):void
 
Search WWH ::




Custom Search