Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / I need your help ! Run this code and let me know your time..

Author
Message
Lampton Worm
21
Years of Service
User Offline
Joined: 4th Sep 2002
Location: United Kingdom
Posted: 27th Dec 2002 20:52
Hi there, just playing around with measuring time in such a way that on different spec. machines events can essentially run in the same time frame. Hopefully what I have below will work (I can't remember who the function came from - please yell up so you can be credited!), basically compile/run it and then press space to start. The test takes but a second, 1.062 seconds to be precise. If you are kind enough to run the code, please let me know your machine speed/spec. and your result (number next to DONE: when its complete).

Thanks in advance !


sync on:sync rate 50
make matrix 1,60,60,6,6
make object sphere 1,5
position object 1,0,0,0
position camera 0,10,-10
Dim Time(1)
Time(1)=timer()
distance#=1.0
while spacekey()=0
text 0,0,"Press space to start test"
text 0,40,str$(object position z(1))
sync
endwhile
T#=timer()
cumove#=move(distance#)
do
Elapsed2#=(Timer()-T#)/1000.0
cumove#=move(distance#)
if loops
Lampton Worm
21
Years of Service
User Offline
Joined: 4th Sep 2002
Location: United Kingdom
Posted: 27th Dec 2002 20:53
DAMN! Complete code here..

sync on:sync rate 50
make matrix 1,60,60,6,6
make object sphere 1,5
position object 1,0,0,0
position camera 0,10,-10
Dim Time(1)
Time(1)=timer()
distance#=1.0
while spacekey()=0
text 0,0,"Press space to start test"
text 0,40,str$(object position z(1))
sync
endwhile
T#=timer()
cumove#=move(distance#)
do
Elapsed2#=(Timer()-T#)/1000.0
cumove#=move(distance#)
if loops<60
move object 1,cumove#
inc loops,1
endif
if loops=60
test$=str$(elapsed2#)
done$=left$(test$,5)
text 50,50,"DONE:"+done$
text 50,60,"SET :1.062"
sync
wait key
exit
endif
sync
loop
function move(Distance#)
TimeDifference#=timer()-Time(1)
FrameTimeinSeconds#=(TimeDifference#/1000)
movement# = Distance# * (FrameTimeinSeconds#*16)
Time(1)=timer()
endfunction movement#
MrTAToad
21
Years of Service
User Offline
Joined: 26th Aug 2002
Location: United Kingdom
Posted: 27th Dec 2002 21:00
So you want to know my time ? Its 18:58...

Sorry, couldn't resist. The results is : 1.182

This is on an 1700+ Windows XP machine (heavily using the Internet)

Good news everyone! I really am THAT good...
Oh my, yes...
http://www.nickk.nildram.co.uk/ for great plug-ins
MrTAToad
21
Years of Service
User Offline
Joined: 26th Aug 2002
Location: United Kingdom
Posted: 27th Dec 2002 21:08
I'll let you know what times I get on my other two machines (both Intel P4's), when I've kicked my parents off them...

Good news everyone! I really am THAT good...
Oh my, yes...
http://www.nickk.nildram.co.uk/ for great plug-ins
haggisman
21
Years of Service
User Offline
Joined: 26th Aug 2002
Location: United Kingdom
Posted: 27th Dec 2002 21:20
i got 1.179 here

Specs:- 1GHZ athlon, Radeon8500, 192mb ram, winxp
MrTAToad
21
Years of Service
User Offline
Joined: 26th Aug 2002
Location: United Kingdom
Posted: 27th Dec 2002 21:22
On my Intel 1.7Ghz - Windows XP, its 1.843

Good news everyone! I really am THAT good...
http://www.nickk.nildram.co.uk/ for great plug-ins - oh my, yes!
Easily Confused
21
Years of Service
User Offline
Joined: 22nd Oct 2002
Location: U.K. Earth. (turn right at Venus)
Posted: 27th Dec 2002 21:27
Tested on 512MB AMD 650, with GeForce 2 MX, running Windows 98se.

I get an average of 1.067

"Earth is the cradle of humanity,
but one cannot live in a cradle forever"
Konstantin E. Tsiolkovsky (1911)
IanM
Retired Moderator
21
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 28th Dec 2002 02:26
Tested on 384mb PIII 850 laptop, ATI Mobility M4(32mb) running Win2K. Time: 1.088 for 4 runs, and 1.055 for 1 run.
Flashing Blade
21
Years of Service
User Offline
Joined: 19th Oct 2002
Location: United Kingdom
Posted: 28th Dec 2002 02:59
intel celeron 366 - tnt2 32mb - 128 ram
time: 1.062
Lampton Worm
21
Years of Service
User Offline
Joined: 4th Sep 2002
Location: United Kingdom
Posted: 28th Dec 2002 20:08
Thanks for trying the code all, much appreciated

However, looks like only 1 result matched my own. The best example of what I'm trying to do is a rally game where time is very important in split seconds, but the above code looks like its not accurate across the tested range of systems - it would need to be. Any ideas ?

Cheers.
haggisman
21
Years of Service
User Offline
Joined: 26th Aug 2002
Location: United Kingdom
Posted: 28th Dec 2002 20:32
But it shouldn't really matter, as long as the movement rate is the same it should be fine.

Specs:- 1GHZ athlon, Radeon8500, 192mb ram, winxp
IanM
Retired Moderator
21
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 28th Dec 2002 22:32
Probably something to do with the sync rate.

Instead of trying to get the machine to run at your rate, you could try getting the code to adjust to the actual rate.

Login to post a reply

Server time is: 2024-05-17 06:39:50
Your offset time is: 2024-05-17 06:39:50