Photon Fusion 2 Simple FPS
Host Photon's Simple FPS sample (Photon Fusion 2) on Edgegap dedicated servers, one deployment per match, using the Edgegap Simple FPS kit.
Explore how to host Unity projects on Edgegap using techniques from the Simple FPS Multiplayer Sample. Players join a server from the sample's Party menu by typing the deployment's address and Photon region.
This sample shows:
Simple FPS as a dedicated server - one deployment per match, placed close to players.
Party menu join - the Join card takes your deployment FQDN and a Photon region code, Create Game is unchanged.
Direct connections - the server binds
0.0.0.0on port7777, so clients connect directly.One project for both sides - server and client builds share the same scene list.
Server self-stop - when the server process exits on its own, the start script stops the deployment.
✔️ Preparation
Before we start, you will need:
Simple FPS Multiplayer (Photon Fusion) - download and import into a new Unity project.
This sample brings its own Project Settings.
Unity 6000.3 with Linux build modules below, and Windows Build Support (IL2CPP) for clients (requires Visual Studio's C++ workload),
Photon Fusion App ID - find it in your Photon dashboard.
This kit was tested with Simple FPS 2.1.1, Fusion 2.1.1 (build 2177) and Unity 6000.3.11f1 on Windows.
☑️ To build Linux IL2CPP on Windows, add Unity's Linux toolchain in Window / Package Manager / + / Add package by name:
Unity 6000.3 and later:
com.unity.toolchain.win-x86_64-linuxandcom.unity.sdk.linux-x86_64,earlier versions:
com.unity.toolchain.win-x86_64-linux-x86_64.
⚡ Deploy and Connect
1. Add the Kit to Your Project
☑️ Copy Assets/EdgegapSimpleFPS, edgegap/, scripts/, .dockerignore and .gitattributes from the kit to your project root, next to Assets/.
☑️ Paste your Fusion App ID in Tools / Fusion / Realtime Settings.
☑️ Set Peer Mode to Single in Tools / Fusion / Network Project Config.
☑️ Run Tools / Edgegap Simple FPS / Check Project and fix any reported issues.
☑️ Run Tools / Edgegap Simple FPS / Set Up Project. It only changes scene and build settings, and is safe to run again:
Deathmatch:
FusionBootstrapbecomesEdgegapFusionBootstrap(keeping its settings), and Start Mode becomes User Interface,Startup: Party menu's
FusionMenuUIPartybecomesEdgegapPartyMenu(the menu prefab instance is unpacked to allow this),Join card's code field accepts up to 30 characters (letters, digits and dots), and gets a new Region field next to it,
build profile is set to Startup (0), then Deathmatch (1).
✅ You may now proceed to the next step.
2. Build and Upload the Server
☑️ To get started, you'll need to create a free account with Edgegap. No credit card required.
☑️ Build and upload your server with the Edgegap plugin or from a terminal:
☑️ Open Tools / Edgegap Server Hosting. In step 3. Containerize Your Server, click Path To Dockerfile and select edgegap/Dockerfile. Keep Relative Build Path at Builds/EdgegapServer, then Containerize and upload.
☑️ Keep port 7777 / UDP when the plugin creates your app version.
☑️ Find your Container Registry project name and credentials, then log in with docker login registry.edgegap.com.
☑️ Build your server, then package and push the image (Git Bash works on Windows):
package.sh prints the new tag it pushed.
☑️ Create an application and a version for your image. You can also use the kit's examples/app-version.json with POST /v1/app/{app}/version.
The first IL2CPP server build takes about 13 minutes.
You can also build from editor with Tools / Edgegap Simple FPS / Build Linux Server, which builds the same output to Builds/EdgegapServer. See Unity to learn more about building Unity servers.
☑️ Create an application and a version with:
your image and tag,
your Container Registry username and token,
resources 1 vCPU and 2 GB to start,
port
7777, protocol UDP, with port check off.
✅ You may now proceed to the next step.
3. Test Locally
☑️ Build a local image and run it with the variables Edgegap would inject:
☑️ Find log line [edgegap-simplefps] server started: session=f68e011bfb01.pr.edgegap.net photon_region=<code> and join from a client with that session and region, as in the next step.
✅ You may now proceed to the next step.
4. Deploy and Connect
☑️ Start a deployment from the plugin, dashboard, or POST /v2/deployments. Pass your players' public IPs to deploy close to them.
☑️ Find server started: session=<fqdn> photon_region=<code> in your deployment's logs.
☑️ Build a client with scripts/build.sh client (or your usual Windows build), launch it and click Party Menu on the main menu.
☑️ On the Join card, type your deployment FQDN (e.g. f68e011bfb01.pr.edgegap.net) in the code field, and region code (e.g. cae) in the Region field, then click Join.
🙌 Congratulations on your first Deployment on Edgegap!
🔄 Match Lifecycle
Server build skips the Startup menu and loads Deathmatch.
EdgegapFusionBootstrapstarts a Fusion server onARBITRIUM_PORT_GAMEPORT_INTERNAL(7777by default), bound to0.0.0.0, and names the session after the deployment FQDN,<ARBITRIUM_REQUEST_ID>.pr.edgegap.net.Server logs the session name and Photon region, which players type into the Party menu's Join card and connect Direct to the deployment.
When the server process exits on its own,
edgegap/start-server.shcallsARBITRIUM_DELETE_URLto stop the deployment.
See Deployments to learn more.
⚙️ Environment Variables
ARBITRIUM_REQUEST_ID
Edgegap
The session name becomes <request id>.pr.edgegap.net, the deployment's FQDN.
ARBITRIUM_PORT_GAMEPORT_INTERNAL
Edgegap
The UDP port the server binds (7777 by default). It binds 0.0.0.0, so clients connect Direct.
PHOTON_REGION
You (version or deployment)
A fixed Photon region, for example us. When it isn't set, the server uses the region with the best ping from where it runs. This override is not tested yet.
ARBITRIUM_DELETE_URL, ARBITRIUM_DELETE_TOKEN
Edgegap
When the server process exits on its own, the start script uses them to stop the deployment.
See injected variables to learn more.
🔌 Direct Connection
Simple FPS's IP and Port set the address your server binds to. The kit binds 0.0.0.0:7777, Fusion finds the deployment's public address on its own, and clients connect Direct - even though Edgegap gives players a different external port.
Server IP
Result
0.0.0.0 (this kit)
Direct on Edgegap.
127.0.0.1
The server starts, but clients are Relayed through Photon, which adds latency. Nothing outside the container can reach the loopback address.
The deployment's public IP
The server doesn't start (Failed to bind socket), because the container doesn't own that address. Clients get GameNotFound.
🎬 Server Scenes
Fusion tells clients which scene to load by build index. A server built with Deathmatch only would have Deathmatch at index 0, while clients have Startup at index 0. Clients then never find the game objects and throw NullReferenceException in Player.FixedUpdateNetwork every tick. That's why both builds use Startup (0) and Deathmatch (1), and the server skips Startup.
For the same reason, the server marks Deathmatch active on load, like the sample's own host. Without it, clients load Deathmatch but keep Startup active, with the same exception.
⚠️ Known Issues
Playing a match to its end, and whether the server exits after a match, are not tested yet - see the kit's README.
PHOTON_REGIONoverride is not tested yet.
🚨 Troubleshooting
Last updated
Was this helpful?

