This sample game was started from Photon's Fusion Battle Royale Sample
The original Photon Fusion BR200 was a AAA and production-ready third-person battle royale shooter game sample. We have added integration to deploy a Photon Fusion dedicated server on Hathora Cloud. By deploying your Photon Fusion game on Hathora Cloud you unlock all the benefits of dedicated servers (cheat protection, improved latency, more stable connections), while also gaining access to 10+ global regions that map nicely with Photon Cloud's regions.
- Hathora SDK
- Hathora high-level wrappers
- HathoraServerConfig build, deployment and room management utils
Check it out to learn more about hosting Photon Fusion on Hathora Cloud and accessing the Hathora SDK. We have made a few modifications to make this game easily deployable with a dedicated server on Hathora Cloud.
Click to expand/collapse contents
- select
Codeand select the 'Download Zip' option. Please note that this will download the branch you're currently viewing on Github
-
This sample game is compatible with the latest Unity Long Term Support (LTS) editor version, currently 2021 LTS. Please include Linux Dedicated Server Build Support in your installation, as well as Linux Build Support (Mono).
-
Photon account with an active app created (for
App Id Fusion). -
Hathora Cloud account with an active app created (for
AppId).
-
If building your Linux headless server via
HathoraServerConfig, the Dockerfile will automatically add the-argsnecessary to start "as a server- To see the default args, see ./hathora/Dockerfile - or the official Photon docs
-
Use the Hathora Unity plugin to configure, build, and deploy your server on Hathora Cloud via
Assets/Hathora/HathoraServerConfig. See Hathora Unity Plugin- After setting up, serialize @
Menuscene'sHathoraManagerGameObject'sHathoraServerConfig. - At the same spot, also serialize
HathoraClientConfignext to the same file.
- After setting up, serialize @
-
Once deployed, create a room in Hathora Cloud via any method:
- Create via
Menuscene (as a Client): Click "Create" button at the bottom-right (adds a browsable Lobby) - via
Hathora ServerConfig: Click "Create Room" button in the "Create Room" dropdown group - via Hathora Console in your browser at the top-right
- Play the
Menuscene and join the new Room that appeared in a browsable Lobby list.
Within this repro, we have already made changes to support Hathora. However, if you are interested in the core changes, in order of importance:
-
Asssets/TPSBR/Scripts/Networking/Networking.cs
- At
ConnectPeerCoroutine(), if Server GameMode: Get Hathora Cloud Proccess/Room info to set PhotonstartGameArgs. Server name, max # of players, etc.
- At
-
Assets/HathoraPhoton/HathoraMatchmaking.cs
- We override Photon's
Matchmaking.csto check if the user created a new Lobby from theMenuscene. Pure Photon will have the user be both a Client and Server. In Hathora, we want to create a dedicated server in the cloud (rather than have the player host as a server).
- We override Photon's
-
Assets/TPSBR/Scenes/Menu.unity
- Added HathoraManager GameObject with manager scripts.
- (!) Serialize your selected
HathoraServerConfig&HathoraClientConfigfiles here! - Added
HathoraCreateDoneTxt&HathoraCCreateStatusTxtfor status texts. - Renamed
Matchmakingprefab toHathoraMatchmaking-> SwappedMatchmaking.cswithHathoraMatchmaking.cs.- When the users clicks "Create": instead of locally hosting as a server, we'll create a Hathora Cloud dedicated server (Room with Lobby) and show the Lobby list.
- (!) Serialize your selected
- Added HathoraManager GameObject with manager scripts.
Within the demo, we have included HathoraRegionMap.cs to map the following Photon<>Hathora regions:
<< Photon : Hathora >>
- "us" : Washingington DC
- "usw" : Seattle
- "asia" : Singapore210
- "jp" : Tokyo
- "eu" : Frankfurt
- "sa" : SaoPaulo
- "kr" : Singapore
-batchmode| Unity arg to run as headlesss server-nographics| Unity arg to skips shaders/GUI; requires-batchmode-dedicatedServer| Photon arg to automatically start as dedicated server-deathmatch| Photon arg to automatically startdeathmatchgame mode-maxPlayers 5| Photon arg-scene GenArea2| Photon arg-region us| Photon arg; see Photon<>Hathora mapping in the section below-serverName hathoraDeployedServer| Shows up in the lobby List under name-sessionName hathoraDeployedServerSession| Photon arg; unknown use (arbitrary?)-port 7777| The default and recommended Docker container port-mode server| Hathora arg to start as Server when using aHathoraArgHandlerscript; unnecessary in Photon.
- Report bugs in the sample game using Github issues
- For a deep dive into Hathora Cloud, visit our documentation site.
- Learn more the Photon Fusion BR Demo.
For help, questions, advice, or discussions about Hathora Cloud and its samples, please join our Discord Community. We have a growing community of multiplayer developers and our team is very responsive.
Hathora Unity Plugin (with FishNet and Mirror demos) is our Unity Plugin that comes with FishNet and Mirror networking demos. It allows you to deploy your game on Hathora Cloud directly from our editor plugin.
@hathora/unity-ngo-sample takes Unity's 2D Space Shooter sample game with Unity NetCode for Game Objects (NGO) and modifies it to be easily deployable on Hathora Cloud.