tunepunk wrote:Never mind. I got it working. Works great! Another question though. Is there any good way dealing with lag compensation?
Neither plugin nor Photon js SDK have special features for lag compensation (but some other Photon SDKs do have built-in ping measurement and server time updates).
You may try to implement lag measurement by yourself sending event to "All" receivers (such event goes to sender as well) and calculate round trip time in event receive handler. Note that every event goes to the server first and then broadcasted by server to all destinations.
Thanks for the reply.
The approach you mentioned. As I understand... If i fire a bullet, It won't actually fire until the server recieved the message and sent it back to me? So i could be experiencing a small delay. On the other hand, the recievers would probably also have a small delay, in best case, around same as mine.
I managed to work around some of the stuff. I'm now sending the XY position of an object in one event every 0.2 second while the object is moving, but managed to get the receiving result smooth by using lerp expression to get rid of the choppy movement. And did some final adjustments to the XY position when the object stopped moving. If it stopped anytime between those 0.2 second intervals, it will now display the correct end position.
I guess sending event data every tick isn't optimal and would generate too many messages being sent i suppose?