Devlog #1 - Photon Unity Networking
For networking, I chose Photon PUN, designed for multiplayer games which offers matchmaking and room creation functionalities. The goal is to establish a connection to the master server, allowing players to join a lobby before expanding onto creating/joining rooms. I decided to set up the photon networking first so the gameplay programmers can start creating the player mechanics and sync them across the network.
Why Photon PUN?
I chose the PUN framework as it's tightly integrated with Unity which makes it easy to set up and use. PUN makes it easy to create lobby-based or room-based multiplayer systems.
My Plans for this Week?
Photon Pun Networking | Tasks |
Set up Photon | Create Pun App
Setup Photon in Unity |
Connecting | Create ConnectToServer Script
Allow players to input their nickname Connect to Master Server |
This week, I planned to set up photon in Unity and create a simple script which connects to the master server.
Getting Started with Multiplayer: Connecting to Photon PUN
One of the first challenges is setting up a seamless connection system. Using Photon PUN, I've implemented the core mechanics that allow players to connect to a game effortlessly.
The first step was integrating Photon PUN into the project to handle networking. With this, the game can connect to the Photon Master Server, ensuring a stable multiplayer experience without the need for dedicated servers.
Setting Up the Master Server Connection
The ConnectToServer script allows the player to enter a nickname and connect to the server

PhotonNetwork.ConnectingUsingSettings();
This will establish a connection to the Photon server using the settings saved in the PhotonServerSettings file. This file was configured in the unity editor when Photon was setup.
public override void OnConnectedToMaster() { SceneManager.LoadScene(LOBBY_SCENE); }
This function is a pun callback which calls automatically when the client is connected to the master server and is ready to join / create rooms.
Creating a Unique Username
To make things more personalised, I added a simple system that lets players create their own nickname. This name is then stored and displayed in the lobby.
public void OnConnect() { if(username.text.length >= 1) { PhotonNetwork.Nickname = usernameInput.text; buttonText.text = "Connecting..."; PhotonNetwork.AutomaticallySyncScene = true; PhotonNetwork.ConnectUsingSettings(); } }
This function takes the input text from the player and makes it the photon nickname. This nickname is stored so it can be displayed in the lobby and during gameplay.
Connecting to the Lobby
Once a player has set their nickname, they can click the "Connect" button. This action takes them directly to the game lobby, where they can see other connected players. and prepare to jump into a match.
Next Steps...
The next step is to implement a lobby where players can join and create their own rooms. These rooms will allow players to join, leave and start the game.
References
Photonengine. Setup and Connect (Version PUN 2). Available at: https://doc.photonengine.com/pun/current/getting-started/initial-setup (Accessed: 10th February 2025).
Photonengine. Introduction (Version PUN 2). Available at: https://doc.photonengine.com/pun/current/getting-started/pun-intro(Accessed: 10th February 2025).
Dice & Domination
Status | In development |
Author | Shivani |
More posts
- Devlog #4 - Playfab Setup13 days ago
- Devlog #3 - Room Creation24 days ago
- Devlog #2 - Lobby38 days ago
Leave a comment
Log in with itch.io to leave a comment.