|
-
Software Developer
[F8] Nanoseconds
Hi everyone, long time since I have posted
Is there any way to get the number of Nanoseconds in flash?
I know you can get the number of Milliseconds and divide by 1000 to get nanoseconds. But that isn't accurate enough.
I would like to use the nanoseconds because I am making a small reflex game. Milliseconds just aren't fast enough (too many people can get the same number twice.)
Thanks.
Post you game for free at Gamestack.org. We send the user straight to your website, no iFrames or other leeching methods.
Please check out Gamestack.org for more information.
-
flash can´t but maybe java can and pass it through
or maybe you hust need more factors for a variety- like motion capturing instead of digital button hitting
-
Software Developer
Thanks renderhjs, I guess ill look for some other ways to test reflexes instead of getTimer()
Post you game for free at Gamestack.org. We send the user straight to your website, no iFrames or other leeching methods.
Please check out Gamestack.org for more information.
-
Perhaps its just flashes frame system messing with the results? I haven't tested any of this, but perhaps the getTimer only gets the times of the nearest frame instead of the precise moment of clickage?
The greatest pleasure in life is doing what people say you cannot do.
- Walter Bagehot
The height of cleverness is to be able to conceal it.
- Francois de La Rochefoucauld
-
...just thinking of it... maybe there is a way
dont know what the frame rate limit is in flash (lets forget once about the browser limitation here) - maybe you could try increasing a counter on each frame or interval event so that in the end it reaches 10,000 hit´s a second- but that depends more on how the flash player is limited- and if it can perform it.
otherwise try it yourself ,- setup a Interval wich calls every 10,000 times a second a function wich increases a variable.
but this is rather a very wacky idea,- better try finding a different approach
-
Flash is limited to 120fps.
-
thinking again,-
damn 1000 ms as 1s is quite excactly,- if you even try for the nano seconds people might blame the timing on their hardware (keyboard, mouse, cable,...).
Did you created some tests that can varify that so many people get the excact same ms time
-
M.D.
yeah, i don't see any problem with milliseconds
-
As I said before, flash may be rounding to the nearest frame. That is the only real reason I can see why results may be consistant.
The greatest pleasure in life is doing what people say you cannot do.
- Walter Bagehot
The height of cleverness is to be able to conceal it.
- Francois de La Rochefoucauld
-
if you use the time object or the getTimer(); then it should have to do nothing with frames at all,- not even the framerate. At least the time object or the getTimer is accurate up to it´s miliseconds.
example:
Code:
var time = getTimer();//start event time
myButton.onPress = function(){
trace("time delay: "+(getTimer()-time)+" ms");
}
-
SaphuA
But the event which is only called "on a frame" will make it inacurate.
-
Filthy Gorgeous
 Originally Posted by SaphuA
But the event which is only called "on a frame" will make it inacurate.
Could you use setInterval? I'm a bit rusty, so I'm not sure exactly how accurate it is.
-
 Originally Posted by SaphuA
But the event which is only called "on a frame" will make it inacurate.
but that shouldn´t go for buttons or?,- don´t know how his game works but if he uses buttons for the interaction I see no problems.
If it is about motion´s try predicting them with calculations and not putting them in a onEnterFrame event just waiting to catch the timing on whatever.
-
Software Developer
Thanks for all the replies.
As for the tests, yes people were able to get the same results here at work very easily, thus I needed something smaller (nanoseconds).
Anyway the game is as follows (simple);
1. User clicks their mouse to start the game.
2. User than has to wait until a red light turns green (random wait time 5 seconds - 10 seconds).
3. User must then click on the light to stop the timing. (Movie clip with a Mouse Event).
In most cases people were able to get the same time, or an avg of the same time.
I may change the game so that the user will not see the "light" at the beginning and then it will appear in a random play on your screen (thus you would have to move your mouse).
Post you game for free at Gamestack.org. We send the user straight to your website, no iFrames or other leeching methods.
Please check out Gamestack.org for more information.
-
Style Through Simplicity
I was actually having a strange problem the other day where the number of milliseconds in a speed test I was doing was either 0 or 10, but never anything in-between as if flash was rounding to the nearest 10 milliseconds. Maybe something like that is happening to you?
Ali
-
3. User must then click on the light to stop the timing. (Movie clip with a Mouse Event).
not sure but try something like this:
Code:
myMc.useHandCursor = false;
myMc.onPress = function(){
//timer stuff....
}
hopefully that is different and wont depend on the framerate
-
Software Developer
Renderhjs,
Thats basically what I am doing right now 
I am changing the game a little bit so people wont be able to get the same time.
Thanks for everyone's help. Ill post a link of the game when I am done.
Post you game for free at Gamestack.org. We send the user straight to your website, no iFrames or other leeching methods.
Please check out Gamestack.org for more information.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|