Game Development Community

Technical question: sprites vs. framerate

by Jeffrey T. Spicer · in Torque Game Builder · 08/21/2006 (3:18 pm) · 2 replies

Just wondering: Does Torque draw only the layer that is seen, or does it draw the bottom layer, and then redraw the next layer on top? (does it take up time by redrawing stuff over other stuff) I'm making a scrolling tile map. A grass layer fills the whole screen, and a lava layer on top of that, and rocks and trees, and on-and-on, and about 20 animated "people" and partical effects. I anticipate using enough sprites and tiles to fill the screen 4 times on any given frame. It seems there was a test done with 4000 static sprites with no challenges. I'll only be using 3000 (but they'll be big enough to fill the screen a few times)

Question 1: Do the tiles that never show need to be erased for the sake of frame rate? I know Torque does some optimizing, but can it handle drawing to the screen 4x over?

Question 2: Some of my sprites have lots of alpha channel. Is it better to cut these up into smaller chunks and reduce the amount of alpha channel for the sake of frame rate?

The real question is "Do I need to take the time to erase stuff that doesn't show anyway, or do the Torque optimizers take care of things like this?"

#1
08/21/2006 (7:16 pm)
With the TGB Adventure Kit we were really surprised at how much stuff we could put on screen. On our largest level we had over 900 sprites plus 3 tile layers 50x50 each... and it still was running at 70fps on a P4 3.2GHz machine. What we found was the biggest killer was collision.... look out for that.

1) You'll be ok... stuff that is offscreen isn't drawn. We're doing 3x overdraw on the screen without any hiccup... you should be able to do 4x.

2) Always use the least alpha as possible... but we haven't found that it kills you yet.

So no you don't need to erase stuff that is offscreen... it's all culled as far as visibility goes. You do have to worry about offscreen collisions.
#2
08/23/2006 (11:48 am)
Thank you, Tom!