Jump to content
  • Advertisement
Sign in to follow this  
cyric74

Sprite.Draw Questions

This topic is 4846 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

[Moved from Beginner] My current 2D isometric combat sim is having a lot of difficulty with processor use when it needs to display a large quantity of tiles (Around 730 on screen). I'm using Managed DirectX 9's Sprite.Transform and Sprite.Draw to render raw textures not applied to a surface, but am having difficulty finding information on how exactly MDX9's Sprite.Draw works. Does it use its own internal texture surface? Is it relying on the processor to render, and not the video card? What would be the best solution considering my current framework? I don't care about total optimization--I just want to render the tiles without bogging down a player's system. Thanks, Cyric

Share this post


Link to post
Share on other sites
Advertisement
Internally, the Sprite interface uses a textured quad and relies on the video card to render. However, it can get bogged down by state changes. If you group your Draw calls by texture, it should perform reasonably well. Also, you should have only one Sprite interface for all sprite/tile rendering and should call Sprite.Begin/End only once per frame.

Share this post


Link to post
Share on other sites
Thank you for the information.

I use only one Sprite interface, and only a single Begin/End per frame. I will try to implement a texture grouping method; just fiddling around with this I was able to reduce processor use by quite a bit.

What is considered an unreasonable number of calls to Sprite.Transform and Sprite.Draw? Am I asking too much by calling them 1000-2000 times per frame?

[Edited by - cyric74 on August 15, 2005 2:27:58 PM]

Share this post


Link to post
Share on other sites
Quote:
Original post by cyric74
Thank you for the information.

I use only one Sprite interface, and only a single Begin/End per frame. I will try to implement a texture grouping method; just fiddling around with this I was able to reduce processor use by quite a bit.

What is considered an unreasonable number of calls to Sprite.Transform and Sprite.Draw? Am I asking too much by calling them 1000-2000 times per frame?


You're welcome.

I don't think 1000-2000 calls is unreasonable, but the real question is this: What do you consider an acceptable frame rate? If the game is responsive and the play is visually smooth, then it really doesn't matter how many frames per second you are rendering.

Share this post


Link to post
Share on other sites
My concern is only for the gameplay, and as long as the technology supports that without getting choppy, then I'm happy.

The most noticable effect of my current trouble is that tile picking lags quite a bit behind the actual mouse position. I'm also worried that this will cause some of my animation to be jittery, so my goal is to be able to render a screen full of tiles (at a maximum of ~2000 sprites) without pushing the processor above 10% use. Currently it runs at about 45% use, but I've started to work on your suggested optimization, along with two or three more ideas that I think will help.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!