Frequently Asked Questions

Contents

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:

Feel free to reach out to us if you still have questions.

What is the difference between Photon Realtime and PUN?

Photon Realtime and PUN are both based on the same API: LoadBalancing API. 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
  • PunRPC
  • Offline mode
  • ...

Read more here.

However, while PUN supports webhooks and persisting room states, it is still not 100% able to restitute networked objects' state in the scene(s) when loading a saved game. 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.

Photon Cloud

Is Photon Cloud down?

You can check Photon Cloud status here or follow @exitgames on twitter to get notified about status updates.

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 OpGetRegions. 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".

Load Balancing

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 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
Create 2
(SuppressRoomEvents=true)
3
+ Join event (SuppressRoomEvents=false, default)
3-
Join 2 + k
(SuppressRoomEvents=true)
+ k * cached custom event
2 + n + k
+ n * Join event (SuppressRoomEvents=false, default)
2 + 2 * n + k
+ n * ErroInfo event (HasErrorInfo=true)
Leave 2
(SuppressRoomEvents=true)
1 + n
+ (n - 1) * Leave event (SuppressRoomEvents=false, default)
2 + (n - 1) * 2
+ (n - 1) * ErroInfo event (HasErrorInfo=true)
RaiseEvent 1
(no operation response)
(target: interest group with no subscribers)
1 + n
+ n * custom event
(target: all/broadcast)
2 + 2 * n
+ n * ErroInfo event (HasErrorInfo=true)
+ Auth event (token refresh)
SetProperties 2
Broadcast=false
2 + n - 1
+ (n - 1) * PropertiesChanged event (Broadcast=true, default)
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.

A "quick rejoin" is composed of two steps:

  • Reconnect: simply call the appropriate connect method once disconnected.
  • Rejoin: call loadBalancingClient.OpRejoin(roomName).

Billing

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.

 To Document Top