Question about Sys timer (definition/use of resolution) and templates source

Started by imagenesis, November 23, 2008, 09:53:38

Previous topic - Next topic

imagenesis

Hey, just starting with LWJGL and got a few questions.

About the getTime method of SysImplementation. It reportedly returns the time in the number of seconds passed. It uses the native method nTime (atleast in the Windows implementation). I couldn't find this method actually implemented in the native files. My C is really rusty but I couldn't find the WindowsImplementation c file so I'm guessing it's using some C voodoo magic that's above my head. In anycase, that's not really the question. The question is the following:

Here is my game scenario. All of the game logic is executing on the server reduntetly. Some logic is also executed on the client but is verified with the server ultimetly. I have 2 problems. I would like to have a variable game speed rate and I would like to properly sync time with the server across all OS clients. Game speed rate is something like this:

I have a timer that executes say every 10 miliseconds. If my game speed is at 1 then a game logic tick will be executed every 10 handleTimerEvents. If my game speed is at .5 game logic executes every 20 handleTimerEvents. So the question is, what does the timer resolution actually correspond too? Every x milliseconds?

So about syncing server time with client time. It's an RTS if that helps. Any ideas on this? I just realized this shouldn't be too hard and really dont feel like typing out unintersting implementation details, but if you guys have any forewarning/tips let me know. BTW, check out SunAge, holy crap their graphics are nice/code for a small team. Too bad reviews sucked cause of bugs.

Oh okay about the templates folder of the src. What is up with that? They are just mappings to the generated files? I havent ever written any JNI( read specs though) but what is the point of having a bunch of interfaces if you have the generated classes? I've had to exclude from the project source because of naming conflict(s) (GL11)...




imagenesis

Just read the Space invaders source. It's a high resolution timer. Heh, wow, hires = high resolution lol. I was like wtf is a "(company) hires?" timer...