Overview
This example uses basic Quickmatch and Peer-to-Peer networking to creating a cross-platform ball shooting game.
Quickmatch is used to find other players for a match and Networking is used to synchronize player
state such as movement of the balls.
Application Setup
- Open the Project in Unity 5.4.1p1 or later
- Import the OculusPlatform Unity package (Main Menu -> Assets -> Import Package -> Custom Package)
Rift
- Create your Rift application on the Oculus Developer Dashboard
- Copy the Application ID into the Project (Main Menu -> Oculus Platform -> Edit Settings -> Oculus Rift App Id)
GearVR
- Create the GearVR application on the Oculus Developer Dashboard
- Move the GearVR application into the Rift application's App Grouping
- Copy the Application ID into the Project (Main Menu -> Oculus Platform -> Edit Settings -> Gear VR App Id)
- Copy the OSIG files for the GearVR devices you are testing to Assets\Plugins\Android\Assets
Configure Matchmaking
- On the Oculus Dashboard, navigate to the Matchmaking section for your App Grouping
- Click Create Pool
- For the Pool Key use: NORMAL_QUICKMATCH, or if you want to use a different Pool Key, update the constant in MatchmakingManager.cs
- Choose Quickmatch mode
- Enter 2 for Min Users and 3 for Max Users
- Choose None for Skill Pool
- Leave Advanced Quickmatch set to No
- Leave Should Consider Ping Time? at the default setting of No
- Don't add anything under Data Settings
- Click Submit.
Configure Leaderboards
This sample uses two Leaderboards to track player scores. One leaderboard tracks the player that has
won the most games and another tracks who achieved the highest score in a single game. Setup the leaderboards
using the following steps:
- Navigate to your App Grouping section on the Developer Dashboard
- Create a new leadername with the API NAME MOST_MATCHES_WON and sort order Higher is Better
- Create a new leadername with the API NAME HIGHEST_MATCH_SCORE and sort order Higher is Better
Configure Achievements
The sample updates an achievement that counts the number of times a player has won. Follow these steps to create an
achievement that is unlocked when the player has won 10 matches:
- Navigate to your App Grouping section on the Developer Dashboard
- Click on the Create Achievement button
- Set the API Name to LIKES_TO_WIN
- Set an appropriate Title and Description
- Leave the Write Policy as CLIENT_AUTHORITATIVE
- Leave Is Achievement Secret untoggled
- Set the Type to Count
- Set the Target to 10
Upload your builds
Build executables from Unity and upload them to your Application Dashboard
- Rift
- Add the executable and data folder to a zip file
- Upload the zip to the Alpha channel on your Dashboard
- Set the executable name you chose in the zip file
- Add Friends you are testing with as Subscribed Users for the Alpha channel
- GearVR
- Create an android keystore (if you don't have one) so Unity can sign the build. (Player Settings -> Publishing Settings)
- Upload the apk to the Alpha channel on your Dashboard
- Each apk you upload needs a new build number (Player Settings -> Other Settings)
- Add Friends you are testing with as Subscribed Users for the Alpha channel