Besides the CCU limit in Photon which you can easily increase by paying more there is a messages/second per room limit in Photon Realtime.
Dunno about latency, but the official Photon limit is 500 messages/second per room.
Let's say s
is your sendrate (s
messages per second) and n
is the maximum number of players allowed in a room.
So it's 500 = s * n^2
if you do the easy synchronization where every player sends their position etc. to all the other players. Photon counts that as:
1
sent message + n-1
received messages = n
messages.
This results in n = 7
for a sendrate s = 10
.
Another idea is to only send the current position etc. of a player to the one designated master client, and let that one send to all the other players. This basically doubles your round-trip time for each status update on the receiving end of players. But for slower paced games it should work fine.
The formula for this is 500 = s * (3n - 2)
:
n-1
players send to the master client- master client receives
n-1
messages - master client sends one message out
n-1
players receive that message= 3 * (n - 1) + 1 = (3n - 2)
This results in n = 17
for a sendrate s = 10
.
You can of course use multiple sendrates for the sending players and the sending master client for example. Another idea is to let the master client figure out the distance between each player and reduce the sendrate given the distances. This reducing is still possible if you go with the first solution where everyone updates everyone else, but in that case you're looking for peer-to-peer algorithms since no one has the current info of all the other players. Some kind of "only update next neighbor and tell them about my neighbors, too".
And you actually want to make sure to send other match-related things with one of those messages you send all the time anyway. Because Photon cares more about the messages/second than the bandwidth. (There is a bandwidth limit, too, but I think that is generous + you can take over the serialization and optimize.)
Photon doesn't seem to care much about staying under the messages/second limit, some people regularly go to about 1k messages and haven't heard anything from them. I guess they only talk to one if both messages/second and bandwidth are bad, so optimize your serializations!
Advices:
- Put everything you want to send into one message.
- Only send to the master client if the doubling in round-trip time is no problem for you.
- Do more sophisticated stuff if you want to allow even more players.