GetTimer() Question

Post here your questions about Actionscript and Java server side extensions development.

Moderators: Lapo, Bax

Post Reply
Abomb
Posts: 5
Joined: 07 Oct 2006, 18:58

GetTimer() Question

Post 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
User avatar
Lapo
Site Admin
Posts: 23438
Joined: 21 Mar 2005, 09:50
Location: Italy

Post 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)
Lapo
--
gotoAndPlay()
...addicted to flash games
Abomb
Posts: 5
Joined: 07 Oct 2006, 18:58

Post by Abomb »

I found the problem, and it wasn't the fault of GetTimer, just my own... thanks anyway =)
User avatar
Lapo
Site Admin
Posts: 23438
Joined: 21 Mar 2005, 09:50
Location: Italy

Post by Lapo »

ok, great!
Keep us updated about your project, it sounds interesting :)
Lapo
--
gotoAndPlay()
...addicted to flash games
Post Reply