1
votes

I am using XNA game studio to make a 2D Sandbox RPG similar to Terraria & Starbound.
I have a great tile system but it still takes over 12-13 ms to draw a whole scene at 1920 x 1200 when the screen is full of tiles.
I have over 15 tile sets currently each one is all together on a 256 x 1024 texture plus each tile set has 6-7 extra tile sets of the same size for rendering the blends with other tiles.
I am wondering if it would make much of a performance difference if I just created a larger texture at load-time and copied all of the blend textures over using SetData().

Is there any performance issues with drawing an 18 x 18 portion of a large texture such as 2048 x 1024 a few hundred times on the screen?

I am using spritemode.texture to draw my tiles which already improved the speed a bit but I am trying to shave off a couple more milliseconds.

1
Welcome. If you are looking for a specific solution, you could probably share your code, or the part of it that addresses the question (it helps if the code is reproducible).Andre Silva

1 Answers

0
votes

That number seems quite high, but the only sure way to find it would be to profile it. SpriteSortMode.Texture and Deferred will be the fastest, some good move there. If you could share a sample of your spritesheets and rendering code that would be nice, I'm not sure why you would need all of that. Using SourceRectangle overloads of spritebatch should not effect your draw time, but again, the only way to find out for sure if to profile it.

Ofcourse, the less texture swaps the better, so packing everything into 1 texture will be a good idea, and there is a nice code sample on MSDN about it.