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 / Monitor Refresh Rates

Author
Message
Tribasic
19
Years of Service
User Offline
Joined: 10th Mar 2006
Location:
Posted: 11th Mar 2006 03:47
Hi,

I just starting programming for the first time, and I decided to write a scrolling text program. When I run the program with my Monitor Refresh Rate set to 85 Hertz, the scrolling looks great, but when I run it at a refresh rate of 60 Hertz it looks kind of choppy.

I tried using the Timer() command to sync my screen updates, but I could not get it it to work right, so I just use the SYNC commands instead. I also tried adjusting my SYNC RATE to get faster playback, but I have used a SINE WAVE in my scroll routine, for the TEXT Y position, and it updates the Y POSITION way too fast, but the TEXT X POSITION looks a lot better.

The reason I want to run this at 60Hertz refresh rate is because I'd like to run it on my Arcade Machine.

Anyway, here is my code for this scrolling text program. I can probibly simplify this code a lot more, but I'm still learning how to program... I'm just happy it works at all

If anyone has any ideas about this, I would really appreciate it.

Thanks!!

[/code]
Rem ***** Main Source File *****

message1$ = "This is just sample text.... it's not really saying anything important... in fact, it's only purpose for existence is to be displayed across the screen in a fancy flashing sine wave."
message2$ = "And this text is here just because I wanted to see if I could have 2 scrolls going at the same time."

hide mouse
set text font "FixedSys"
set text size 50

screen_width = screen width()
letter_width = text width(" ")
letters_per_screen = (screen_width/letter_width)+2
xpos = letter_width*-1
length2 = text width(message2$)

for m = 1 to letters_per_screen
spacer$ = spacer$ + " "
next m

message1$ = spacer$ + message1$
message_length = len(message1$)

load bassmod "media\estrayk-commando.mod",1
set bassmod 1,44100,1
play bassmod 1

sync on
sync rate 60

do
for scroll = 0 to message_length
for m = 1 to letter_width step 4
cls
t = t + 1
cc = cc + 1
colourvalue1 = (sin(cc*4)*128)+128
for x = 1 to letters_per_screen
v=v+1
letter$ = mid$(message1$, x+count)
xpos = xpos + letter_width
ypos = sin(v*5)*120
shadowcolour()
text (xpos+s)+4,ypos+184,letter$
colourfade1(colourvalue1)
text xpos+s,ypos+180,letter$
next x
v=v-letters_per_screen+1
xpos = (letter_width*-1)
s = s - 4

value2 = (sin(cc*8)*128)+128
colourfade2(value2)

xmov = xmov - 2
xpos2 = (xmov + screen_width)
if xpos2 <= -length2
xmov = 0
else
xmov = xmov
endif
text xpos2, 400, message2$

if scancode() then goto finish
sync

next m

v=v+1
count = count + 1
s=0
next scroll
count = 0
loop

finish:
end

function shadowcolour
ink rgb(128,128,128),0
endfunction

function colourfade1(value1)
ink rgb(220, value1, 100),0
endfunction

function colourfade2(value2)
ink rgb(value2, value2, value2),0
endfunction
[code]
The end is near
19
Years of Service
User Offline
Joined: 19th Jun 2005
Location: USA
Posted: 11th Mar 2006 04:46
there is only one way to fix this, you need to get a higher hertz.
thats the only way i know to fix it. srry if this post isnt of much use
Tribasic
19
Years of Service
User Offline
Joined: 10th Mar 2006
Location:
Posted: 11th Mar 2006 06:24
thats too bad that my only solution would be to increase the refresh rate.

It's not that big of a deal. I'll still finish the program and put it on my arcade machine. It's just a shame that it doesn't look as smooth as it does on my PC.

I have another question though. When I check my framerate at 60 hertz I get 66 frames per second and when I check it at 85 hertz, it's the same. I get about 66fps. Why will it look 'choppy' when it's running at the same FPS??

Oh, and thanks for looking at my post

TriBasic
mm0zct
21
Years of Service
User Offline
Joined: 18th Nov 2003
Location: scotland-uk
Posted: 11th Mar 2006 19:17 Edited at: 11th Mar 2006 19:27
at 85Hz only drawing 66 frames every signle frame rendred is being displayed at least once, at 60Hz trying to display 66fps it has to miss 6 frames per second, try using sync rate 60 with the 60Hz version and it might look smoother.
i'm not sure what you mean by "choppy" but i think you might be refering to screen tearing, which is when the fps is higher than the refresh rate, they screen buffer is updated with the new output before the actual video output has finished the last frame, so the bottom half of the visible screen is the current frame, and the top half is the last. you tend to get this with first person shooters when you look left or right and vsync is off.

edit: just eralised you are using sync rate 60, try 59 and you might actually get 60 fps, dbp doesn't seem very good at keeping ti the sync rate you set

http://ccgi.lochviewwest.plus.com/design1
AMD athlon 64 3000+, 1GB ddr400, abit kv8, 400GB total hdd, ati radeon 9800se 128mb, 2x17" tft(@1280x1024).
Tribasic
19
Years of Service
User Offline
Joined: 10th Mar 2006
Location:
Posted: 12th Mar 2006 00:14
Hi Digital Dude!!

I think that you are absolutely right about the sync rate. I was able to get a fairly nice looking smooth scroll when I put my sync rate to 52. I was getting around 59 frames per second.

I think that if I want my program to look good at 60 Hertz, I will need to sync my screen updates by using the TIMER() command. I know I read something about it in the forum. I'll check it out.

Thanks so much for the advice!

TriBasic
AndyPandy
20
Years of Service
User Offline
Joined: 12th Oct 2004
Location:
Posted: 12th Mar 2006 02:47 Edited at: 12th Mar 2006 02:49
in fullscreen mode, using a sync rate above your monitors refresh rate will usually cap it to the monitors refresh. Make sure your GPU drivr is not set to vsync off. An even better way is to get the U6 beta and do away with sync all together. Apparently "Sync" was a hack together job. The extra flag on "Set display mode" is the way to go and it seems dbp does not use 100% CPU because its not using the old SYNC system. <-- me thinks.. may be wrong but it works a treat for me oh and on the plus side it works on all desktop modes too
Tribasic
19
Years of Service
User Offline
Joined: 10th Mar 2006
Location:
Posted: 12th Mar 2006 03:43
Thanks for the input. I'll check out the new beta and see how it works!!
Tribasic
19
Years of Service
User Offline
Joined: 10th Mar 2006
Location:
Posted: 12th Mar 2006 19:56
Hi Guys!!

I would like to thank everyone for there help!!

I figured out what I was doing wrong.... and boy, do I feel dumb... I had to adjust my Project Settings to Full Screen Exclusive mode when I compiled the program. Now it runs silky smooth! I loaded it up on my arcade machine and it looks great!

Thanks,

TriBasic

Login to post a reply

Server time is: 2025-06-03 17:26:23
Your offset time is: 2025-06-03 17:26:23