Starting Photon in 5 Minutes
Photon is extremely easy to install and start. The SDK includes ready-to-use binaries that can be up and running within 5 minutes.
Contents
Step-By-Step
- Download: The Photon Server SDKs are available on the download page of our website.
- Extract: The Server SDK comes as a self-extracting executable. This keeps included ".dll" files from being flagged as "untrustworthy" by some unzip tools. You can extract the server package to any place - preferably an empty folder which you prepared beforehand.
- Get a license: Photon Server requires a license to work. But don't worry you can get a 100 CCU license for free here. Claim it and download it to "deploy\bin_Win64". See licenses page for more information.
- Start PhotonControl: Start "PhotonControl.exe" and confirm the admin rights for this application. They are needed for the option to set up Photon as a Service. Look out for the tray-bar icon (bottom right by default). Click the white/grey icon to open a menu that controls Photon. Read more about photoncontrol.
- Start LoadBalancing instance.
Pick
LoadBalancing (MyCloud)
from the Photon Instances and "Start as Application". Now you have started Photon.Photon Control: Start "LoadBalancing (MyCloud)" as application - Connect your clients: Now you can connect any client you want to the server locally on the same machine. If you want to connect clients from the same network or from a different network, an extra step is needed, see IP Address Config.
SDK Overview
The SDK contains several folders.
The "deploy" folder contains the binaries. This is what you need at least to run Photon. The folders "doc", "lib" and "src-server" (applications) are for development.
Deploy Folder
Everything needed to run Photon Server is in the "deploy" folder.
Binaries
We refer to "deploy\bin_Win64" as the binaries folder. This folder contains:
- PhotonSocketServer.exe: the actual Photon server executable.
- photonserver.config
- photoncontrol.exe
- Photon Server license file. read more about licenses.
You can start the server with command-line arguments or you can use PhotonControl.
Tools
The "deploy\bin_tools" folder currently contains useful tools:
- 7zip: Archive creation and extraction tool used to compress debug info files.
- baretail: Our favorite log viewer in the free edition. It is used by PhotonControl to view the latest logs.
- firewalltool: Tool to automatically set rules for Photon in Windows Firewall.
- perfmon: Contains a list of PerfMon counters used when you set up counter logging to a file. This is explained here.
Applications
Photon requires a separate folder next to the binaries folder per application (e.g. "deploy\NameServer"). The assemblies must be in a "bin" sub-folder (e.g. "deploy\NameServer\bin").
Applications are set up in photonserver.config.
LoadBalancing Instance
Photon is designed to run "Applications" as game logic. They define what a client can do or can't (e.g. for matchmaking). Applications run cooperatively for different tasks.
Out of the box, Photon comes with LoadBalancing (MyCloud) application which is the preferred setup and compatible with the Photon Cloud and PUN.
Starting LoadBalancing (MyCloud)
is the way to go for clients done with PUN, Photon Voice or Photon Realtime (also known as the "LoadBalancing Client API").
Actually this setup will start three separate Photon Applications: NameServer
, Master Server
and Game Server
.
The NameServer redirects you to a Master Server.
When a new room gets created or when a room exists and can be joined, the Master Server will forward the client to the Game Server.
IP Address Config
Using a local IP means that only clients in the same local network can connect. You need to use a public IP if players from the internet should be able to connect and join games.
If your server is in a LAN but your clients use WiFi, they might be in distinct networks. If your client can't reach the server, check if your router allows connections between WiFi and LAN. Check if all devices are in the same IP range.
No matter if you choose a local network IP or a public one, you also have to set up your firewalls, routers and switches. Sadly, we can't help here, due to the amount of different hardware and software. In the easiest setup, multiple test machines are connected by the same switch/router.
Master Server IP Config
In the PhotonControl menu select "Edit Nameserver.json". This will open "deploy\Nameserver.json" in a text editor. Set the IP address or hostanme in one of the fields of the available node. Optionally change the region token.
Game Server IP Config
In the PhotonControl menu select "Game Server IP Config". The IP addresses of the host machine will be listed, marked as "public" or "local". Select one.
The entry "Autodetect public" makes the server detect a public internet IP when Photon starts.
The Game Server IP Address is saved in "deploy\LoadBalancing\bin\GameServer.xml.config".
It can be edited manually, too.