The Oculus Platform SDK sample apps are provided examples of how to initialize the SDK, perform the entitlement check, and implement some of the platform features.
These sample apps can be used either as a reference for integrating the Platform SDK in your app, or as a foundation that you can use to build your VR experience.
The features implementations are similar with native and Unity apps, so review all of the apps below, even if they are using a different development platform.
To run the samples you will need the following:
If you’re creating both a Rift and mobile application, you can move the mobile application into the Rift application’s App Grouping. Then, copy the OSIG files for the mobile devices you are testing to
Assets\Plugins\Android\Assets. This will allow cross-platform interactions between Rift and mobile device users. The Unity samples: VRHoops, VRVoiceChat, and VRBoardGame support cross-platform interaction.
To get started using the native sample apps, download the latest version of the Platform SDK from the downloads page. You can find native samples in the Samples folder of the SDK download.
The CloudStorageExample demonstrates how to use Cloud Storage to save game information.
Gameplay in the app is a simple game of chance, encountering the largest random integer. See
RandomGame::Tick for the details.
Three different saves are stored in the cloud and loaded at startup:
In this app, the
PlatformManager class polls the
LibOVRPlatform message queue for messages, and forwards all the Cloud Storage messages to the
CloudStorageManager transitions the game to running over after it loads all the saved metadata and data. The data in the “Latest High Score” and “Overall Highest Score” buckets are simple to deal with since you don’t need to perform any conflict resolution from multiple devices.
The save stored in the “Local High Scores” bucket is more complicated because it demonstrates handling conflicts that arise from loading both saved files and merging them together.
The Platform SDK also contains the following samples that demonstrate matchmaking, and chat features:
Review the code comments to understand more about these samples.
You can find the Unreal sample in the Samples folder of the Platform SDK download. The Unreal OculusPlatformSample demonstrates how to use a number of platform features in Unreal, using both blueprints and code. OculusPlatformSample includes Achievements,Leaderboards, OSS Sessions - Rooms and Matchmaking, and Voice Chat (VoIP).
The Platform SDK samples for Unity are a part of the Oculus Integration Asset package for Unity.
For information on how to import the asset package, see Import the Unity Package.
Once you have imported the Oculus Integration package, find the samples in the Unity Project Window, under Assets > Oculus > Platform > Samples. The following image shows an example:
VRBoardGame demonstrates the use of Commerce (IAP) and skill-based Matchmaking. VRBoardGame is a simple two player game set on a 3x3 grid with two pieces and a special ‘power-piece’ that can be acquired with an in-app purchase through the Oculus Store. After an online match is completed, the ranking is sent to the matchmaking service so future match selections will take the user’s skill level into account.
VRHoops uses simple Matchmaking and Peer-to-Peer Networking to create a cross-platform ball shooting game. Simple matchmaking is used to find other players for a match and P2P is used to synchronize player state such as movement of the balls. Also, VRHoops also includes Leaderboards to track player scores and Achievements to track how many times a player has won.
Please see the readme file included with VRHoops for information on how to configure Matchmaking, Achievements, and Leaderboards in the sample app.
Avatar Social Starter Sample
The Unity Social Starter example scene demonstrates using Oculus Avatars together with Oculus Platform features such as invites, peer-to-peer networking, and VoIP. You can find the Social Starter sample in the Avatar samples (Assets > Oculus > Avatar > Samples), also available in the Unity package. See the Unity Social Starter Example page for details.