Vertical Sync

Started by
2 comments, last by Drake22 20 years, 11 months ago
Hey guys! I have been programming a Pong clone just because using DX8. I am having some problems with it. On the computer at school (633 mhz 16mb TNT2) the ball moves inconsistantly and it only runs at 40-50 FPS. At home it runs at 1500 FPS and the ball still moves inconsistantly. What could be causing this difference? I thought maybe V-Sync. How do I disable V-Sync in DX8. I tryed: d3dpp.FullScreen_PresentationInterval = D3DPRESENT_INTERVAL_IMMEDIATE; but now my program crashes on initialisation. You can find my code on my FTP server at ftp://67.168.61.132/dev/IsoHex25_DX8/ (NOTE: IP address is dynamic so check back for updates. It should work just logging in automatically through IE or Netscape. Thanks for your help. David [edited by - Drake22 on April 30, 2003 10:46:30 AM] [edited by - Drake22 on May 3, 2003 7:30:27 PM]
David"One of the keys to happiness is a bad memory." - Rita Mae Brown
Advertisement
Actually, vsync shouldn''t make any difference; in fact, it might make the thing run more smoothly. You probably already know the bit about what vsync is - wait for the electron gun in the CRT to get done with a full screen update, etc., etc., so that shouldn''t be the problem.
"Pleased to meet youHope you guess my nameBut what's puzzling youIs the nature of my game"-- The Rolling Stones
I assume you meant to put *less* not more smoothly. I ended up disabling vsync, it was crashing for a different reason, and it ran at about 160 FPS. Then it DID run smoothly...cant tell you why. Whenever it gets below a certain FPS it runs choppy again. I would be very interested to learn why it does that if anyone can either look at the source or just explain to me why? Maybe its some way I do the rendering code. I have a vertex buffer for each object (ball, and 2 paddles) and switch the buffer based on the object and render the 2 triangles in a trangle strip. Am I doing it wrong? Maybe its something to do with my code for the angles (pseudo-code):

MoveX(speed * cos(angle) * time)
MoveY(speed * sin(angle) * time)

Thanks for any help.

David
David"One of the keys to happiness is a bad memory." - Rita Mae Brown
Ah... that code might help. If you store the previous location as integers rather than floats, you lose some precision, therefore making the movement less smooth. And no, I meant more smooth, because playing a game at full fps rather than vsync''d is not really smooth - it runs quickly enough that one might not realize that the display normally looks jerky, but it''s not really smoother.
"Pleased to meet youHope you guess my nameBut what's puzzling youIs the nature of my game"-- The Rolling Stones

This topic is closed to new replies.

Advertisement