Jump to content
  • Advertisement
Sign in to follow this  
TFS_Waldo

MDX and C# :: "Sprite" Performance (Tile Map)

This topic is 4484 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 just started working on a tile editor for my game. I'm using Managed DX 9 and C# 2.0. Everything works well. I have a split container in the main window, the right pane is a "Panel" that renders the scene. The left pane is another split container, holding the "object tree" (meshes, tiles, etc.), and the bottom pane holding a "PropertyGrid" that displays properties for a selected tile. Well, I created my "Tile" class, which contains a D3D "Texture" and "Sprite". Nothing wrong here. When my app. is rendering a blank scene, I get ~500-600 FPS. But when I render the full map (only 10x10), the frame rate drops to 85-95 FPS. I coded the tile class to hold a static "List<Texture>" (list of current textures) object, and a static "List<string>" (list of current file paths, so I can check if the texture is already being used). I make sure, that when a tile's texture changes, that it isn't already in the list, so it doesn't load the same texture twice. The code works just fine. The "static int numTextures" is '1', because initially each tile has the same texture. Why is 10x10 sprites causing a HUGE drop in the frame rate? Is is because I'm using "Sprite", or could it be MY code? And when I call: d3dSprite.Begin(); d3dSprite.Draw2D(/* Parameters */); d3dSprite.End(); It's not good to pass "new Rectangle(...)" to the 'Draw2D' call each frame is it? I JUST thought about that. I did that just to make sure my "Tile" class worked. Maybe I should store a "Rectangle" as a data member, and pass it each time instead? Would that help? I'm on a PIII 733MHz, GeForce FX 5200 128MB (PCI). I know those aren't the fastest. But if I can run Quake III at ~110FPS, it can't be either of those could it? ------- Another Question Also, I get an error on random exits. When I exit my application, through the "X" or through "File->Exit", I get a dialog saying "Error in the application.", and the details point to "Sprite.LostDevice()". But sometimes, it exits without a problem. What could cause this? Thanks in advance, and I hope my questions are clear. =D Matt U.

Share this post


Link to post
Share on other sites
Advertisement
just off the top of my head, using the SortByTexture flag in Sprite.Begin should provide some performance increase if you're using many different textures.

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!