Game Development Community

dev|Pro Game Development Curriculum

Torque 2D: The Big Update List

by Michael Perry · 01/03/2013 (6:56 am) · 43 comments







Legacy vs New

Much of the content of this blog is aimed at informing previous T2D and iT2D users about the major differences between the old technology and the new Torque 2D MIT code. If you are just now finding out about the upcoming MIT release, you can read these past blogs:

Torque 2D MIT Coming Soon
The Future of Torque 2D is Open Source!

This blog is going to cover the major differences at a very high level. I plan on posting more blogs each week that will cover systems in greater detail, but I am more than willing to answer questions in the comment section. Anyone who plans on porting their project will want to read these blogs carefully.

Veteran users who plan on creating a new project with the MIT codebase will also want to read up on the new features before planning out game systems. All in all, a huge portion of the engine has been rewritten, so let's get to it.

Similarities

  • C++ core engine: The base T2D engine is still written in C++, with some C mixed in. The iOS and OS X side utilize C++, but also mixes in Objective-C.
  • TorqueScript: No major enhancements. Still used primarily for developing game play.
  • Low level inheritance: The base classes are still present: ConsoleObject, SimObject, SceneObject, SimComponent (not in that order)
  • Core support systems: There have been some improvements, but the code for handling memory, strings, console, etc, is still present
  • Behaviors: The base behavior system is still there, but we have added new features to it. You can still create components in C++ and BehaviorTemplates in TorqueScript
  • Many GUI controls: The vast majority of GUI controls are still present, such as GuiButtonCtrl, GuiRadioCtrl, and so on. However, we have added new controls for representing images that you should use instead of the old controls. More on this later

Differences

  • More Objective-C: The OS X rewrite has introduced a lot more Objective-C due to utilizing more Cocoa API. This was necessary to replace the Carbon code.
  • Editors vs API: The initial launch of Torque 2D MIT will not have any editors. It will be a pure API with example code for game play, assets, GUIs, and unit tests.
  • Persistence: The old serialization format is essentially gone. With the exception of GUI profiles, anything saved to file will be in TAML format. More on this later.
  • Sprite system: We have unified the sprite system. t2dStaticSprite and t2dAnimatedSprite have been combined into 'Sprite'. The class hierarchy is a bit more complicated that this description, but I can cover that more later.
  • Asset system: Plain and simple, there was not a managed asset system for the older 2D engines. We just had loose files and TorqueScript objects that pointed to them. Now, the new Asset system completely changes how you manage sprite images, animations, audio, level files, GUIs, and more.
  • Updated libraries: We have updated the OpenAL, ljpeg, and lpng libraries to the very latest version. We are also using the latest Box2D SDK.

New Features

  • Box2D physics
  • Simpler and flexible sprite objects
  • New GUI controls that use sprites
  • Composite sprites
  • Asset system
  • TexturePacker Support
  • Module system
  • TAML serialization format (like XAML and XML)
  • Batched rendering
  • Multiple collision shapes
  • Behavior connections
  • Built-in unit testing framework, cross platform

General Improvements

  • Improved rendering pipeline
  • Massive performance increase
  • Cocoa API
  • World query system (faster picking, by area or pick by collision shape)
  • More detailed debug metrics
  • Faster triggers
  • Scrollers can use image frames
  • Better image processing (all images are cells, no image modes, huge performance gain)
  • Stock color in TorqueScript (yay cornflower blue)!
  • GUIs can use assets, instead of loose file references for images
  • Widespread cleanup of the code itself
  • All TorqueScript organized into modules
  • Removed redundant prefixes, reorganized the entire file and project structure for the source

