Qbasicnews.com

Qbasic "like" compilers/interpreters => FB Projects => Topic started by: Anonymous on April 06, 2005, 10:19:46 PM



Title: Testers needed...
Post by: Anonymous on April 06, 2005, 10:19:46 PM
hi

im working on coding a project called lynns legacy as some of you know.

well, there have ben many issues about the timing of the prog, and i am starting to seriously consider the fact that the timer statement in FB is seriously flawed.

http://members.aol.com/rubentbstk/nxtll.rar

this is the latest build of the engine. everything runs smooth, perfectly on my comp. but on josiahs, it blazes out of control.

after coming up with several tests, i finally came up with this addition to the code: (keep in mind "delay#" is set to equal TIMER on the start of every loop)




Code:
 Do: inc# +=1: Loop Until Timer - delay# >= .008
? inc#
inc# = 0
? delay#
? Timer
? Date$
? time$


Now, "? Timer" should increment once a second on EVERY computer. but he said that the readout was blazing faster than he can read. this just doesn't make sense to me. Also, inc# reads as 1, meaning the loop was skipped. this makes no sense considering i sent him this code:

Code:
Screen 13
Do
p# = Timer
Locate 1:? Timer
? p#
Do:empcyc# += 1:Loop Until Timer - p# > .050
? empcyc#
empcyc# = 0
Loop Until MultiKey(1)


and it functioned correctly.

could you please try to run it and let me know how fast the PRINT TIMER goes? thanks...


Title: Testers needed...
Post by: barok on April 06, 2005, 11:36:35 PM
I'll gladly download lynn's legacy.  It's been something i've been looking forward to for a while.

I've noticed the timer bug(?) for a while now, but haven't said anything...  Timer just doesn't seem to do it's job...  just wait, i'll upload my example sometime...


Title: Testers needed...
Post by: jsmith71 on April 06, 2005, 11:47:52 PM
Quote from: "barok"
I'll gladly download lynn's legacy.  It's been something i've been looking forward to for a while.

It's gonna be awhile... :lol:
@Cha0s: TOLD you you shoulda reported the timer bug! :P


Title: Testers needed...
Post by: v3cz0r on April 07, 2005, 12:36:37 AM
If it's Windows 9x, the resolution is max 50 ms, using anything below that and it will be imprecise.. it's not much better in NT, max 10ms, if i remember.


Title: Testers needed...
Post by: Anonymous on April 07, 2005, 12:43:59 AM
okay, i updated the exe to print these 2 values

? Trim$(Str$(Int(Timer Mod 10)))
? Right$(Time$, 1)

the first one displays the ones digit of the system timer, the second displays the current second on the system clock. these numbers should increment at the exact same speed, they do not necessarily need to be the exact same number.

so anyone who downloads it tell me how close the speeds are of the 2 numbers. thx. the link again is

http://members.aol.com/rubentbstk/nxtll.rar in case you are too lazy to scroll XD




thanks


edit: i may have come up with a fix for this:


Code:
seconds = Val(Right$(Time$, 2))

Do
  pullseconds = Val(Right$(Time$, 2))

Loop Until pullseconds <> seconds

p# = Timer
setsecond = pullseconds

If setsecond = 59 Then setsecond = -1

Do
  pullseconds = Val(Right$(Time$, 2))

Loop Until pullseconds > setsecond

diff# = Timer - p#


Do
  delay# = Timer

  [do some code...]


  Do:inc# +=1:Loop Until (Timer / diff#) - (delay# / diff#) >= .007 Or MultiKey(1)

Loop



this is only tested on my machine but it works, and i think the theory is sound...


edited more:

well, that didnt work, so i tried this


Code:
seconds = Val(Right$(Time$, 2))

Do
  pullseconds = Val(Right$(Time$, 2))

Loop Until pullseconds <> seconds

setsecond = pullseconds
If setsecond = 59 Then setsecond = -1

Do
  pullseconds = Val(Right$(Time$, 2))
  f# += 1

Loop Until pullseconds > setsecond

Do

  Do
    dumb = Val(Right$(Time$, 2))
    dumber# += 1

  Loop Until dumber# >= (f# \ 200)
 
  dumber# = 0

Loop



and that seemed prettttty friggin close to 5 milliseconds.


Title: Testers needed...
Post by: Dr_Davenstein on April 07, 2005, 02:22:03 AM
It works fine here on WinMe. :shifty:


...looks cool too!  :P


Title: Testers needed...
Post by: Anonymous on April 07, 2005, 02:26:50 AM
thanks for testing it =)

for anyone who hasnt tested it, the latest build is with (what seems to be) the universal timing method, so im still curious as to whether or not it works on ALL systems o.o thanks again to those who try  :bounce:


Title: Testers needed...
Post by: Nexinarus on April 10, 2005, 03:55:46 AM
"Sorry, we cannot find that page" it says to me, as i try to download. Is it missing?


Title: Testers needed...
Post by: Dr_Davenstein on April 10, 2005, 05:33:48 AM
I'm getting that error too. That's AOL for ya...  :roll:

No offense intended. It's a cool acting demo. Keep up the good work!  :P


Title: Testers needed...
Post by: jsmith71 on April 10, 2005, 05:38:18 AM
Nope, the demo was taken down due to... Well, basically I don't like my graphics to be seen until the final product is ready, except when testing is NEEDED, and since we're fine at the moment I whined at and bugged cha0s til he took it down. :)


Title: Testers needed...
Post by: Dr_Davenstein on April 10, 2005, 05:50:23 AM
Well, demos are great! If I would have never bought a demo of... :lol:


