Character Position Sql , Make it more fast.
Hello this is Hesa,
Well i have a little problem here.
I send my position every 0.5 seconds to the server ( 0.5 cuz .4 make the game lag ).
So Photon receive my position and rotation and save it in sql.
But in sql the data happend a couple of second after.
Do you know why ?
If you need my code just ask it.
Well i have a little problem here.
I send my position every 0.5 seconds to the server ( 0.5 cuz .4 make the game lag ).
So Photon receive my position and rotation and save it in sql.
But in sql the data happend a couple of second after.
Do you know why ?
If you need my code just ask it.
0
Comments
What we can say is that storing each player's position in a DB two times a second won't work. Keep it in memory and save it as rarely as possible.
2. Ensure that the DB server has an appriate amount of RAM cause with such a amount of requests firing through you will need a massive cache (depending on your CCU we talk about 16-128GB here), as a DB that is writting to filesystem will not hold up for more than a few thousand to a few ten thousand requests per second depending on the SELECTs and JOINs you send
3. Ensure to configure your sql server correctly for such a usage (depends a bit on which sql server you use in detail)
Wich method you recommend me to save position and share it ?
Can you help me more in detail with skype , teamviewer or anything i dont want you to do all the things, just to help me a bit , and i dont really know how to configure mysql for that usage.
Thank you
Something Like WoW/Rift/Aion/Etc...
What is the best time to save position , Interval ?
do i make something like last position and current position and if the position is not equal then i show them move to new position ?
If someone can take the time to explain this in details its gonna help me and alot of people.
Plus, in game im gonna make a request to get all character online and with all basic info.
From Photon how i send multiple string sql to unity ?
Do i make something ... for each string send the info to unity.
And unity is gonna receive it and generate object if the user is in range , else its online show them online and in wich map guild etc...
I think its a good way , but if its not stop me please lol.
Storing to the DB is a 'replication' of the world state in case the player simply drops out.
As such you don't need such high frequency writes, cause the avg movement speed is low enough that even losing 10s of movement data has no impact.
If you have WoW alike flying mounts you would not store any positions during flying potentially but the last position at ground, unless you have WoW alike permanent flying. REason is that if it is temporal, the player might drop to dead in case of a relogin.
Getting all the players online: Thats trivial, thats a single request and thus no heavy thing per se. The Cache of the db server just needs to be large enough to keep all online characters and the data you request in detail within the cache, so it can do it at little to no lookup costs.
In such a case I would then actually encode the data into XML, compress it and send it through as a single packet, otherwise you might flood the connection too much.
I am actually struggling to get exactly this working. Do you know of a compression library that works with both Photon and Unity? I tried to use the compression libraries that come with visual studio, but there were problems having them work in Unity. I have also been trying to get DotNetZip to work and having limited success. From what I have thus far, it seems the XML is compressing and sending to the client fine, but when I try to decompress the compressed XML it comes out blank when using the ZipInputStream class.
If anyone has had success with this, or a different library, I'd appreciate knowing which library and/or an example of how you get it to work.
Thanks.
and that is placed in a string in the response.
Then on the client:
Maybe I'm overlooking a silly mistake.