About Store Forum Documentation Contact



Post Reply 
Server Time to Client
Author Message
Dwight Offline
Member

Post: #1
Server Time to Client
Dear reader,

I have a couple of question in regard to the MMO source and networking in general. My idea was to let the server send every client the local server time on startup, and let the day/night cycle run on that, as well as other time-triggered effects, such as owls only appearing at night... (No accelerated time ingame; and no effects of different time-zones on day/night ingame).

Firstly, and by far most important: Is it wise to let a server send the local server time realtime to every client? Or should I just send the time from the server on client-start just once and let the day/night-cycle continue from there from within the client?
(so in update function: hour+=Time.d()*(1/86400); //86400 = second in a day)

Secondly, I have been working with
Code:
DateTime().getLocal().asText(false)
on the client ONLY (so not received from server). I cannot find a way to get the starting hour in a float like "5.25" indicating 5:15AM instead of the format YYYY-MM-DD HH:MM.

Thirdly, I would like to have the time only, and not the date included, did I miss something somewhere? (In format HH:MM).

SnowCloud Entertainment - We are recruiting!
http://www.sc-entertainment.com
09-24-2011 08:23 PM
Find all posts by this user Quote this message in a reply
Dwight Offline
Member

Post: #2
RE: Server Time to Client
Nevermind, figured it all out. I overlooked something of vital importance in the header grin

SnowCloud Entertainment - We are recruiting!
http://www.sc-entertainment.com
09-25-2011 11:47 AM
Find all posts by this user Quote this message in a reply
JonathonA Offline
Member

Post: #3
RE: Server Time to Client
For future reference in case anyone else runs across this problem; If you look at the Esenthel MMO code, check out the Select Server.cpp and the ClientRecvInitConnection(...) method which returns the server utc as a DateTime. DateTime has an hour field which is a Byte with a value between 0 - 23. Good starting point for day/night cycle stuff.
03-06-2012 09:28 PM
Visit this user's website Find all posts by this user Quote this message in a reply
dragonfly3 Offline
Member

Post: #4
RE: Server Time to Client
Helpful info! Thanks for sharing!smile
03-09-2012 12:21 AM
Visit this user's website Find all posts by this user Quote this message in a reply
Post Reply