Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 07-31-2007, 11:11 PM
HolySheepy HolySheepy is offline
Registered User
Join Date: Apr 2007
Posts: 68
HolySheepy is on a distinguished road
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)
Reply With Quote
  #2  
Old 07-31-2007, 11:42 PM
DustyPorViva DustyPorViva is offline
Will work for food. Maybe
DustyPorViva's Avatar
Join Date: Sep 2003
Location: Maryland, USA
Posts: 9,589
DustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond repute
Send a message via AIM to DustyPorViva Send a message via MSN to DustyPorViva
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.
Reply With Quote
  #3  
Old 07-31-2007, 11:48 PM
coreys coreys is offline
N-Pulse Assistant Manager
coreys's Avatar
Join Date: Mar 2005
Posts: 2,180
coreys has a spectacular aura about
Send a message via AIM to coreys Send a message via MSN to coreys Send a message via Yahoo to coreys
Way to include the very last part of the conversation when I had gotten frustrated with your lack of intelligence.
__________________

Quote:
*SlikRick: so should I even ask about your aim status?
*Xor: well if you want to
*Xor: but i am LARPING
*SlikRick: While on a computer?
*Xor: yes
*Xor: in my living room
*SlikRick: ahh
*Xor: i have a fort setup to hide from beasts
Reply With Quote
  #4  
Old 07-31-2007, 11:56 PM
DustyPorViva DustyPorViva is offline
Will work for food. Maybe
DustyPorViva's Avatar
Join Date: Sep 2003
Location: Maryland, USA
Posts: 9,589
DustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond repute
Send a message via AIM to DustyPorViva Send a message via MSN to DustyPorViva
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.
Reply With Quote
  #5  
Old 08-01-2007, 12:04 AM
coreys coreys is offline
N-Pulse Assistant Manager
coreys's Avatar
Join Date: Mar 2005
Posts: 2,180
coreys has a spectacular aura about
Send a message via AIM to coreys Send a message via MSN to coreys Send a message via Yahoo to coreys
HolySheepy, you were suggesting doing this sort of thing clientside...
PHP Code:
function onTimeOut() {
  
this.tvar++;
  
setTimer(1);

And saying that that would be the same for everyone...

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?
__________________

Quote:
*SlikRick: so should I even ask about your aim status?
*Xor: well if you want to
*Xor: but i am LARPING
*SlikRick: While on a computer?
*Xor: yes
*Xor: in my living room
*SlikRick: ahh
*Xor: i have a fort setup to hide from beasts
Reply With Quote
  #6  
Old 08-01-2007, 12:07 AM
DustyPorViva DustyPorViva is offline
Will work for food. Maybe
DustyPorViva's Avatar
Join Date: Sep 2003
Location: Maryland, USA
Posts: 9,589
DustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond repute
Send a message via AIM to DustyPorViva Send a message via MSN to DustyPorViva
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.

Last edited by DustyPorViva; 08-01-2007 at 12:21 AM..
Reply With Quote
  #7  
Old 08-01-2007, 04:34 AM
coreys coreys is offline
N-Pulse Assistant Manager
coreys's Avatar
Join Date: Mar 2005
Posts: 2,180
coreys has a spectacular aura about
Send a message via AIM to coreys Send a message via MSN to coreys Send a message via Yahoo to coreys
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.
__________________

Quote:
*SlikRick: so should I even ask about your aim status?
*Xor: well if you want to
*Xor: but i am LARPING
*SlikRick: While on a computer?
*Xor: yes
*Xor: in my living room
*SlikRick: ahh
*Xor: i have a fort setup to hide from beasts
Reply With Quote
  #8  
Old 08-01-2007, 05:31 AM
DustyPorViva DustyPorViva is offline
Will work for food. Maybe
DustyPorViva's Avatar
Join Date: Sep 2003
Location: Maryland, USA
Posts: 9,589
DustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond repute
Send a message via AIM to DustyPorViva Send a message via MSN to DustyPorViva
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.
Reply With Quote
  #9  
Old 08-01-2007, 06:39 AM
Rapidwolve Rapidwolve is offline
Registered User
Join Date: Jul 2006
Posts: 1,241
Rapidwolve is an unknown quantity at this point
How is timevar defined?

Also timevar2 clientside is your system time, on serverside it is the server's time.
Reply With Quote
  #10  
Old 08-01-2007, 06:47 AM
Twinny Twinny is offline
My empire of dirt
Twinny's Avatar
Join Date: Mar 2006
Location: Australia
Posts: 2,422
Twinny is just really niceTwinny is just really nice
Send a message via AIM to Twinny
Quote:
Originally Posted by Rapidwolve View Post
How is timevar defined?

Also timevar2 clientside is your system time, on serverside it is the server's time.
I found it to be the time your client has been opened for on Windows...
Reply With Quote
  #11  
Old 08-01-2007, 06:55 AM
DustyPorViva DustyPorViva is offline
Will work for food. Maybe
DustyPorViva's Avatar
Join Date: Sep 2003
Location: Maryland, USA
Posts: 9,589
DustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond repute
Send a message via AIM to DustyPorViva Send a message via MSN to DustyPorViva
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?
Reply With Quote
  #12  
Old 08-01-2007, 07:49 AM
HolySheepy HolySheepy is offline
Registered User
Join Date: Apr 2007
Posts: 68
HolySheepy is on a distinguished road
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
Reply With Quote
  #13  
Old 08-01-2007, 08:08 AM
Twinny Twinny is offline
My empire of dirt
Twinny's Avatar
Join Date: Mar 2006
Location: Australia
Posts: 2,422
Twinny is just really niceTwinny is just really nice
Send a message via AIM to Twinny
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.
Reply With Quote
  #14  
Old 08-01-2007, 08:15 AM
HolySheepy HolySheepy is offline
Registered User
Join Date: Apr 2007
Posts: 68
HolySheepy is on a distinguished road
well, you can demand, i dont think you will get it
Reply With Quote
  #15  
Old 08-01-2007, 08:19 AM
coreys coreys is offline
N-Pulse Assistant Manager
coreys's Avatar
Join Date: Mar 2005
Posts: 2,180
coreys has a spectacular aura about
Send a message via AIM to coreys Send a message via MSN to coreys Send a message via Yahoo to coreys
He's Twinny. He get what he wants.
Or else.
__________________

Quote:
*SlikRick: so should I even ask about your aim status?
*Xor: well if you want to
*Xor: but i am LARPING
*SlikRick: While on a computer?
*Xor: yes
*Xor: in my living room
*SlikRick: ahh
*Xor: i have a fort setup to hide from beasts
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 06:41 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.