Clientsided Time Calculation
Hi,
uhm so i had a discussion with that weird coreys guy right now...(he's really weird lol) now i told him how i calculate the time, using the clients, not calculating it on the serv i was like i use this.timevar5, thats the timevar2 of the serv, he sends it to the players the clients then do the time calculating no he was like "WTF THATS NO GLOBALTIME!" and im like "uhm why not?" hes like "cause its clientside, it will be different at different times for different people" and im like "why would it be different? they all use the same formula" and hes like again "CAUSE IT'S FKIN CLIENTSIDE" uhm... well so can anyone tell me what he meant(he quit, after calling me an idiot & telling me to stop scripting) :) |
Hmm, I'm not really sure, timevar I believe has different values depending if it's clientside or serverside, but timevar2 is the time since some 1970 date or something :o so it's independent of anything clientside. I'll test it out though.
|
Way to include the very last part of the conversation when I had gotten frustrated with your lack of intelligence.
|
Anyways, here's the results. I was wrong:
Serverside Timevar: 40974023 Serverside Timevar2: 1185918933.553539991 Clientside Timevar: 40974023 Clientside Timevar2: 437.106929791 It looks like this means if you use timevar2 on the clientside for a time system, people will get different times. |
HolySheepy, you were suggesting doing this sort of thing clientside...
PHP Code:
And even still, timevar2 isn't the same clientside as it is serverside. Edit: btw, Stan called you an idiot, not me. Also, why are you using timevar2 for a clock for a server that isn't using realtime? |
Ya, that won't work.
You could do something similar in a database NPC, and access findNPC("timeNPC").this.tvar or such... but ya, timevar/timevar2 is the simplest way to do it. Making your own variables is unneeded really. Hell, you could even go as far as grabbing Timevar2 from the serverside on the onCreated, and then manually add time onto it clientside, and sync it every minute or so, to keep traffic to the serverside, then back to the clientside, down. EDIT: Just noticed your edit, timevar2 is useful because it's updated by the nanoseconds, compared to timevar which is just updated 1 every 5 seconds. |
timevar2 is useful if you want to check the time between two things (like a double tap of a key) and for realtime, but not for a world clock that goes through a day in 6 hours.
|
It's good if you want to show time that doesn't update every 5 seconds. I personally like my time systems to be a little faster than that. I like to make my system where 1 second = 1 minute in the game.
|
How is timevar defined?
Also timevar2 clientside is your system time, on serverside it is the server's time. |
Quote:
|
Hmm, would you be able to take the serverside timevar2, and compare it to the clientside timevar2, to have a timevar that is the same for all players, without having to constantly access it from serverside?
|
well as i said earlier in the conversation i use this.timevar5 to calc, it the server sends his timevar2 to the players, they set it to this.timevar5, resend from the serv like ever 5 minutes, even with my kinda slow pc that would be only 1-2 minutes difference in est time :P
well im planning to use the timevar2 from the serv as a starting point for the players timevar2 instead of using this.timevar5 still its about the same time for everyone, and now dont tell me every clock in reallife shows the exactly same time.. so basically every client uses the same formula with the same variable for calculation, thats like saying if you have 30 calculators and input 4+5 in everyone some wont return 9 |
How about we just demand timevar3? Graal 3d gets it: why not add it for us?
For those who don't know, timevar3 is synchronized between server and client. |
well, you can demand, i dont think you will get it :(
|
He's Twinny. He get what he wants.
Or else. |
All times are GMT +2. The time now is 09:01 AM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.