How does Timer work exactly? I was wondering because I'm using it in two different threads simultaneously. I noticed that you have to call the static method Timer.tick(), and I was wondering if by calling that in one of the threads does that tick the clock in both?
Just wondering.
I would think so. Being that it's Static there is only 1 for every timer, that should hold true regardless of threading I would think, But, hey, I've been wrong before! :D
Of course, I'm also wondering if my question is valid or not... does "ticking" the clock actually push it forward? Or does it simply update a pointer to the actual time? If the latter is the case, then it doesn't matter how many times you call Timer.tick().
Quote from documentation:
QuoteGet the next time update from the system's hires timer. This method should be called once per main loop iteration; all timers are updated simultaneously from it.
It sounds like it just updates the time on the timers.
Ah... I figured out my problem. Calling Timer.tick() doesn't hurt anything (even if you call it too often it appears). Turns out, my problem was using Thread.sleep(1). When I switched everything over to Thread.yield(), it all worked great. I think it has to do with the dedicated server sleeping, building up packets, and then sending them when it wakes back up. It was causing jitters for my clients.
Thanks for the replies everyone! I hope my experience helps someone out.