• Advertisement

Archived

This topic is now archived and is closed to further replies.

Slow Code! Major problem, plz help!

This topic is 6051 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I have nearly completed my first major game, which I have been working on for 6 months now. However, throught the game''s development, I neglected to test it on another machine. Well today I tested it on two other machines and it was dirt slow! Definately not playable! So I come to ask for help... what exactly is making my code run so slow, and what could I do in my code to make my game run faster? I''m using C++, and DirectX. My system specs: 700Mhz,640MB RAM,Voodoo3 Test system specs: 800Mhz,128MB RAM, GeForce2 MX 450Mhz,64MB RAM, cheap/unknown video card It doesn''t make sense that it would run slower on the 800Mhz machine than it runs on the 400Mhz computer. Someone please help!!! I would greatly appreciate it. Thanks.

Share this post


Link to post
Share on other sites
Advertisement
Is your game using Direct3D? I read somewhere that 3DFX cards take only a small performance penalty when changing states, far less than non-3dfx cards. Maybe that''s your problem?

Share this post


Link to post
Share on other sites
If you are using D3D and you''ve hard coded it to use the voodoo3 (which is a secondary device), then when it runs on a non-voodoo machine it''ll use the software emulation mode - which is painfully slow.

You can only avoid this by using proper device enumeration.

Cheers

Matt

Share this post


Link to post
Share on other sites
I saw you had 5 times more RAM on your machine. If your game needs more than the 128MB or the small overhead of Windows and your game need more than 128MB RAM. If that is so the comp would try to use the HD for extra mem (extreamly slow by up to 10x). That would definitaly slow down your machine. Just a thought. Hope that helps.


Tazzel3D - Zach

Share this post


Link to post
Share on other sites
quote:
Original post by sysmark
Is your game using Direct3D? I read somewhere that 3DFX cards take only a small performance penalty when changing states, far less than non-3dfx cards. Maybe that''s your problem?


I have a Voodo 5500 AGP on a 500 Celeron and it ''processes'' my D3D prototypes twice as fast as my 800 PIII using a ATI 128 Pro.

So my guess is state changes.

I have had to build a preprocessing graphics pipeline that orders all graphics primitives by state change BEFORE sending them to DX. On 3DFX boxes this slows down the frame/sec as there is more processor overhead, but on non-3DFX boxes the frame/sec actually increases, as there is less work the GPU has to do.



D.V.

Share this post


Link to post
Share on other sites
The game is a 2D game, using just DirectDraw. However, the funny part is when I recently commented out the whole game, except the calculations of the FPS, and it still ran slow! That tells me that my code has nothing to do with it, that something else is the problem.

I also added another test system to the picture. I used a 400Mhz, 128MB RAM, 2D/3D Banshee card and it ran at around 60 FPS! Which is just a tad bit slower than on my 700Mhz.

So with this said, what is going on??????????????? This is weird...

Oh... could the initialization of many global variables be a part of it? I took out my code, but I didn''t eliminate the initialization of my global variables.


Thanks again.

Share this post


Link to post
Share on other sites
You''re not using GetTickCount(), are you?

Johan Torp - http://www.destruction.nu

Share this post


Link to post
Share on other sites
ok, here''s couple of thoughts.
ive noticed lots of people that finished
their software, just ship the final file (ahem.. Micro$oft)
anyway, why not remove (after youve completed the whole
debugging process to:

change from "Debug version" to "Release version",
what does that help you?
decreases LOTS of code -> smaller (sometimes i had 2mb->200k)
and a whole lot faster.

try it.

Gil

Share this post


Link to post
Share on other sites
thorpe said:

"You''re not using GetTickCount(), are you? "

I am using this to calculate frame rate on my project, whats the problem with it?

Share this post


Link to post
Share on other sites
Changing the FPS calculation from GetTickCount() to timeGetTime() shouldn''t make a difference in the way the game performs. Its not that the FPS is off, the game itself runs slow on the other machines. If anyone can contact me on ICQ to help out, it might be a bit more convenient. My ICQ # is 6792368. Thanks once again.

Share this post


Link to post
Share on other sites
I narrowed it down to the fact that my Blt is somehow in efficient. You see, I am using the generic Blt() function in DirectDraw to draw my sprites. However, I have some surfaces that are quite large, such as 800x600 background surfaces and other large bitmaps that are the width/height of the screen. I have noticed when drawing those larger surfaces to the screen (I draw to the backbuffer first, then flip(pageflipping)), the program gets very slow. What is causing this, and how else could I load these larger bitmaps, in order for them to blit faster.

Share this post


Link to post
Share on other sites
I have tried using BltFast, but can''t get it to work. I was told that I have to remove the clipper, and make sure none of the edges of the bitmap touched the edge of the screen, and I did so, and BltFast() still doesn''t work. I''m not sure what I''m doing wrong.

I''m calling:

lpddsback->BltFast(sprite.x,sprite.y,sprite.images[sprite.curr_frame],&DestRect,DDBLTFAST_WAIT);

instead of this: (which works fine)

lpddsback->Blt(&DestRect, sprite.images[ sprite.curr_frame ], NULL,DDBLT_WAIT | DDBLT_KEYSRC,NULL!=DD_OK)


Would could be the problem here?

Share this post


Link to post
Share on other sites
If the video card supports hardware blitting, then BltFast won''t make a difference, it''ll be just as fast. BltFast will only work faster than Blt in the HEL. Maybe the cheap/unknown video card doesn''t support hardware blitting, and that''s why it was really slow?

Share this post


Link to post
Share on other sites

  • Advertisement