This document is about: FUSION 2
SWITCH TO

Quickstart

Package Import

Please follow this step-by-step guide to resolve common problems during package import process.

  1. Create a new Unity 3D project. We recommend using Unity 2022.3.20f1.
  1. Open Package Manager and import BR200 package.
  1. In project settings overwrite warning, select Import.
  1. In package dependencies warning, select Install/Upgrade.
  1. The sample uses the new Input System package which requires Unity Editor to restart, select Yes.
  1. The Unity Editor automatically restarts. Unfortunately the import process doesn't continue, please repeat steps 2, 3, 4. This time you'll not need to restart the Unity Editor again.
  2. On Import Unity Package (Step 1), select Next.
  1. On Import Unity Package (Step 2), select Import.
  1. The package will be imported.
  1. Sometimes Unity throws errors in console with missing renderer feature or Allow 'unsafe' code.
  1. To resolve above errors, open Project Settings and toggle Allow 'unsafe' code off => on.
  1. All errors should disappear from the console and asset import process will continue.
  1. If the Photon Fusion Hub pops up, fill in the Fusion 2 AppId - more info in Project Setup
  1. Open TPSBR/Scenes/Game scene and enter Play mode. Don't save changes in the scene.
  1. If the import process finished incorrectly and Library is in broken state, you'll see exceptions in console and the player won't handle a weapon in game vies. We need to fix that.
  1. Select all prefabs in TPSBR/Prefabs folder (including subfolders). This forces Unity to load all prefabs.
  1. Select Tools/Fusion/Run Weaver.
  1. Select Tools/Fusion/Rebuild Prefab Table.
  1. Reimport TPSBR/Prefabs folder.
  1. Restart Unity editor and try playing TPSBR/Scenes/Game scene again. Now there should be no runtime errors/exceptions in the console and the player should handle a weapon.
  1. If the process above didn't help, close the editor and try deleting Library folder.

Project Setup

To run the sample, the Fusion 2 AppId needs to be assigned in the PhotonAppSettings asset.

First, create a Fusion 2 AppId in the Photon Engine Dashboard and paste it into the App Id Fusion field in the PhotonAppSettings (reachable from the Tools/Fusion/Realtime Settings menu or directly modifying file Assets/Photon/Fusion/Resources/PhotonAppSettings.asset).

PhotonAppSettings

Starting The Game

Open the Menu or Loader scene in Assets/TPSBR/Scenes, enter the play mode and hit Play button.

Join an existing game or create a new one by hitting the Create Game button. The Quick Play button works only with the Game Server Hosting platform provided by Unity.

Gameplay Debug Start

You can play any gameplay scene directly. The Standalone Manager GameObject in the scene determines the type of game started. Standalone Manager values can be changed to run the game in a preferred configuration.

Standalone Manager

To start the game with multiple players in a single editor check the Multipeer Mode section.

Controls

Key Action
W,S,A,D Move
SPACE Jump / Thrust with jetpack
1,2,3 Switch weapons
4 Cycle grenades
Q Fast weapon switch
F Interact / Drop weapon (hold)
X Toggle jetpack
E Toggle camera side
Left Mouse Button Fire
Right Mouse Button Aim
Enter Lock/unlock cursor (Editor)
Ctrl + Enter Lock/unlock cursor (Build)

Running The Server

You can start BR200 from the command line as a headless server instance.

Command Line Arguments

Argument Description
-host Starts host
-dedicatedServer Starts dedicated server
-client Starts client(s)
-deathmatch Starts deathmatch gameplay mode (valid for server/host only)
-elimination Starts elimination gameplay mode (valid for server/host only)
-battleRoyale Starts battle royale gameplay mode (valid for server/host only)
-region [STRING] Custom Photon region (optional), eu/us/usw/...
-extraPeers [INT] Additional clients started within same process
-serverName [STRING] Custom server name shown in game list
-maxPlayers [INT] Max players allowed to join the game
-sessionName [STRING] Custom session identifier
-lobby [STRING] Custom matchmaking lobby name
-scene [STRING] Which scene should be loaded (GenArea2|GenArea3|GenArea5|GenArea7)
-stripped Enables extra runtime optimizations to maximize batch client count handled by single process
-ip Custom IP address the server binds to
-port Custom port the server binds to
-fps [INT] Sets Application.targetFrameRate to a given value
-moderator Starts the game with moderator rights (can control creating game and moderating in public builds)
-dataPath Custom output directory path
-recordSession Record logs and performance stats for current session
-generateInput Generates random input, used only in combination with -stripped
-multiplay Activates Multiplay Manager (Unity Game Server Hosting)
-backfill Use Backfill service (joining players to existing matches, server only)
-sqp Use Server Query Protocol (SQP)
-matchmaking Use Unity Matchmaker
-queueName [STRING] Custom Matchmaker queue name

Examples of local headless server command line arguments:

BR200.exe -batchmode -nographics -dedicatedServer -logFile DeathmatchServer.txt -deathmatch -maxPlayers 60 -scene GenArea3

BR200.exe -batchmode -nographics -dedicatedServer -logFile BattleRoyaleServer.txt -battleRoyale -maxPlayers 200 -scene GenArea7

Project Structure

Assets

Path Description
3rdParty/ Third-party assets
Photon/ Fusion libraries and addons
TPSBR/ Sample specific files, scripts and derived assets
Extras.zip Additional tools for profiling

Scenes

Scene Description
Loader Initial scene, minimalistic (fast to load), checking command line arguments, loads to menu or a specific gameplay scene
Menu Default menu scene
LoadingScene Scene with a loading screen to fade between menu and gameplay scenes
Game Small static testing scene for debugging and feature iterations
GameplayUI Scene with separate gameplay UI, loaded additively
GenArea2 Small map for 20 players, generated at runtime
GenArea3 Medium map for 60 players, generated at runtime
GenArea5 Large map for 120 players, generated at runtime
GenArea7 Very large map for 200 players, generated at runtime
The difference between GenArea2 - GenArea7 is only in level generation values set up on the NetworkGame object.
Back to top