how make my prg faster

Started by
3 comments, last by Jwk 24 years, 3 months ago
I''m making a 3D game(directx6.1). But I met a big problem: it is tooo slow. About 7fps. The test computer is: PII 266, 64M memory, Riva128 4M videocard. 7000 Polygons per frame. I use D3DIM mode. How can I make it faster? Use ASM? Please help me.
Advertisement
I''m afraid your question is a little too general to answer. You would need to provide more details about your code, but even then, I don''t think that would help. Getting more FPS is one of the main reasons why many people contribute to the Gamedev forums, there is no magic bullet that will make everyone''s program run faster. Someone would have to look through every line of your code to help you...and no one is going to do that.

Instead, try focussing on the techniques and tricks that pop up in the various Gamedev forums. Maybe there is something that you are doing that inhibits your game''s speed. There''s an old adage that states "10% of the code does 90% of the work". The idea is to make DirectX do the work. Make sure that your code doesn''t try to reinvent the wheel, if there is a DirectX function that performs a certain task that you need, make sure you use it. Find the part of your code that does most of the work and concentrate on that.
------When thirsty for life, drink whisky. When thirsty for water, add ice.
Keep your render state changes to a minimum. Minimize the amount of polygon data that gets sent across the bus to the video card. Minimize texture changes. Shut the FPU precision checking off (see the SDK docs). Using ASM probably won''t solve your problem, as the optimizing compilers do a pretty good job. Man, like Graylien said, there are a lot of possibilities here with this generalized question.

--Shannon Schlomer, BLAZE Technologies, Inc.
--Shannon Schlomer, BLAZE Technologies, Inc.
Texture swapping can hurt performance alot.

Go to HKLM\Software\Microsoft\Direct3D and add a new DWORD value called "DisplayStats". Set it to 1, and in debug builds texturing statistics will show up on the screen.

Check out the number of textures used, number of SetTextures() (this is the number of texture changes actually done by the hardware, not the API SetTexture(),) size of the working set, number downloaded to card, etc.
Yeah, first, use a profiler to make sure the bottlenecking is in the rendering functions and not in your own logic/updates. If so, see if you can squeeze a bunch of textures onto one surface to minimize texture changes, then render similar textures together to minimize even more. Use less lights, especially point and spot lights (they're slow), cull any objects that won't be rendered (out of view), lower screen resolution (I wouldn't go lower than 640x480 but if you're trying to do anything higher with that card you're bound to hit some speed issues), and of course reduce the amount of polygons in your scene. Also avoid locking surfaces (and vertex buffers), GDI calls, and 2d operations (blts) whenever possible.
Thats all I can tell ya without any more info on your program (:

BTW, whoever posted that above me, thats a really cool trick!


-ns-

Edited by - NightShade on 1/10/00 3:42:17 PM
-ns-

This topic is closed to new replies.

Advertisement