Getting started with the Facebook SDK for PC Games

This guide will walk you through setting up an application in order to use our C++ SDK for Windows Games.


Create a Facebook App

If you do not already have one, you will need to create and register an application our Facebook Developer Portal

Create a Facebook App

Configure your Facebook app

The SDK requires some settings and functionality from Facebook Web Games to function. You can find these under Settings > Basic > Facebook Web Games.

Under the Facebook Web Games URL (https) setting, enter https://localhost/ as shown here:

Change the Facebook Login OAuth settings. Click Add Product in the left side navigation menu to add the Facebook Login product to your app.

Find Facebook Login in the list of products, and click Get Started.

Skip the Get Started guide and go directly to Settings in the Facebook Login card. You should set Client OAuth Login, Web OAuth Login, and Embedded Browser OAuth Login to Yes and append{YOUR_APP_ID} to Valid OAuth redirect URIs.

Add C++ Dependencies

Unzip the downloaded SDK and add the following files to your C++ project:

  1. All header files provided in the directory \include\*.h
  2. Add LibFBGPlatform.lib from the directory \lib\ into your library path.
  3. The necessary DLLs are included in the x86_64 folder.

(Optional) Unity Project Setup

If you are using the Unity game engine, you can use the included Unity wrappers included in the Unity Wrappers subfolder of the SDK.

Attach the included scripts to a MonoBehaviour object that should stay enabled throughout your game.

To enable Facebook Live streaming, attach the included Capture MonoBehaviour script to a camera in the scene containing the appropriate view.

Initialize the SDK

Before performing any platform calls, you will need to add the following initialization call in your game's source code:

auto initializeResult = fbg_PlatformInitializeWindows(appID);
if (initializeResult != fbgPlatformInitialize_Success)
  // display error message