EDIT:

OMG... I bought a demo? That better be a typo!!!  :rotfl:


Title: Testers needed...
Post by: jsmith71 on April 10, 2005, 05:55:11 AM
Oh, I didn't mean to imply that there won't be any demos, but I just prefer if the game isn't seen too much before a significant demo or the final game. :P


Title: Testers needed...
Post by: Atom Ant on April 10, 2005, 10:33:06 AM
I've had bad experiences with TIMER in FB.  It seemed like it would go out of control when I locked it at 60 FPS.  But 30 FPS or anything less would work fine.  :-|  It was really frustrating me because it had spontaneously stopped working.  Then I restarted my computer and it went back to normal again.   :rotfl:


Title: Testers needed...
Post by: aetherfox on April 10, 2005, 11:23:51 AM
Use GetTickCount from kernel32.bi

It is precise to 1 ms AFAIK, and I use it for many programs to maintain a constant frame rate.

I can post code to use it, if you ask for it,.


Title: Testers needed...
Post by: barok on April 10, 2005, 03:29:00 PM
just a question...  whenever i open my rpg i'm working on, my cpu shoots up to %100.  I'm sure the reason is somewhere in the fact that it's software driven, so the cpu has to work alot or something...  anyways, any way to throttle down the amount of cpu a program uses?  As nice as it sounds, i don't need to use all of my cpu to render a 3 layer map, npc's, particles and objects at 1000 fps. ;)


Title: Testers needed...
Post by: Dr_Davenstein on April 10, 2005, 03:34:15 PM
You could set the priority lower... There are instructions on how to do that aropund here somewhere. Why does it matter to you?


Title: Testers needed...
Post by: Rattrapmax6 on April 10, 2005, 04:14:02 PM
:) I'd download it, but I only have ZIP support, not RAR,... what is that, a better ZIP?


Title: Testers needed...
Post by: Antoni Gual on April 10, 2005, 05:16:13 PM
About the timing problems:
SLEEP uses Windows' SLEEP that has a resolution of 15 mS in XP and 50 ms in 9x.

However, version 0.13(cvs) has a high resolution TIMER function so you could use the code below...Probably it uses the performance counter of the processor so it will not work with old plain Pentiums, needs Pentium Pro or better...

Code:

declare sub delay(byval ms as integer)
dim as single a,b
a=timer
delay 5
print timer-a
sleep

sub delay(byval ms as integer)
dim a as single
a=timer+ms/1000!
do:loop until timer>a
end sub


In Pentiums it will default to the old 1/18th second interval, I suppose...


Title: Testers needed...
Post by: aetherfox on April 10, 2005, 05:28:31 PM
A *.rar file is a compressed archive, much like a ZIPfile.  AFAIK, rars have higher compression ratios to zips.

WinRAR is also better than WinZip :D


Title: Testers needed...
Post by: barok on April 10, 2005, 07:37:40 PM
Quote from: "Dr_Davenstein"
You could set the priority lower... There are instructions on how to do that aropund here somewhere. Why does it matter to you?


I see... i'll take a look around when i have more time to sift through the qbn forums. ;)

Why does it matter to me?

It's harder on the processor, it leaves nothing for other processes (disk defragmentations, antivirus scans) music can't play properly if say i want to listen to winamp at the same time.  Name the reasons.  I could probably think up several other reasons.  Main reason though, is that a processor running at %100 for hours can't be good for it.


Title: Testers needed...
Post by: Dr_Davenstein on April 10, 2005, 07:55:56 PM
I don't think that really matters, as long as you're not overclocked, it should be fine. It's never hurt my system anyway. ;)


Title: Testers needed...
Post by: rdc on April 10, 2005, 07:58:31 PM
Quote from: "Rattrapmax6"
:) I'd download it, but I only have ZIP support, not RAR,... what is that, a better ZIP?


Get 7-Zip: http://www.7-zip.org/. It will do rar files in addition to zip files.


Title: Testers needed...
Post by: barok on April 10, 2005, 08:32:05 PM
i found that adding sleep 8 slows it down to a nice 100 fps, yet it only runs around 2-6 percent of my cpu now.


Title: Testers needed...
Post by: Anonymous on November 26, 2005, 12:33:13 PM
Quote from: "Josiah Tobin"
[...] I just prefer if the game isn't seen too much before a significant demo or the final game. :P


more coming soon about that ;)


Title: Testers needed...
Post by: TheDarkJay on November 26, 2005, 12:38:25 PM
holy-sh*t

January
Febuary
March
April
May
June
July
August
September
October
November
December

Bumpidy-Bumpidy-Bumpidy, j/k

Hang-on...i just noticed

July August September October November
J     A         S              O           N

Jason.

It spells my name...


Title: Testers needed...
Post by: barok on November 26, 2005, 01:16:37 PM
It's his own topic.  He can do what he wants with it.


Title: Testers needed...
Post by: TheDarkJay on November 26, 2005, 02:29:10 PM
I wasn't having a go at him...


Title: Testers needed...
Post by: Anonymous on November 26, 2005, 05:06:30 PM
;p np, itss cominnggg... o.o


Title: Testers needed...
Post by: Dr_Davenstein on November 26, 2005, 07:48:50 PM
:o
Then stop posting and get back to work!  :bounce:


Title: Testers needed...
Post by: Z!re on November 27, 2005, 07:21:41 AM
Quote from: "TheDarkJay"
Jason.

It spells my name...
It's a sign! Kill your parents, quick!