Deprecated Features

  • All editors: It's been covered before, but all of the previous TGB editors have been culled out. The majority of the code will not work with the new systems.
  • Datablocks as assets: No more t2dImageMapDatablock, t2dAnimationDatablock, and so on. This has been replaced by the superior asset system.
  • 3D shape rendering: This was a change made to iTorque 2D that has been carried over to the new T2D. This mainly affects old T2D users.
  • Level datablocks: iTorque 2D users needed to use level datablocks files for performance reasons. This is no longer necessary with the superior asset system which features faster loading, smart reference tracking, and automatic unloading.
  • Realtime resizing of objects with collision bounds: This is a limitation imposed by Box2D. Because objects have collision shapes and joints, you cannot dynamically resize sprites with collision shapes without first destroying the shape and joints and rebuilding them after resizing has finished.
  • World limits: Sprites no longer have a world limit property built in. You can easily implement this functionality using Box2D triggers
  • Linkpoints: The linkpoint system has been replaced by Box2D joints, which are more performant and contain more features.
  • TileLayer and TileMap: This entire system was rendered obsolete by the new composite sprite system. More details on this later.
  • Particle system: This is still somewhat up for debate. The old particle objects can still work, but we are changing the serialization. It is my hope we can replace the current system with something much simpler later on.
  • TextObject: The scene object that was used for rendering text has been nuked. It was a broken mess that will get a more suitable replacement

Next Up

As I said at the top of this blog, this was a very high level list of changes. I'm sure a few of you might be getting close to hitting the panic button at this point, especially if you are using tilemaps, particles, or many datablocks. Hold off on hitting that button until you are able to read my next few blogs. I'll start with a very detailed writeup on the new sprite system, which should be landing early next week. In the end, it will be worth it when you can make use of amazing improvements like this:


Our new asset system also allows us to quickly add support for other tools, like TexturePacker:


That's a total of 2,500 isometric tiles with 1,000 animated sprites, rendering in only two draw calls at frame rates in the hundreds. It was created using only 20 lines of TorqueScript code, written in about 15 minutes. Thanks for taking time to read this blog. More 2D goodness coming soon.

- Mich

#21
01/07/2013 (6:02 am)
There was no mention of any changes to the Network structure, is it safe to assume that the TorqueNet Lite is still being used?

I'm keenly interested in the way Sprites are being handled, especially since standard and animated sprites are now combined. Also this TAML format (just another extension of XML?). I've been holding off on some work to see what comes of this.

As far as editors go, while they make life generally easier on designers, it's not a necessity.

Looking forward to a lot of the new features.. Also, there was mention of a TGB release prior to the MIT release, how many of the new features will be in that vs. the MIT full release?

Keep up the good work!
#22
01/07/2013 (6:10 am)
@Doc308 - The networking code is basically the same at was for iTorque 2D. Limited functionality. TAML is a lot more like XAML, which is a bit more powerful than XML. Still, it is the same basic kind of format.

The TGB update, not to be confused with the new T2D MIT release, will not contain any new features. The updates to the legacy technology are purely compatibility fixes. The update will resolve problems with running TGB/iT2D games on newer OS X and iOS systems.
#23
01/07/2013 (6:28 am)
@George - We're going to have to contact Mr. Loew, since we just added TexturePacker support today: Link To Video Demo

This is the power of the asset system and the new T2D codebase. Support was added in a day, which also includes the exporter you can add directly to TexturePacker. This allows you to export a packed sprite sheet directly to the T2D ImageAsset format (TAML). We can do the same for PhysicsEditor and other tools as well.

These blogs barely scratch the surface of the features and capabilities of the new T2D.
#24
01/07/2013 (1:22 pm)
In case you have not seen it, Melv May has posted a new blog about his new project: Nucleus. Nucleus is a concept for a powerful code-editor that supports debugging of both the Torque 2D and Torque 3D MIT code-bases. It will be a cross-platform editor that will initially work on Windows and OSX platforms with a Linux release sometime later.

Please leave a comment on his blog to show your interest. This will be a must have for any future T2D and T3D developers.
#25
01/07/2013 (8:01 pm)
Great work, eagerly awaiting the release. Glad you guys are fixing all the weak spots and are giving the code base a much needed facelift. 2013 will be T2D's MIT milestone release!

