Calculate the bandwith.
Options
Hi everybody !
I'm doing a game with photon and i'm trying to calculate the bandwith but i'm a little scare about the result..
Photon give 3GB /CCU ( user), so i take this number to "base"
My player sent his position 5 times per second. I only need the X and the Z value + 2 other int.
I round the position to 2 number aftter decimal to optimize the bandwith , so when i call the RPC to send position it's look likes this :
So around 13octet or 104Bits with this exemple : ( 1.56/2.53/5/8)
With 5 messages per second, it's equal to = 520bits/s
3.000.000bits / 520bits = 5.769 message in the month...
it's not enought at all right ? per day, a player can send 192 message ..
How it's possible ?
So i post it because i don't know if i'm doing something wrong? i don't know how i can more optimize my game to send less data..
So thanks if someone can show me a other way, i take all at this time ^^'!
Have a good day !
I'm doing a game with photon and i'm trying to calculate the bandwith but i'm a little scare about the result..
Photon give 3GB /CCU ( user), so i take this number to "base"
My player sent his position 5 times per second. I only need the X and the Z value + 2 other int.
I round the position to 2 number aftter decimal to optimize the bandwith , so when i call the RPC to send position it's look likes this :
public void SendMove(float x, float y, int Test, int test2)
{
this.photonView.RPC("SendEnemyMoveRPC", PhotonTargets.All, x, y, test, test2);
}
So around 13octet or 104Bits with this exemple : ( 1.56/2.53/5/8)
With 5 messages per second, it's equal to = 520bits/s
3.000.000bits / 520bits = 5.769 message in the month...
it's not enought at all right ? per day, a player can send 192 message ..
How it's possible ?
So i post it because i don't know if i'm doing something wrong? i don't know how i can more optimize my game to send less data..
So thanks if someone can show me a other way, i take all at this time ^^'!
Have a good day !
0
Comments
-
Hi @redskry,
I think your math is wrong.
First, 3GB (Gigabyte converted to bits) is 24^9bits: 24000000000bits (or 25769803776bits if 1kB is 1024b)So around 13octet or 104Bits with this exemple : ( 1.56/2.53/5/8)
How did you count this?With 5 messages per second, it's equal to = 520bits/s
Let's assume everything is fine up to this point.3.000.000bits / 520bits = 5.769 message in the month...
This is wrong: 5769 is how many seconds in the month a player can keep sending messages with fixed size (104bits) at the same rate (5/second) without exceeding bandwidth.
Also, you are only considering messages from client to server and not server to client(s).
Take a look at the answer to the following question on our FAQ page:
How do I calculate traffic consumed by a user?1 -
Hi @redskry,
3 GB is not the same as 3.000.000 bit.
3 GB = 3,072 MB = 3,145,728 KB = 3,221,225,472 Byte = 25,769,803,776 bit
So following your example with 520 bit usage per second, the result is 49,557,314 messages per month, which is significantly more.0 -
Oh damn... night owl is not good for me .. Sorry too have loose your time !
But thanks so much ! It's save me !
0 -
Last 2 Question ^^, When i put some parameter in my RPC , like int[5], it's the equivalent to put 5 int parameters individualy ?
And the last , when a player send a message , to calculate the bandwith i have to know the number of player that i want to send ?
In my precedent calcul ( totally wrong i know ^^' ) i said that the player send 520 bit /s
but if 5 other player are in the room , i have to calculate the bandwith * 5? so 520*5 /s ?
Have a good day !
0 -
Hi @redskry,
To calculate the size of data serialized by Photon's binary protocol, go to this page.
For arrays the formula is:4 + photon_sizeof(elements) - length * type_info(T)
So for int[5] (array of integers of length 5):
4 + (5 * 5) - 5 * 1 = 24bytes.but if 5 other player are in the room , i have to calculate the bandwith * 5? so 520*5 /s ?if you send to others then you should multiply by 5 but if you send to all including yourself then you should multiply by 6.
- 5 players in the room.
- target: others only.
- average message size is 24 bytes.
- 5 messages per second.
- an average player spends H hours per month on your game.
bandwidth/CCU/month = 24 * 5 * 5 * H * 60 (minutes per hour) * 60 (seconds per minute)1 -
Great ! perfect anwser ! Thanks again and have a good continuation !:)
EDIT ; Sorry , but i just want to be sur ^^
- 8 players in the room.
- target: others only.
- average message size is 550 bits.
- 5 messages per second.
- an average player spends H "90"( just to be good for the worst case) hours per month on your game.
550 *8*8*90*60*60 = "11.404.800.000"
So , i'm 2 times less than i can use ?0 -
550 * 5 * 8 * 90 * 60 * 60 = 7128000000bits/CCU/month.
Yes it's less than the free 3GB/CCU/month.0