How to calculate time differences using remoteFrame?

Options
I'm currently trying to rewrite my reload method a little bit to make it authorative. My idea was to save the remoteFrame of the player and compare it after the next reload event was received by the server.

But is there any way to calculate between the saved remoteFrame and the one received in the next reload?

Comments

  • stanchion
    Options
    int frameDiff = entity.source.RemoteFrame - lastRemoteFrame;
    lastRemoteFrame = entity.source.RemoteFrame;
  • silentneedle
    Options
    Yes, but how can I convert the frame difference to seconds? How long is one frame?
  • Yukichu
    Options
    I believe this is set in the Bolt Settings -> Simulation rate. 60 = 60 frames per second, etc. Pretty sure. Then you do maths.
  • silentneedle
    Options
    I see, yes that could work. Thanks. :)

    Just to make sure, is that the right way to do or is there some better way? Before bolt I usually used the server timestamp and subtracted the players ping from it.

    Can we rely on the remoteFrame value if the client is lagging?
  • stanchion
    Options
    You could send the client's local time in the event too if you're paranoid.