Caution: Fraudulent or imitation websites may appear. Only this site is official. Report concerns on our Report Fraud page.
Room Codes allow players to create and join private multiplayer rooms using short, shareable codes.
This system is essential for VR fangames because it gives players a simple, reliable way to play with friends without relying on random matchmaking.
This page explains how Room Codes work, how Photon handles them, and how your game should generate, validate, and join rooms using custom codes.
1. What Room Codes Are
A Room Code is a short string (usually 4–6 characters) that uniquely identifies a Photon room.
Examples:
ABCD
TREE
M0NK
GHOST1
Players can:
Create a room with a code
Share the code with friends
Join the room instantly
Room Codes make private lobbies simple and intuitive.
2. How Room Codes Work in Photon
Photon rooms have a built‑in property called Room Name.
Your Room Code is the room name.
Creating a room
You create a room using:
RoomOptions
A custom room name (the code)
Joining a room
Players join using:
PhotonNetwork.JoinRoom(roomCode)
Photon handles the rest.
3. Generating Room Codes
Room Codes should be:
Short
Easy to read
Easy to say out loud
Avoid confusing characters (0/O, 1/I/L)
Unique enough to avoid collisions
Common formats:
4 letters
5 letters
4 letters + 1 number
6‑character alphanumeric
Example generation rules:
Only uppercase letters
No vowels (to avoid accidental words)
No similar‑looking characters
4. Creating a Room With a Code
When a player hosts a private room:
Generate a code
Use it as the Photon room name
Create the room with PhotonNetwork.CreateRoom(code)
Set room properties (map, mode, max players)
Spawn the host player
Photon automatically registers the room in the lobby.
5. Joining a Room With a Code
When a player enters a code:
Validate the code format
Attempt to join the room
If the room exists → join
If not → show “Room not found”
If full → show “Room is full”
If closed → show “Room is closed”
Photon handles the join logic internally.
6. Room Code Validation
Before joining, validate:
Length
Allowed characters
No spaces
No lowercase letters
No invalid symbols
This prevents invalid join attempts.
7. Room Code Security
Room Codes are not meant to be secure.
They are meant to be easy.
For secure rooms:
Use PlayFab authentication
Use staff‑only flags
Use room properties to restrict access
Use CloudScript to validate staff permissions
Room Codes are simply identifiers, not passwords
8. Best Practices
Keep codes short (4–6 characters)
Avoid confusing characters
Validate codes before joining
Use uppercase only
Show clear error messages
Allow players to regenerate codes
Use room properties to store metadata (map, mode, etc.)