Game Development Community

dev|Pro Game Development Curriculum

Torque X + DotScript = Torque Goodness

by Johnathon · 05/13/2009 (6:29 pm) · 3 comments

DotScript allows for Windows Applications to perform C# script compiling on the fly giving developers the ability to build a script system in their applications with compiling and execution of the scripts being handled by DotScript. Dynamic Method Invoking, property access, and support or C# or VB.NET syntax.

What does this have to do with Torque X? Well, TGE, TGEA, TGB all have the great Torque Script built into the engine that allows for quick and easy editing of objects within the game, without needing to re-compile the entire project in C++. Torque X Sadly is lacking a scripting language due to the fact that it was wrote in C# and can't use Torque Script.

Enter DotScript 4 Torque X. This was working in XNA about two years ago when I had a level editor I was working on. I'm currently in the process of implementing it into Torque X. I'm pretty sure that I can get it working without a problem on the PC side, but working it into the 360 is going to be tricky considering I don't own a 360 at the moment.

I have done research on MSDN and I know that it supports reflection and dynamic Type instancing with access to it's methods and other components. CodeDom is not supported on the 360's Compact Framework and so compiling of the scripts on the fly will not happen on the 360, but compiling the scripts for the 360 can be done prior to deploying it. However, on the PC side you can compile the scripts on the fly, allowing for users to easily add extensions or modifications to your games without needing to download C#.

Another plus is you as the developer can script your game, and not have to recompile the whole thing in C# each time you make a change. For simple games this will be a nice addition to the project, for more graphically intense games, some testing would need to be done before the development team decide to use it in their projects. Benchmarking of the scripting system hasn't really been done, and with it using Reflection to instance each script it is going to degrade performance somewhat. You won't see a major performance hit, as .NET does a good job with Reflecting things, and if you code it properly into your project, loading and instancing everything during the levels load time, so once in the game, everything is already loaded in memory, and the gameplay will have less of a performance hit as the methods are invoked. The Type has already been instanced and stored in memory. There's some optimizations that I will look into with the Torque version of DotScript, and it will need to be heavily modified from the original version to support the component architecture that Torque X uses.

As I can't really afford a mac for a good long time, I've decided to give this project more focus than my iPhone project using TGE. I'll post updates as work on this progresses.

#1
05/14/2009 (3:03 am)
I like the sound of the dotscript, specially if it can work on the 360. I current am working on a small 360 project (progressing slowly as I cant spend 9 hours programming at work then find the energy to do more at home :-) ) and would find it useful
#2
05/14/2009 (8:35 am)
This sounds really interesting, Jonathon. I don't think that real-time compilation on the Xbox 360 is critical. Even TorqueScript compiles .cs files into .dso files before the game is run. So pre-compiling before deploying to Xbox 360 is completely acceptable. Great project!

John K.
www.envygames.com
#3
05/14/2009 (4:24 pm)
Thanks, I've done some work on it and got it compiled and added into a Torque X 2D project, but my lack of Torque X knowledge is hendering me. I'm not sure how I should incorporate it into TX. I'm spending some time just learning Torque X and have had some difficulties finding good docs on it. I'm going to keep working on it. It's useable at the moment, but could be implemented better, and I'm hoping I can get the bulk of the work done prior to the demo expiring. I'll need to get some money saved between now and then >_<;