ISO Tiling for making iPad/Droid apps is hot right now and this one feature alone is what I have been waiting for.
#26
01/07/2013 (8:56 pm)
+1 @ Mich. (as usual :P )
#27
01/08/2013 (1:39 am)
Looking good. Thanks for the update, can't wait to see a version and work out a migration route.
#28
01/10/2013 (2:58 pm)
Glad to hear Torque2D MIT will be freely available.
Well I guess... right ?

I'm not quite sure about relying exclusively on TorqueScript without any editors behind.
Torquescript is also too slow to operate and resolve contact solver in Box2D so you will probably have to rely heavily on C++ for this part of the engine.

In the end, if I need to write my own editors on this new engine it's like starting from ground zero.

Too bad for the particle system. I really think it was one of the strong point of Torque2D.
#29
01/10/2013 (3:05 pm)
Melv and I have decide to re-implement the old particle system temporarily. He is going to change the code so that effects serialize differently. I still think we can come up with a better particle system later, with more intuitive editors.

Anyway, just thought I'd pop in and break the good news on that.
#30
01/11/2013 (1:01 pm)
Quote:We're going to have to contact Mr. Loew, since we just added TexturePacker support today

Quote: As for TMX support, this is a great idea. I think we should support several asset formats we do not create, such as TMX, Sprite filers, TexturePacker, and more.


@Michael - brother you just made me smile!

If begging helps I'm not above it! Excellent! This also provides T2D more exposure, many folks in the world already know these tools and use them, which could allow folks to adapt even easier. Awesome work! Got me excited!
#31
01/16/2013 (9:40 am)
@Michael

News about new iTorque ???

And about Android compatibility ??

Thanks

Bye
#32
01/16/2013 (9:55 am)
@Andrea - I've finished porting platform improvements from the new T2D to the legacy iTorque 2D and Torque 2D 1.7.6. This includes the Cocoa changes (both engines) and fixes for iOS 6 and iPhone 5 (iT2D 1.5.1).

Once that update is released, there will be no further updates to the old Torque 2D and iTorque 2D. All further work will happen in the MIT repository.

Android, other platforms, and new features will all be treated the same. The community will drive the direction of the MIT project, with GG maintaining the stability and core of the master branch.
#33
01/17/2013 (8:33 am)
Quote:I've finished porting platform improvements from the new T2D to the legacy iTorque 2D and Torque 2D 1.7.6. This includes the Cocoa changes (both engines) and fixes for iOS 6 and iPhone 5 (iT2D 1.5.1).

Way to go Mich!
#34
01/17/2013 (8:52 am)
Thanks Eric =)

What we're doing right now is just running that work through QA and fixing major bugs that have cropped up as a result of the platform updates. After going back to the old codebase, I have to say a lot of you are in for a special treat when you jump over to T2D MIT. The difference between the two engines is unbelievable.
#35
01/17/2013 (9:12 am)
What kinda treat would that be?
#36
01/17/2013 (9:20 am)
@Andy - The new codebase is far cleaner, easier to traverse, much faster to work with, way simpler to work in, and overall magnitudes better than the legacy engines.
#37
01/17/2013 (10:48 am)
@Mich

Great work ;-)

I wait news about MIT ....and the first release.... and use it in my future projects !! ;-)
#38
01/17/2013 (7:10 pm)
Hey @Michael,

Just wanted to get some updates on how are things going, can't wait for the release :)

Aun.
#39
01/18/2013 (6:25 am)
@Aun - Things are going well. Currently, I'm debugging issues QA is finding with the legacy updates to T2D and iT2D. Melv has been continuing to work in the new MIT repository, cleaning things up and wrapping up a feature. In order to help everyone better learn the new MIT, we have created a "sandbox" for the engine. This is very similar to how Box2D and Ogre work. Check it out:


Melv will be posting a few more technical blogs, but you can always continue to ask questions here. We are really excited about the sandbox, since it allows us to test the engine, demonstrate features, and provide enough examples to allow someone to start making a game even though we do not have editors (yet).
#40
01/18/2013 (1:06 pm)
Sounds great, I'll have to start a new project soon so hopefully the MIT version will be release before that. Thanks!!