Game Development Reference
In-Depth Information
8.5 The Social Mechanic
Whether you are playing a game on a mobile device, desktop computer, or
console, nowadays it is difficult to escape the social element. From creating
personalized 3D avatars on Xbox live to inviting friends to farm virtual pastures
on Facebook, the opportunity to boast about your fortunes (or misfortunes) in
computer games now expands much farther than your immediate family and
friends. Most computer games proudly display the Twitter, Facebook, MySpace,
OpenFeint, and other icons on their menu screens—encouraging you to share
your gaming experiences with the wider community.
As online social networks have been developed by other parties, it's not
always an easy process to integrate your game with their system. Fortunately,
many developers provide application programming interfaces (APIs) for you
to use in your own code. These are plug-and-play functions that you can call
in your script to access their system's functionality.
This section looks at two popular social network APIs and how they integrate
with Unity.
8.5.1 Twitter
Twitter is a Web service allowing people to post a message 140 characters
long to a Web site. The message isn't for anybody in particular, although
Twitter allows other subscribers to follow the messages of another. In a
way it is a method for posting your thoughts at any time into cyberspace
for nobody or everybody to read about. The Web site was
founded by Jack Dorsy and was launched in July 2006. Since then it has
grown to over 200 million users posting around 200 million messages
(called tweets) a day.
Twitter has its own API allowing other applications to retrieve twitter data.
This API can be run as a URL typed into a Web site. For example, at the time of
writing, typing
into a Web browser will return the text shown in Listing 8.8 —the last two
tweets by Ashton Kutcher, supposedly the most followed person.
Listing 8.8 Data about the Last Two Tweets Posted
by Ashton Kutcher
image":true,"protected":false,"location":"Los Angeles,
6a00d83451f25369e2012877a0864a970c.jpg","url":" http:\/\/
Search Nedrilad ::

Custom Search