|
I'm having problems with syncing time with millisecond accuracy. Here's what I did: I started a game on my first computer with the time read out displaying. I started another game on my other computer which is sitting right next to it with it's time also displaying. I took a picture of both screens with my digital camera to see if they were close to the same time. They were very close. I waited about two minutes and took a picture again. This time they had drifted off from each other by about 3 tenths of a second. Something tells me I need a more accurate delta instead of Time.deltaTime Anyone have any suggestions?
(comments are locked)
|
|
You have mistaken what is Time.deltaTime. It represents the time elapsed since the last frame. It depends on zillions on factors, software, hardware, program running, etc and is in no way related to Unity syncing out. You want to use Time.time which represents time elapsed since the start of the application. What Berenger propose is part of the base .NET/Mono Framework on which Unity is running. You can find more info about it on MSDN. Note that it can also be done in JS, with the correct syntax. Just thinking out loud: I can't think of a way to start a process on both computer with millisecond accuracy without 'manually' syncing them once they're running. Either you're pressing buttons or sending calls, both of which will be different no matter what, isn't it? EDIT: oh yeah, you could have something monitor time closely and launch the process for you, duh. Well, actually.. it's synchronization via the network.. I finally found out that Time.time - as stated in my previous answer. I should have marked it as correct, but who am I to say my answer IS correct. I have no idea yet. I'll only find out in a couple days when I finish a bunch of timing logic in my game.. That MSDN link you gave me looks interesting though.. I will have to check it out. Thanks!
Feb 09 '12 at 09:36 AM
Rush3fan
(comments are locked)
|
|
Try System.DateTime.UtcNow, TotalSecond and those kind of things. No idea what you are talking about.. I looked those up in the script reference and found nothing. Thanks for trying anyways...
Feb 09 '12 at 12:56 AM
Rush3fan
To be honest I've never used it. I found it in Aron Granberg AStar code, there was those line to profile his function performance (comments are an alternative):
Feb 09 '12 at 01:37 AM
Berenger
(comments are locked)
|
|
I think Time.time is my closest bet. I still need to work on some other problems with my synchronization before I start worrying about this again. Thanks anyway Berenger.
(comments are locked)
|

I suppose I should be using doubles and not floats... However, Time.deltaTime is a float.