Page 1 of 1

GetTimer() Question

Posted: 07 Oct 2006, 19:08
by Abomb
Hi
I try to make a little 2d-shooter-like multiplayer game in flash. Everything works niceley so far, but the time based movement is not working like it should. I have a mainloop in the server (setInterval) that should run once every 30ms. I use GetTimer() to get the actual timedifference between two cyles of the mainloop, because gravity etc must be time based so that even if the server would only be able to run one cycle every 500ms all players would fall the same distance in the same time. Now to my problem: I traced the timedifference, and it lies between 30 and 300 ms (I ran some programs to simulate CPU-lag). The time based movement that I use should compensate for that - but when a player jumps he always jumps a different height - so the time I use to make the time based movement is not the actual time that has passed betwee two cyles. Could it be that GetTimer() is not that accurate ? I hope you can understand what I mean, sorry for my bad english...
Thanks in advance

Posted: 09 Oct 2006, 08:28
by Lapo
Hi,
don't worry your english is good. :) Anyways I am not sure if I understand the "jump" problem.
Could it be that GetTimer() is not that accurate ?
The getTimer() returns a time value expressed in milliseconds, which is of course accurate unless you need a finer time resolution (but I guess milliseconds should be enough)

Posted: 09 Oct 2006, 09:03
by Abomb
I found the problem, and it wasn't the fault of GetTimer, just my own... thanks anyway =)

Posted: 09 Oct 2006, 09:14
by Lapo
ok, great!
Keep us updated about your project, it sounds interesting :)