Advertisement

high framrates in games with complex gfx

Started by February 27, 2000 01:54 PM
15 comments, last by Ridcully 25 years ago
as a start to get familiar with dx i coded tetris using ddraw. okay, it works fine with a framerate of about 100 when i only draw the background image. but then as more blocks are on the screen, the framerate constantly drops. only to about 50 frames, but it DOES drop. i am using bltfast() on one backbuffer (increasing those won''t work) and the blocks are all seperat 24x24 offscreen-surfaces (okay, that is room for optimization) and a display mode of 640x480x16 so if the framerate even drops with such simple games, how do you achieve a high framerate with complex games like a rts with a lot of units and background on the screen, AND computing a lot of ai stuff at the same time...? is there something i am missing that professional programmers do? thanks for any hints ridcully
It sounds like your monitor is running a refresh rate at 100Hz. With only the background your game manager to render between every pass, but when you add the blocks the time to render is a bit longer than one refresh of the screen. If VSync is enabled the game waits for the next pass before updating the screen, hence the frame drops to 50.

Try disabling VSync, can usually be done in the driver options, and see if the framerate doesn''t rise again.
Advertisement
no that is not the case...
perhaps i didn''t express clearly: the framerate is first high (depending on the system i run, 30 for a p133, 130 for a celeron466) and it consistently drops when more (small) blocks enter the screen. (19 for a p133, 80 for a celeron466)
this is okay for my small game, but the consequences with a really complex game as i mentioned would be inacceptable i suppose.
so is my code really that bad?
I kinda feel the same way....im doing this game and i have around 2 animation consisting of around 9 frames each runnin at all times........i have a fps at around 85-95 but if i use very large images the frame rate drops......

it hasnt been a problem yet but i think when i get lots of object at the same time i will have that problem and would very much like an answer to it
I makin a First Person Shooter, and in a small level consiting of about 5000 polys, I get about 95fps on dual Voodoo2''s and on a K7 500@550(110 bus). And this is not using BSP or Portal, All polys with a Z-Buffer(for now).
Typically industry game programmers are a quite a bit more experienced than the people on this board. For a high-end Pentium II/Celeron I see no reason why a 2D tetris-style game shouldn''t be capping at the refresh rate.

The solution is to keep programming; learn; profile. Keep programming.

Esap:

No offense bud but 95 fps isn''t exactly impressive for that kind of demo on that kind of machine.
Advertisement
Thanks for complimenting my machine, Yeah, I got a lot to learn, but Im proud!
Where do you set DX not to wait for a Vsync in Win2k? There doesn''t seem to be any DX option in the control panel?
Thanks
Lance: sure, i admit that pro coders are more experienced than i am, but i simply don''t see how you can speed blitting up more than using blt.
i tracked the performance loss down to this function that is a member of DDraw and therefore i suspect that even professionals use it.
are there any tricks i should know?

ridcully
How did you track down your performance loss to this one function?

It may be the case that, like Spellbound suggested, your monitor is running at 100Hz and as you add blocks, your redraw cycle is extending beyond 10ms. Just by enough that when you call flip it has to wait for 9ms for another vsync. In this case, that time delay is going to show up in the first DirectDraw call after the call to flip, which is most likely going to be your Blt of your background surface.

If you''re using a profiler, try this simple test. Run the profile once as it is and see which function is causing the big slowdown. Save that output into a file. Now a Lock/Unlock call just before the first Blt of each frame. It should be the case that now Lock is the function that''s causing the slowdown. If that''s the case, then you should try to decouple your frame updates from VSYNC, or else set your monitors refresh rate a little lower (try 80 or so).

This topic is closed to new replies.

Advertisement