Sprite rapid slowdown

Started by
9 comments, last by red_sodium 19 years, 10 months ago
Hey GDers, I have two sets of tiles being rendered on-screen. When just one set is rendered, my frame rate is fine (~80 FPS) but when I render any number of tiles from both sets on screen, it drops to less than 1 FPS. I am using ID3DXSprite for my sprites, and the tile sets share one common (small, power-of-two''d) texture each. As soon as I move my viewing frustrum to include both in my view, the frame rate drops and the game essentially freezes. I am quite sure it is the ID3DXSprite::Draw method where the dramatic slowdown occurs but I''m not sure why. Even if just one tile from the other set is shown on screen while the main tile set is on the screen, the frame rate drops. Surely there can''t be many things which cause this. It could be memory related but I''m not sure, I''m quite sure it won''t just be a local machine/memory problem though. Thanks Stay Clausal, Red Sodium
"Learn as though you would never be able to master it,
hold it as though you would be in fear of losing it" - Confucius
Advertisement
To rule out the system-related error possibility, put the source up somewhere so we can try it.

ID3DXSprite is efficient because it batches everything passed to it through Draw(). At this stage, it just appends the vertices and transforms them through software algorithms. It actually only sends the data to the GPU when you call End().

So, could it be something with the two tiles sharing the same texture? I doubt it, but it''s possible. You could try calling ID3DXSprite::Flush() in between the two tile Draw() calls. This will force all the batched sprites to be submitted to the device.

Also, what graphics card do you have, and what drivers are you using?


Dustin Franklin
Mircrosoft DirectX MVP
Dustin Franklin ( circlesoft :: KBase :: Mystic GD :: ApolloNL )
The Flush() idea didn''t work.

I am using a nVidia TNT2 card, with nVidia drivers.

It''s a very weird problem as it appears to be temperamental, which makes debugging by deduction that little bit harder. It also appears to happen with any texture. As for posting source code, I''ll need to try and isolate the problem area because there is quite a lot of code.

Thanks for your help so far.

Red Sodium
"Learn as though you would never be able to master it,
hold it as though you would be in fear of losing it" - Confucius
Yeah, we need to see some source if possible.

Do you have just ONE sprite interface or two?

-cb

~ c o l ec o ~



Rock the cradle of love!
You stupid WANKER!
S i g n a l D E V .com
Metroid Classic

Rock the cradle of love! You stupid WANKER!
Always one.

--
You''re Welcome,
Rick Wong
- Google | Google for GameDev.net | GameDev.net''s DirectX FAQ. (not as cool as the Graphics and Theory FAQ)
Just one, and here's some parts of the code that may help:

(Call to Sprite::Render() is on line 37)
Inside main Render() function

Sprite class member functions Transformations() and Render()

Thanks for yor help.

Red Sodium
Build a man a fire, and he'll be warm for a day. Set a man on fire, and he'll be warm for the rest of his life. - Terry Pratchett

[edited by - red_sodium on May 30, 2004 1:47:21 PM]
"Learn as though you would never be able to master it,
hold it as though you would be in fear of losing it" - Confucius
Okay, I''ve managed to narrow it down to two factors:

-Where I create my texture
-If I initialize sounds or not

Sound class code

If I don''t create any sound buffers, I get no problems. But I have no idea why not: textures and sounds are not connected in any way, and I''m not even playing these sounds at all, just initializing them. It doesn''t appear to be related to a single instance of the Sound object, but any Sound object I create.

Red Sodium
Build a man a fire, and he''ll be warm for a day. Set a man on fire, and he''ll be warm for the rest of his life. - Terry Pratchett
"Learn as though you would never be able to master it,
hold it as though you would be in fear of losing it" - Confucius
Oh yeah, I should mention that if i create my texture *before* I initialize my Sound (one object per sound, btw), I get no problems. But if I create afterwards, the 1-2 FPS problem.

It only appears to happen with my wall textures and not my tile textures.

The only thing I can think of at the moment is a memory problem, but that would give an access violation and NOT a very slow framerate.

Red Sodium
Build a man a fire, and he'll be warm for a day. Set a man on fire, and he'll be warm for the rest of his life. - Terry Pratchett

[edited by - red_sodium on May 30, 2004 4:47:56 PM]
"Learn as though you would never be able to master it,
hold it as though you would be in fear of losing it" - Confucius
As a test try setting your soundcard hardware acceleration to off. I have heard of a problem not unrelated to yours in the past which was due to this - don''t know why though
------------------------See my games programming site at: www.toymaker.info
quote:Original post by Trip99
As a test try setting your soundcard hardware acceleration to off. I have heard of a problem not unrelated to yours in the past which was due to this - don''t know why though


Thanks for the tip but it didn''t make a difference.

Tonight I''ll try to deduct what the problem is. Unfortunately, I have another problem where I get an access violation from the sound buffer creation function when I unfocus my window while it is initializing the sound class (and therefore buffers). I don''t know if they''re related, but I''ll have to try and solve both problems. Any more ideas, anyone?


Red Sodium
Build a man a fire, and he''ll be warm for a day. Set a man on fire, and he''ll be warm for the rest of his life. - Terry Pratchett
"Learn as though you would never be able to master it,
hold it as though you would be in fear of losing it" - Confucius

This topic is closed to new replies.

Advertisement