The Photon Forum
is Closed Permanently.

After many dedicated years of service, we have made the decision to retire our Forum and switch to read-only: we´ve saved the best to last! Your search result can be found below. Plus, we offer support via these channels:

Try Our
Documentation

Please check if you can find an answer in our extensive documentation on PUN.

Join Us
on Discord

Meet and talk to our staff and the entire Photon-Community via Discord.

Read More on
Stack Overflow

Find more information on Stack Overflow (for Circle members only).

Write Us
an E-Mail

Feel free to send your question directly to our developers.

How to reduce bandwidth consumption?

Cebado
2020-10-23 14:56:17

Hello, I am new here!

I am creating a multiplayer game. Because of the limits of 500Msg/s per room I have limited the size of the room to 6 players.

Every player update their position 7 times per second broadcasting to the rest of the room. That gives about 250Mgs/s per room. Below the limits, what is cool.

The problem here is that I am seeing that the bandwidth is about 14KB/s per room of 6 players. Photon estimates 3GB per CCU every month.

So doing the maths we have:

14KB 3600s24h*30d = 34GB per month

3GB * 6 players in a room = 18GB per month

So 34 >>>>18.

I understand that not every room will be full every second of the month and that I wont have just 20CCU all the time. I would have to upgrade the plan if that was the case. But the thing is that what I currently have in my game is so basic that I don't see how can I make this numbers fit.

Every player has his photonview and for every photonView I am just sending position and velocity:

As I said, the serialization rate is even lower than the default value:

Should I do some configuration to make my messages smaller? PUN support up to 16 players in a room. How do they handle? Because with only 6 things scalates pretty quickly.

Also, just dividing 14KB/s / 250Msg/s gives about 57B/Msg. So messages are not so big, just 57Bytes wtih all the headers and stuff.

I don't know if the only viable option is just to make clients send to master and master broadcast to the rest. Is there a way to do that with photonView or would I have to do it manually? I would like to avoid that option because it brings more lag talking client to client.

Thanks!

Comments

Cebado
2020-10-24 01:26:59

Since the players wont be runing faster than 327 I can use two shorts to send the velocity instead of a Vector2. That would save me 4 bytes every call and now a room with 6 players use less than 12KB/s.

I think that I wont have problems because its impossible to have all the time all CCU and all rooms with max players, but anyway I would like to reduce it even more.

S_Oliver
2020-10-26 21:25:57

Take a look at this, you also could go fourther and use a simple compression approach here
here

Cebado
2020-10-26 21:45:09

Thank you very much. The compression approach is more or less what I did for the velocity I think. I will try it also for the vector3.

And I will read that photon documentation carefully. I was searching something like that and I couldn't find it by my own.

Back to top