Skip to main content
GameDev.net gamedev.net
🔒 Locked

Framerate lower than expected

Started by DiscipleOfTorak Dec 12, 2002 at 3:46 PM 3 replies 400+ views
Original Post
DiscipleOfTorak
DiscipleOfTorak
So I am making this DirectDraw game (clone of old "Moonstone"). It is laregly built upon the "WinX gameconsole" which is used by André LaMothé in "Gameprogramming for dummies". This is because I don''t have time to learn all the windows stuff right now... Anyway...in the beginning I had a locked framerate at ~33 fps, since I did not allow the gameloop to continue until 30 ms had passed. But since I thought this was a really stupid thing to do, I remade it so that the loop is free from "waiting" and just continues as fast as it can. Pseudocode: BEGIN mainloop CALC current framerate GET input DO all the gamestuff DRAW WAIT FOR VSYNC FLIP (backbuffer) END LOOP The strange thing is that I only get a framerate of ~43 fps. My computer is a p3-866, 256 Mb RAM and a GeForce256 DDR. I have tried both compiling in release and debug, and it is the same. It seems kind of low to me... any suggestions on what might be wrong? It''s no great problem really, the game looks ok in the current framerate, but it bothers me...I hate not to know what is going on.
DiscipleOfTorak
DiscipleOfTorak
OK, turning of VSync made the framerate to jump up to 80-90 (sounds more reasonable), but I am not sure that I want it turned off. Maybe there is something else making it go slow? Suggestions?
blahpers
blahpers
What refresh rate are you running your game at?
---blahpers
DiscipleOfTorak
DiscipleOfTorak
Uhm, no idea really. How do I check that? *feeling newbeish*
John Reynolds
John Reynolds
Reordering your game loop will help. At the moment the CPU will be idle from the moment it issues the last draw command until the graphics card has finished processing and the surface flipped.

Try moving the Drawing to the top of the loop, before you get your input. This will allow the graphics card (the GPU) time to draw everything from the last frame while the data for the next frame is processed (input, ai, sound, etc). So, both the CPU and GPU are kept busy simutaneously and your game should run faster.

Hope this helps.

Cheers,
John

[edited by - John Reynolds on December 13, 2002 4:22:52 AM]
John ReynoldsCreative Asylum Ltdwww.creative-asylum.com

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.