force / detect resolution hertz

Blitz3D Forums/Blitz3D Beginners Area/force / detect resolution hertz

Raul(Posted 2004) [#1]
Hi from France,

I'm not expert in programming especially in special extern code, like DLLs...

Please, can you tell me the "most easy way" to force a monitor frequency (in Hertz) ?

I notice that the demo called <<Aerial Antics>> use DLLs .. made with PureBasic I presume ?! ( systemblitz.dll and blitzcpu.dll ) and this demo force a 800 x 600 in 75Hz

For example, I need a 640 x 480 x 16 .. in 75Hz

We can only do this with DLLs ??
Thanks a lot to everybody !!

Ralph


WolRon(Posted 2004) [#2]
Most people here will tell you not to mess with the users monitors refresh rate. If set incorrectly, it can actually damage some monitors.

Also, many users may get upset if you change their monitors refresh rate. My wife, for example, complained that our monitor flickered too much for her and hurt her eyes, so I bumped the freq. up from 60 Hz to 72 Hz to help. She and I want it to stay that way. We don't want programs tampering with that setting.


Raul(Posted 2004) [#3]
Yes, I understand that 60Hz hurt eyes..

In fact, LCD monitors use 60Hz, but it is not comparable to CRT monitors, however, some games need to adapt frequency to run at the same speed on every computers, isn't it ?

Well, on TV, it is 50Hz or 60Hz and many people play on !!

I Think that "all" monitors are able to display 75Hz.

Thanks to answer.


WolRon(Posted 2004) [#4]
however, some games need to adapt frequency to run at the same speed on every computers, isn't it ?

No. Use a Timer or use the DeltaTime method to frame-limit your game.

Changing refresh rates to make the game run at the desired speed is a bad idea. For instance, what if (as you say "I Think that "all" monitors are able to display 75Hz.") 75Hz isn't available to someone playing your game? What do you do then? Don't let them play at all or let them play it at an incorrect speed?


joncom2000(Posted 2004) [#5]
"some games need to adapt frequency to run at the same speed on every computers, isn't it ?"

No that is incorrect, you should scale your movements based on the speed of the PC it's playing on not based on how fast the screen is drawn. There are some examples on www.blitzcoder.com that give different methods for keeping the gamespeed more constant across a wider selection of computers, I would use on of them as tampering with the refresh rate is the worst thing you could do.

"I Think that "all" monitors are able to display 75Hz

Well no as LCD's almost always only do 60Hz so setting it to 75Mhz wouldn't do much good there would it ;)


Mustang(Posted 2004) [#6]
I will personally come and shoot you if you try to force my monitors refresh rate - nothing good comes out of it and worse case is that you owe me one big & expensive (fried) monitor.

I also heard that ppl jump up when you stick electronic cattleprod in their rear end - can I try this with you? ;P


jfk EO-11110(Posted 2004) [#7]
compared to console programming (or atari ST or Amiga 500 etc) we pc games programmers are doomed to make our games run on a wide range of diffrent hardware. It is true, this is not very easy and we waste some time and energy to do this correctly, compared to, say, XBox Coders.

Nevertheless, even when there are DLLs that can force a frequency, I think this is a bad style that people don't like.

BTW if you really want to use the physical Frequency, you need to use this:

vwait
flip 0

instead of a simple

flip true

because flip true runs with 50 HZ (AFAIK) on all machines
and ignores the true frequency.

So use the currenty vsync frequency to prevent the pics become cut-off halfway with anything other than synchronisation with the hardware vsync.

Then use Delta Time to multiply all motion and movement, as well as parameter for UpdateWorld() (that will delta-t-coorect the 3D animations)

eg:

ft#=t-t2
delta#=ft# / 16.67
t2=t
t=millisecs()
...
moveentity player,0,0,playerspeed# * delta#
...
updateworld(delta#)
renderworld()
...

of course you need to initialize t and t2 before you start the mainloop.


morduun(Posted 2004) [#8]
Keep in mind that the

VWait
Flip 0

method is incompatible on some older cards and causes horrendous flickering -- Flip True is the only surefire method I've seen that will stop flickering across the board.


Gabriel(Posted 2004) [#9]
I Think that "all" monitors are able to display 75Hz.


I only have two monitors, and neither of them will do that. My CRT only does 72 and my TFT only does 60.


Raul(Posted 2004) [#10]
Thanks to all for informations but please don't be "aggressive" ;)

Well, perhaps the DLLs detect if monitor is able to display frequency ?? (have you tried the "AerialAntics" demo ??)
(...)

In fact, the "CreateTimer()" solution cause jerks if the current frequency isn't proportionnal to "forced" frequency (example: CreateTimer(50) will run properly on 50Hz and 100Hz but jerk between 50 and 100...).

I thought about several solutions and JFK mentionned ones who is certainly the best way !

It's true that PC developer must adapt many many parameters ;)

Go well everybody !

Ralph


Raul(Posted 2004) [#11]
Mustang:
<<
I will personally come and shoot you if you try to force my monitors refresh rate
>>


I have visited your web site and you force visitor to change resolution for viewing your pages
(...)

LOL

LOL

LOL

;)


Mustang(Posted 2004) [#12]

I have visited your web site and you force visitor to change resolution for viewing your pages



:) I had forgotten that I do that check... not really forcing or anything, just suggesting. Funny thing here is that the (current site version) site was designed to fit even 800* wide browser screen but my nag-screen suggests 1152x864 rez... it's been years when I last had a monitor that was capable of only 800*600 so I have not seen the nag-screen myself for a very long time... have to fix that someday!


jfk EO-11110(Posted 2004) [#13]
morduun - my tft screen runs with 60 Hz physical sync, and when I use Flip true, it will use 50 Hz instead and completely ignore synchronisation, resulting in ugly cut off frames.

THe only solution I see atm is to initially perform a test, somethin like this:

vwait
t1=millisecs()
delay 1
vwait
t2=millisecs()

hz=1000.0/(t2-t1)
if (hz>= 45) and (hz<=300) then ; assuming monitor has 45 to 300 Hz
 can_handle_vwait=1
else
 can_handle_vwait=0
endif
...
while  game
 ...
 if can_handle_vwait=1
  vwait
  flip 0
 else
  flip
 endif
wend


tho I used vwait:flip 0 in my latest demo and nobody mentioned any flickering...


Raul(Posted 2004) [#14]
to Mustang:
Yes, it's a little ironic but I work on 800x600 and I can't slide your web pages. For correctly viewing, we are "forced" to change resolution ;)
Your site looks great !
(...)

Thanks JFK for your vision of solution.

I'll try to work without DLLs and without forcing monitor's frequency...
...I'm happy to see that users help others :)

Merci beaucoup a tout le monde et bonne continuation a tous les utilisateurs de Blitz !

Ralph


morduun(Posted 2004) [#15]
jfk -- my sony vaio laptop flickers madly with that code, making the display completely unviewable. :/ If flip true fails on your TFT then there's just no way to ensure a smooth display without just taking as good a guess as you can and giving the user options to change things around.


Mustang(Posted 2004) [#16]
I was about to suggest the same thing Morduun said, giving users ability to choose. Most games out there have an option to enable or disable Vsync, and so should we. Of course you then have to do the gamelogic so that you don't use fixed sync... but this is how you should do PC games anyway (meaning DeltaTime).


BlackD(Posted 2004) [#17]
hehe.. i just avoid the issue by forcing a lower frame rate, vwaiting on it, and working in some nice tweening for animations. Then again, I'm writing 2D games where 30 FPS is very playable.. I guess with 3D its a bigger issue.


mindstorms(Posted 2006) [#18]
I have found that using frame tweening and delta timing works very well together. The tweening gets rid of any sharp movements that delta timing creates