Game Development Community

TorqueX 2D 3.1 doesn't work

by Ray Gebhardt · in Torque X 2D · 09/17/2009 (8:14 pm) · 2 replies

Basically if I create a new project in Visual Studio for TorqueX 2D 3.1, I get the following error message:

http://img2.imageshack.us/img2/9976/torquex2derror.png

I didn't change anything, I just tried to build and run it. Why would this occur? Does TorqueX 2D work at all if you don't make changes? Going by what i read on the TDN, I should be able to just build and run it out of the box, without any changes.

#1
09/17/2009 (9:09 pm)
I did something similar to the following:
protected override void BeginRun()
{
base.BeginRun();
SceneLoader.OnSceneLoaded = this.OnSceneLoaded;
// load our scene objects from XML. Torque X is designed to load game data from XML, but this is not strictly required;
// anything in an XML file can also be created manually in C# code. The SceneLoader is provided by TorqueGame and can be
// used to load and unload XML files.
SceneLoader.Load(@"data\levels\levelData.txscene");
}

public void OnSceneLoaded(string sceneFile, TorqueSceneData scene)
{
Console.ReadLine();
}

And when I debug where it says "Console.ReadLine();" the scene objects doesn't contain any objects.
#2
09/17/2009 (11:59 pm)
I fixed it. Basically the name of the assemblies were changed from GarageGames.TorqueX.Framework2D.dll and GarageGames.TorqueX.Framework3D.dll to Torque2D.dll and Torque3D.dll. I did the following to add the proper registered assemblies in the TorqueCore project:

GameUtil/TorqueGame.cs - Line 140
//create the scene renderer
if (System.IO.File.Exists(_engineComponent.ExecutableDirectory + "\Torque2D.dll"))
{
    //load the 2D assembly
    assembly2D = System.Reflection.Assembly.LoadFrom(_engineComponent.ExecutableDirectory + "\Torque2D.dll");
    _engineComponent.RegisterAssembly(assembly2D);
}


//create the scene renderer
if (System.IO.File.Exists(_engineComponent.ExecutableDirectory + "\Torque3D.dll"))
{
    //load the 2D assembly
    assembly3D = System.Reflection.Assembly.LoadFrom(_engineComponent.ExecutableDirectory + "\Torque3D.dll");
    _engineComponent.RegisterAssembly(assembly3D);
}

Core/Xml/TorqueSceneData.cs - Line 109:
//find the 2D objects
if (System.IO.File.Exists(TorqueEngineComponent.Instance.ExecutableDirectory + "\Torque2D.dll"))
{
    System.Reflection.Assembly asm = Assembly.LoadFrom(TorqueEngineComponent.Instance.ExecutableDirectory + "\Torque2D.dll");
    Type typeObject;

Core/Xml/TorqueSceneData.cs - Line 149
//find the 3D objects
if (System.IO.File.Exists(TorqueEngineComponent.Instance.ExecutableDirectory + "\Torque3D.dll"))
{
    System.Reflection.Assembly asm = Assembly.LoadFrom(TorqueEngineComponent.Instance.ExecutableDirectory + "\Torque3D.dll");
    Type typeObject;

The TorqueCore project in Torque X 3D has the same issue. The TankBuster demo doesn't seem to have this issue, because it looks like it's using an older version for TorqueCore. Not to sound rude, but do you test new releases after packaging them up? It took me a couple hours to figure this out. I assume there isn't anything to change for the TorqueCore assembly right?