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.
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:
The Photon Server requires a valid license to run.
Claim it and save 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.
PickLoadBalancing (MyCloud)
from the Photon Instances and "Start as Application".
Now you started Photon. The server should be ready when PhotonControl tray icon becomes blue like Photon's logo. - Connect your clients:
Now you can connect clients running on the same machine. - Configure server IPs: To connect clients from a local network, simulated device or the public internet, change the IP Address Config.
The Master Server address and the Game Server address for Photon are set in config files. Stop and start the server to apply changes.
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.
Address Config
There are three roles for the Photon Server: Name Server, Master Server and Game Server. Clients are sent from one to another via IP or host address.
By default, the local loopback IP is used for all three roles, so clients from another device or the public internet will fail to connect.
Stop and start the server to apply changes.
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.
You need to use a public IP if players from the internet should be able to connect and join games.
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 Address Config
In the PhotonControl menu you can click "Edit Nameserver.json" to 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 Address Config
The Game Server IP is configured in "deploy\LoadBalancing\GameServer\bin\GameServer.xml.config" in the node PublicIPAddress
. The node PublicHostName can be set to a host name.
Alternatively use the PhotonControl menu "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.
Back to top