Game Development Community

Torque X 2D Performance Optimization Tips

by Robert Ota Dieterich · in Torque X 2D · 08/29/2010 (4:24 pm) · 9 replies

Hey all,

I've posted up some articles on a few quick and (somewhat) dirty optimization tricks I used to increase the performance for Legend of the Rune Lords, a game I released a few months ago of XBLIG.

Quick and Dirty Torque X 2D Optimization Tips: Content Clean-up

Quick and Dirty Torque X 2D Optimization Tips: T2DTileLayer

Quick and Dirty Torque X 2D Optimization Tips: T2DAnimatedSprite

Hope they help.

#1
08/31/2010 (6:01 pm)
The animated sprite performance tweak in particular look interesting. Nice work!
#2
09/01/2010 (5:37 pm)
Yeah, thanks for the tips robert!
#3
09/03/2010 (2:12 am)
Added to TDN Community links

http://tdn.garagegames.com/wiki/TX/Tutorials_and_Guides
#4
09/04/2010 (7:26 pm)
Hey Robert,

you've posted in the archive on a public website whole Torque X components which is not allowed: please post just diff files instead because as it is now it's a licence violation.

Can you tell on which version of the engine those applies? At a first glance it look the original 3.1.4 to me. Are you aware of the Community Enhanced Version?

EDIT:
I've checked out your proposed changes. The T2DQuad has been changed so your hack cannot really be applied to the current engine.
Your idea of using a shader driven mapping has value but I'm not sure it still applies to the current engine (I'll have a look at that). I'm hacking the whole .fx set of files because most of them don't compile in XNA GS 4.0, so I'll see how your proposed approach can be integrated. Thanks for sharing it :)
#5
09/05/2010 (4:03 am)
Thanks for the heads-up Giuseppe on the license issue. I'll switch over to diffs in the archive as soon as I have a chance.

The version I built on was the 3.1.0 version of the engine.

The Community Enhanced Version of Torque X 2D looks pretty promising. Do you suppose I could have access to your SVN to take a look?
#6
09/05/2010 (9:27 am)
@Robert: sure you do, I'll send you the invites right away ;)
#7
09/15/2010 (10:41 pm)
Heya Robert. Would your method of increasing the performance of animated sprites work with sprites that had animations that spanned multiple sprite sheets?

I realize that the performance gains will probably be lost in these cases but In my game my characters are composed of multiple sprite sheets and a few of the animations are split onto two different sheets. Would these animations still work?

I ask as this functionality would be great in the old and new XNA 4.0 engines and I may be working with shader stuff. :)
#8
09/24/2010 (1:35 am)
Hey Matt,

Sorry about taking so long to respond (my wife and I just had a baby!)

Regarding multiple sprite sheets, I haven't examined Torque's behavior there closely, but I have a similar situation where many of my animations are spread across different sheets.

You mentioned that you have animations that are split onto two different sheets, I hadn't realized that that was even possible. As far as I've used them, any individual animation has had all of its frames on the same sheet while different animations may inhabit different sheets.

The optimization works by eliminating a vertex buffer update every time an animation updates the UV coordinates used for sampling from the texture (basically every time an animation moves from one frame on a sprite sheet to another.) So, as long as an animation has more than 2 unique frames from a given sprite sheet, you should see a performance increase.
#9
09/24/2010 (3:45 pm)
Grats on the baby.

In retrospect I realize that I wrapped T2DAnimatedData so my animations are actually made up of multiple animation datas so never mind about that :). I wasn't thinking.

Thanks for the response! I'll see if I can make this work in 4.0 after its ported.