Frequently Asked Questions
- Which Photon Product Is The Right One For Me?
- What Is The Difference Between Photon Realtime And PUN?
- What Is The Difference Between LoadBalancing API And Photon Realtime?
- Photon Cloud
- Load Balancing
- What Is The Maximum Number Of Players Supported By Photon Rooms?
- Is There A Limit For Photon Strings?
- Is There A Limit For The Number Of Custom Properties?
- Can I Send A Huge Message Using Photon?
- Which Data Should Be Sent Reliably And Which Should Be Sent Unreliably?
- Why Do I Have So Many Disconnects In My Game?
- How Messages Per Second Per Room Are Calculated?
- How Do I Calculate Traffic Consumed By A User?
- How To Quickly Rejoin A Room After Disconnection?
Which Photon Product Is The Right One For Me?
This is a difficult question to answer as it depends on the game you are making and the specifics of your project. However we can recommend the following:
- Watch this talk by our CTO and founder Chris Wegmann at Unite Europe 2017
- Read the comparison page: "PUN vs. Bolt"
- Read the comparison page: "Photon Cloud or Photon Server?"
Feel free to reach out to us if you still have questions.
What Is The Difference Between Photon Realtime And PUN?
Photon Realtime wraps up all generic features needed for the load balancing of Photon. It is a product as much as a defined workflow to use Name Server, Master Server and Game Servers. Photon Realtime (a.k.a. LoadBalancing) is the basis for many games using Photon.
While Photon Realtime is independent from Unity, PUN adds many comfortable features for Unity and makes Realtime (the lower level) even easier to use.
Both products share the same backend, same server applications, same low-level stuff, same core concepts. At first PUN was meant to be a better UNet (old Unity Networking): preserve a similar API with a more solid backend and rich features. Then it slowly diverged and became the number 1 solution for multiplayer on Unity.
While we do have a Photon Realtime Unity SDK, PUN has more high level out-of-the-box features like:
- Magic Unity callbacks
- Extra Unity components that serialize and sync. networked objects for you: most important one PhotonView
- Offline mode
Read more here.
What Is The Difference Between LoadBalancing API And Photon Realtime?
LoadBalancing API and Photon Realtime can be two different names for the same thing. The LoadBalancing API or the LoadBalancing Client API is the programming interface available in the client SDKs we provide for the Photon Realtime product.
Is Photon Cloud Down?
What Is The Default Photon Region?
Clients should be able to connect to Photon Cloud as long as at least one region is available.
So to guarantee this, a default value is configured or is used when the developer does not explicitly set one or choose "Best Region" option.
The default value could vary by client SDK.
In native SDKs, it is the value at index 0 of the region list returned by server in
On Unity and DotNet SDKs, the default region should be "EU".
Is It Possible To Disable Some Regions?
Yes. It works in the other way around by defining a list of allowed regions. Read more about the "Dashboard Regions Filtering".
What Is The Maximum Number Of Players Supported By Photon Rooms?
The number of players is the main factor for increasing traffic inside the room. The more players there are the more messages are exchanged.
The short answer is:
4 is good, 8 is doable. Above 8 is tricky and requires some netcode magic.
The long answer is:
In theory, there is no limit. For more than 8 players you will need interest management. For massive amounts of players you would split them - your world - across multiple rooms.
Is There A Limit For Photon Strings?
Photon uses strings for lots of purposes: room name, lobby name, UserID, Nickname, custom property key, etc.
Photon binary protocol can serialize strings up to 32767 one-byte-characters. For names and UserIDs 32 characters should be enough (e.g. a GUID is 32 characters). However, for custom properties keys, you should use shorter strings to minimize their overhead. This is especially important for properties that are visible in the lobby, as those are part of the room lists and get sent to everyone in the lobby, not just the couple of clients in a room.
Is There A Limit For The Number Of Custom Properties?
No. However, note that the more Custom Properties are set, the longer the clients load time will be because when joining the room, the clients also receive all of the properties. If you have too many of them and clients' load time exceed a certain amount of time, this might result in a disconnect for them.
Can I Send A Huge Message Using Photon?
We do not recommend transferring large data (i.e. files) using Photon unless you know what you are doing. We advise you to optimize the data you exchange and get in touch with us if you really have to send a very big message.
Photon Cloud has a server side limit for client buffers which is 500KB. So depending on the context a message could be considered:
- "too big" for our per client buffer size on Photon Cloud > 500KB. If a client hits this limit in a short period of time, it will be disconnected by the server.
- "too big" to be sent with UDP without resulting in an amount of fragments that might cause problems > 100KB.
- "too big" to be sent without splitting it up into multiple UDP packets > 1.2KB (including protocols overhead).
For messages that get sent very regularly (10 times a second or even more often) we would recommend to keep their size below 1KB.
If a message only get sent rarely (for example once at the start of a match), then a size of multiple KB is still fine, but we still would recommend to keep it below 10KB.
In exceptional cases something like 20KB or even 50KB might make sense. But usually messages that big indicate that there is something wrong and you should review what you are doing and reconsider your options.
Which Data Should Be Sent Reliably And Which Should Be Sent Unreliably?
First of all, you should know reliability is an option only when the protocol used is UDP. TCP has its own "reliability" mechanism(s) which are not covered here.
Sending something reliable means that we should make sure it arrives to target(s). So in case we do not receive an acknowledgment after waiting enough time, we repeat sending until we receive the acknowledgment or we exceed the number of retrials. Also, repeating reliable events may cause extra latency and make subsequent events delayed.
Examples for not using reliability:
- player position updates in realtime games
- voice or video chat
Example for using reliability:
- turn events in turn-based games
Why Do I Have So Many Disconnects In My Game?
The disconnects could be due to various reasons. We already have two documentation pages that can help you investigate the related issues:
How Messages Per Second Per Room Are Calculated?
Photon server counts total inbound and outbound messages every second and divide it by the total number of rooms (on the same Master Server).
Any operation request or operation response or event is considered a message. Photon operations return an optional operation response and trigger zero or more events. Cached events are also counted as messages.
Messages cost per in-room operation:
|Operation||Success: Best Case||Success: Average Case||Success: Worst Case|
+ Join event (SuppressRoomEvents=false, default)
|Join||2 + k
+ k * cached custom event
|2 + n + k
+ n * Join event (SuppressRoomEvents=false, default)
|2 + 2 * n + k
+ n * ErroInfo event (HasErrorInfo=true)
|1 + n
+ (n - 1) * Leave event (SuppressRoomEvents=false, default)
|2 + (n - 1) * 2
+ (n - 1) * ErroInfo event (HasErrorInfo=true)
(no operation response)
(target: interest group with no subscribers)
|1 + n
+ n * custom event
|2 + 2 * n
+ n * ErroInfo event (HasErrorInfo=true)
+ Auth event (token refresh)
|2 + n
+ n * PropertiesChanged event (default: Broadcast=true, BroadcastPropertiesChangeToAll=true)
|2 + 2 * n
+ n * ErrorInfo event (HasErrorInfo=true)
+ 1 in case of CAS or BroadcastPropsChangeToAll
How Do I Calculate Traffic Consumed By A User?
This is a complex topic. First you need to know that any calculation done is just a theoretical estimation and may not reflect reality. We recommend building a Proof-of-Concept and use it to gather real data.
That being said here is how to estimate traffic generated by a single user inside a room:
Let's assume the following:
- a room has N players.
- a player sends F messages per second (message send rate in Hz)
- average message size is X (in bytes, payload (P) + protocol overhead (O))
- an average player spends H hours per month on your game
If we do not consider ACKs, connection handling (establishment, keep alive, etc.) commands and resends. Then we say that on average, a CCU consumes C (in bytes/month) in your game as follows:
C = X * F * N * H * 60 (minutes per hour) * 60 (seconds per minute)
How To Quickly Rejoin A Room After Disconnection?
To recover from an unexpected disconnection while joined to a room, the client can attempt to reconnect and rejoin the room. We call this a "quick rejoin". A quick rejoin will succeed only if:
- the room still exits on the same server or can be loaded: If a player leaves a room, the latter can stay alive on Photon server if other players are still joined. If the player is the last one to leave and the room becomes empty then the EmptyRoomTTL is how long it will remain alive waiting for players to join or rejoin. If after EmptyRoomTTL the room is still empty and no one joined then it will be removed from Photon server. If persistence conditions are met and webhooks are setup, the room state can be saved on the configured web service to be loaded later.
- the actor is marked as inactive inside: an actor with the same UserId exists inside the actors' list but not currently joined to the room. This requires PlayerTTL to be different from 0.
- the PlayerTTL for the inactive actor did not expire: when an actor leaves a room with the option to come back we save his Deactivation timestamp. As long as the room is alive, if PlayerTTL milliseconds are elapsed after Deactivation time the respective actor is removed from the actors' list. Otherwise, when the actor tries to rejoin, if the difference in milliseconds between the time of the rejoin attempt and Deactivation time exceeds PlayerTTL then the actor is removed from the actors' list and the rejoin fails. So an inactive actor can rejoin a room only for PlayerTTL milliseconds after Deactivation time.
In PUN you can call
What Is The Difference Between PUN Plus And PUN Free?
The content of the packages is identical but with the purchase of PUN Plus you get a voucher for a 100 CCU Photon Cloud Subscription that is valid for 60 months from the time of redeeming it.
It's a really good deal as 100 CCU are in average sufficient for 2.000 DAU and 40.000 MAU (these numbers are averages across all games that run in our Cloud).
Please note that you must redeem the code in your dashboard within 12 months after the purchase date.
How To Redeem The PUN Plus Voucher?
- Go to the "Redeem Coupon" page on the Photon Dashboard.
- Enter your Unity invoice number in the "Coupon Code or Unity Invoice No." field. You get the Unity invoice number once you purchase PUN Plus for the Unity Asset Store.
- Enter your application ID in the "Application ID" field. Choose the application ID carefully and verify the application type before.
- Double check the application ID and Click "REDEEM".
Do You Have Special Offers For Students, Hobbyists Or Indies?
All our products have a free tier and a one-off entry-plan. We also usually take part in Unity's asset store sales and occasionally give vouchers to lucky ones.
Can I Combine More Than One 100 CCU Plan For A Single Photon Application?
No. The 100 CCU plans are not stackable and can be applied only once per AppId. If you purchase multiple PUN+ asset seats then you must redeem each 100 free CCU for a separate AppId. If you need more CCU for a single app, the next higher plan is the 500 CCU one. If you subscribe to a monthly or yearly plan, then you will still keep the 100 CCUs for 60 months on top of / in addition to the CCU from your monthly/yearly plan.