🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

I Still don't understand Ticks

Started by
10 comments, last by Sanced 23 years, 9 months ago
I''ll consider doing that, but truthfully im still learning the technologies myself. I dont feel comfortable enough with them until i can atleast verify some of these ideas im thinking about, to put up a tutorial. I only comment on techniques which i''ve also implemented and so can assist others with the same problems. When i''ve layed more groundwork on my networking engine, I''ll write up a sysnopsis of the techniques and problems i faced.

As for blocking sockets, i use 2 threads per client connection, an in and out packet thread. If i didnt use blocking sockets the threads would have to sit in a wait state (sleeping or polling). Polling would consume to much processing power so thats out. As for sleeping it introduces added latency which i want to avoid. On average you''ll get + sleep time latency on the incoming packets with that method. With blocking the operating system wakes up the thread when a new packet arrives, thus mimizing the server side latency. Also to even further reduce the latency from the consumer main thread and the in packet producer thread, i run the server at 100 ups. On average the this adds about 10 ms introduce server latency. The main thread cant sleep as it runs the world simulation and client handlers. Once you move beyond the timming issues, data integertiy and simulation issues, latency becomes the main factor in your networking design, how to elminate or hide it. I could use completion sockets in winsock, which would proably give better performance latency and through put wise, but it''s not cross compatable.

Good Luck

-ddn
Advertisement
One extra note i learned today on a chat... (just saying this to share with people looking for a guide in this thread).

When i said how i thaught this all worked.. i was thinking of a Static Tick signal. As in, every 100ms send a, suppose 2 Byte Tick signal, like ''121'',''121'' <-- 2 char''s, thats what i was thinknig of a Tick... just a signal telling the clients they can refresh and begin a new turn (tick).

BUT, today i learned that actually, the Tick should be an incresing Byte, like add 1 Byte to all Msg''s, like the first byte or second, and thats the Tick Byte... This Byte (Tick) this round = 1, but next round = 2, then 3, then 4 etc etc.

this way, if a client recv''s a Msg with a tick = 3, and then a tick = 4 cause of latency or whatever... the client knows that the msg with Tick = 3, is already Old... that the game is in a new Tick, round, turn. THis was a big detail.. important one =)

so basically in all msg''s add a Tick Byte so that client/server know if the msg''s is fresh or old, obsolete. Something like that if i''m mistaken some one correct me please so that i don''t confuse others =)

(I''m happy... things are starting to come together and make sense now)
hehehe
thank you!! =)

This topic is closed to new replies.

Advertisement