Skip to content
This repository has been archived by the owner on Dec 15, 2017. It is now read-only.

Commit

Permalink
Unity Friend Smash refresh 2015
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris Lewis committed Dec 3, 2015
1 parent 18db3a7 commit e6b403b
Show file tree
Hide file tree
Showing 1,520 changed files with 34,216 additions and 44,896 deletions.
44 changes: 36 additions & 8 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,37 @@
friendsmash_payments_start/OG/
friendsmash_payments_complete/OG/
*Assembly-CSharp*
*/Assets/Examples*
*/Assets/Facebook*
*/Assets/Plugins*
*/Library*
*.sln
# =============== #
# Unity generated #
# =============== #
[Tt]emp/
[Oo]bj/
[Bb]uild
[Ll]ibrary/
[Dd]ebug/
[Rr]elease/
sysinfo.txt
*.stackdump

# ===================================== #
# Visual Studio / MonoDevelop generated #
# ===================================== #
[Ee]xported[Oo]bj/
.vs/
*.userprefs
*.csproj
*.pidb
*.suo
*.sln*
*.user
*.unityproj
*.booproj

# ============ #
# OS generated #
# ============ #
.DS_Store*
._*
.Spotlight-V100
.Trashes
Icon?
ehthumbs.db
[Tt]humbs.db
Desktop.ini
56 changes: 56 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# Friend Smash sample Facebook game

Authors:
- Colin Creitz (ccreitz)
- Marco Alvarez (marcoa)
- Andy Borrell (andyborrell)
- Chris Lewis (cmlewis89)

## Overview
To help better understand different products and services available to game developers, Facebook maintains a sample game called Friend Smash!

The game is implemented on different platforms:

* Web using [Facebook SDK for Javascript](https://developers.facebook.com/docs/javascript)
* Mobile using Facebook's native SDKs for [iOS](https://developers.facebook.com/docs/ios) and [Android](https://developers.facebook.com/docs/android)
* It is also available as a Unity cross platform build using the [Facebook SDK for Unity](https://developers.facebook.com/docs/unity).

There are minor differences between the four implementations, but overall the goal and structure of all is similar. This is the Unity version of the game.

## What is “Friend Smash!”?
Friend Smash is a simple game which utilizes Facebook platform to enhance the gameplay by making it more fun and social. It uses variety of products and services, such as [Facebook Login](https://developers.facebook.com/docs/facebook-login), [Graph API](https://developers.facebook.com/docs/graph-api), [Game Requests](https://developers.facebook.com/docs/games/requests/) and [Sharing](https://developers.facebook.com/docs/games/sharing). The code examples serve as a guide of how they may be used in a games context. It also serves as an implementation guide - parts of source code relevant to Facebook integration are clearly separated from the pure gaming-logic and clearly documented with in code comments.

Please note that Friend Smash! was not designed as an example of how to design or code a game. The focus is on Facebook integration - other parts of the project may not be as clear and well designed and documented.

Friends Smash! is a game in which players are tasked with "smashing" (mouse-clicking or screen-tapping) pictures of a specific person while avoiding smashing pictures of anyone else. Player gets points for each correct picture smashed. Each miss or wrong smash causes the player to lose a heart. After losing 3 lives, the game is over. Player can also smash images of coins to collect them and later redeem these coins to buy bombs. In turn, bombs can be used in game to smash all correct pictures on the screen, helping to achieve a higher score. Additionally, the web version of the game allows players to purchase coins with Facebook Payments.

## Facebook integration
To make the experience more fun and social, players are asked to log in with Facebook and grant [user_friends](https://developers.facebook.com/docs/facebook-login/permissions/#reference-user_friends) permission. When granted, the game will have access to subset of player's friends data, specifically those who also logged in to Friend Smash! and granted user_friends permission. This means the game will use the profile picture of randomly selected friend as the picture the player is asked to smash. If user_friends permission hasn’t been granted or the player doesn't have friends who also logged in to Friend Smash! and granted user_friends permission, a picture of randomly selected celebrity is used instead.

At different points in the game player has an opportunity to share to Facebook. For example after the game is over, player can brag about the score achieved by posting a custom [Open Graph story](https://developers.facebook.com/docs/games/opengraph). The game also shows how to ask for [publish_actions](https://developers.facebook.com/docs/facebook-login/permissions/#reference-publish_actions) permission (which is required for API based sharing) and how to handle the case when publish_actions permission is not granted. If publish_actions permission is granted - the game uses [Scores API](https://developers.facebook.com/docs/games/scores) to publish and store the top score achieved by the player.

[Game Requests](https://developers.facebook.com/docs/games/requests/) are used in the game for two main purposes. First to let the player invite their friends who are not playing the game to try it. Second, to send a challenge to a friend who is already playing to bring them back to the game.
Additionally on the web version, the game uses [Facebook Payments](https://developers.facebook.com/docs/payments) to allow players to purchase in-game currency and [In-Game Gifting](https://developers.facebook.com/docs/payments/ingamegifting) to allow purchasing gifts for players’ friends. The web example also includes reference implementation of a payments server handling static pricing and payments verification.

Friend Smash! also logs [App Events](https://developers.facebook.com/docs/app-events), which enables Facebook [Analytics for Apps](https://developers.facebook.com/docs/analytics) - a free tool allowing developers to learn how people use their app across all platforms and devices, get insights about the people using the app, and improve marketing.

## How to use “Friend Smash!”?
All versions of Friend Smash! are available as part of [Facebook Platform Samples](https://github.com/fbsamples) on github:
[Web](https://github.com/fbsamples/web-friend-smash), [Android](https://github.com/fbsamples/android-friend-smash), [iOS](https://github.com/fbsamples/ios-friend-smash), [Unity](https://github.com/fbsamples/friendsmash-unity).

The recommended way to explore the projects is to begin with how Facebook products are integrated. To make it easier code responsible for Facebook integration is separated and well documented with in code comments for all versions. You can find it here for different versions: Web, Android, iOS, Unity. The reference implementation of a payments server is included in the Web repository.

To play the Unity version of Friend Smash! on Web, simply go to [apps.facebook.com/friendsmashunity](https://apps.facebook.com/friendsmashunity). To play it on mobile, download the Android, iOS or Unity project and build it from source and try on your device.

Please note it is likely that unless you have friends who also installed Friend Smash! you will not see any of your friends in the game. If this is the case, you can invite some of your friends to play Friend Smash! to fully explore how social integration works in Friend Smash!

## Installing
Before running the sample, please see the [Getting Started on Unity guide](https://developers.facebook.com/docs/unity/gettingstarted).

When deploying to the web, update [config.php](https://github.com/fbsamples/friendsmash-unity/tree/master/server/config.php) with your Facebook app and server configuration.

## Additional Resources
* Facebook SDK for Unity [documentation](https://developers.facebook.com/docs/unity)

## Contributing
All contributors must agree to and sign the [Facebook CLA](https://developers.facebook.com/opensource/cla) prior to submitting Pull Requests. We cannot accept Pull Requests until this document is signed and submitted.
9 changes: 9 additions & 0 deletions friendsmash/Assets/Animations.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit e6b403b

Please sign in to comment.