Sign in to follow this  
TFS_Waldo

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

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
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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this