Game Development Community

Torsion Debugger Newb Quesiton

by Tyler Sigman · in Torsion · 07/27/2008 (12:11 am) · 24 replies

Hi, I have the demo of TGB and Torsion and am playing around with them.

In order to debug TorqueScript with Torsion, do I have to have TGB pro so I can make a debug .exe?

Or does some of the debugging (watches, breakpoints, etc.) work with the release build?

I'm a little fuzzy on what the debug build provides and/or how to properly hook Torsion up to debug.

Right now when I start Debug within Torsion, it says it's running but I can't actually see anything (Call Stack, watches, etc.).

Probably a dumb question, but I just want to know if I need to get TGB pro (and compile my own debug .exe) or not, or whether I'm just doing something else wrong.

Thanks for any tips!
Page «Previous 1 2
#1
07/27/2008 (8:21 am)
You need a debug exe to debug C++, all you need to debug scripts is Torsion. Are you having any issues with doing this right now? Are you at least getting your console output appearing in the output pane of Torsion? If so then its attached and debugging properly. You won't actually see anything in watch/callstack until you break (hit a breakpoint).
#2
07/27/2008 (9:41 am)
Hmmm, no I'm not getting the console output to appear.

If I do "Start Without Debugging" from within Torsion the game appears fine, but I'm getting no dice on debugging.

Any tips?
#3
07/27/2008 (10:29 am)
So then what happens why you do a regular "start" right now? Is it even running your game or just sitting there?
#4
07/27/2008 (10:40 am)
FYI,

If you look inside Torsion at, project > properties > hook code, you will see:
dbgSetParameters( #port#, "#password#", true );

Torsion puts that line at the top of main.cs when you run with debugging. That is how torsion "hooks" in. Note that it also removes that line when you stop debugging.
#5
07/27/2008 (11:28 am)
Ok:
when I do a normal debug start, nothing happens at all--no window pops up, no Output, etc. Torsion recognizes it's in the middle of debugging ('cause I have to stop it), but otherwise nothing is going on.

If I do a Start Without Debugging, the game loads normally.

Could this have something to do with which .exe or command line arguments I need to use?

BTW, I am using TGB 1.7.4.

Thanks for the help so far--I really like both products so far but gotta get the debug working!

EDIT:
I read all the previous posts about ensuring the Torsion base directory setting, but with the new folder structure I'm not sure that still applies?

I've tried putting the TGBGame.exe right in the game folder, tried pointing to it elsewhere, etc etc. So far all I can get is for the game to run normally without debugging but no action on debugging.
#6
07/27/2008 (2:38 pm)
Quote:I read all the previous posts about ensuring the Torsion base directory setting, but with the new folder structure I'm not sure that still applies?
It still applies. Check the "Project > Properties... -> Base Directory" and make sure its pointed to the folder where your game's main.cs is.
#7
07/27/2008 (3:33 pm)
Hi Tom. Loving Torsion so far, btw--just can't wait to get the debugger working. Then I'll purchase a copy for sure.

What I meant to say is that the old posts make reference to old "main.cs" file that was at the root of all the game subdirectories. (I think that "main.cs" is now in ...\TorqueGameBuilder-1.7.4\tgb\?).

I think I've tried what you indicated above and still no dice. Here's what I have:

game directory is:

...\TorqueGameBuilder-1.7.4\games\ReactorTest\ (I've just made a copy of the reactor demo for testing)

Torsion->Project->Properties...->Base Directory is set to that (...TorqueGameBuilder-1.7.4\games\ReactorTest\)

The .exe I'm pointing to is at:
...\TorqueGameBuilder-1.7.4\tgb\gameData\T2DProject\TGBGame.exe
currently I'm using no command line arguments.

When I Start Without Debugging, the game starts and operates fine. (although no output to the OUTPUT pane in Torsion)

When I do a normal Start I get no game window, no output, no ability to step, nothing. I have to tell it to Stop Debugging to get back to things, though. I get the hourglass cursor for a few seconds and then back to mouse cursor.

I've also tried copying the .exe to the ...\ReactorTest\ directory and pointing to it there and the same behavior occurs.

Just to be clear, I see at least 3 "main.cs" files I could point to:

1) the one in ...\TorqueGameBuilder-1.7.4\tgb\
2) the one in ...\TorqueGameBuilder-1.7.4\games\ReactorTest\
3) the one in ...\TorqueGameBuilder-1.7.4\games\ReactorTest\game\

Currently I'm pointing the Project Directory to #2.

I feel like I must be missing something...any tips? Thanks in advance.
#8
07/27/2008 (3:56 pm)
Quote:1) the one in ...\TorqueGameBuilder-1.7.4\tgb\
2) the one in ...\TorqueGameBuilder-1.7.4\games\ReactorTest\
3) the one in ...\TorqueGameBuilder-1.7.4\games\ReactorTest\game\
#2 is the correct main.cs.

Also are your literally typing in "...\TorqueGameBuilder-1.7.4\games\ReactorTest\" for the base directory? I suspect your mistakenly trying to outsmart Torsion to make the path it uses relative. Torsion already does this on its own and there is no need for you to do this yourself.
#9
07/27/2008 (4:30 pm)
Quote:
Also are your literally typing in "...\TorqueGameBuilder-1.7.4\games\ReactorTest\" for the base directory? I suspect your mistakenly trying to outsmart Torsion to make the path it uses relative. Torsion already does this on its own and there is no need for you to do this yourself.

No, i'm just using the browser window to select the path; not manually typing anything in. After I choose it in the browser it has the full path:
C:\Program Files\GarageGames\TorqueGameBuilder-1.7.4\games\ReactorTest\

So, I'm pointing to #2, but no dice...anything else?

Best,

--Tyler
#10
07/27/2008 (5:40 pm)
I haven't been able to install TGB 1.7.4 so i dont though this for sure, but one idea I had was perhaps dbgSetParameters was changed to dbgInit (since that was a change they had in one of the TGEA trunks).

Just throwing out an idea for ya Tyler / Tom...
#11
09/25/2008 (10:47 am)
Just to finish up this thread, I had the same issue as Tyler, and James' solution fixed it.

Just go to Torsion->Project->Properties... and change the Hook Code from:

dbgSetParameters( #port#, "#password#", true );

to:

dbgInit( #port#, "#password#", true );
#12
09/25/2008 (11:38 am)
TGB 1.7.4 uses dbgSetParameters - just for clarification. So I assume you are using a version of TGEA Chris?
#13
09/26/2008 (1:00 pm)
Nope, I just jumped the gun on the post. By changing it to dbgInit, the script call failed, and thus the program ran as normal (just as if false were passed as the third parameter to dbgSetParamaters). So I've changed it back to dbgSetParameters, but I still cannot get breakpoints to hit.

When I choose Debug -> Start in my Debug config, the windows console window pops up with the correct name of my executable as its title, but the app proper does not begin. My only options in the Debug menu are Restart, Stop, and Break. Breaking does nothing.

Maybe the debugger is having trouble connecting to the running program?
#14
09/26/2008 (1:28 pm)
Oh, and my Base Directory is set to the same one as my .exe's, top-level main.cs, and .torsion file.
#15
09/26/2008 (6:09 pm)
When you get that situation and terminate it, does opening the console.log show anything useful?
#16
09/29/2008 (9:12 am)
Nothing especially useful :(

//-------------------------- 9/29/2008 -- 09:03:47 -----
Compiling common/client/prefs.cs...
Compiling common/server/prefs.cs...
Compiling paddle/prefs.cs...
Compiling main.cs...

I've tried a bunch of other Torque projects and get the same effect with all of them, so I've thinking it might be a system/program configuration issue instead of a project one.
#17
09/29/2008 (11:04 am)
Is the main.cs being compiled there the one that contains:
if( !isFunction( "initializeProject" ) || !isFunction( "_initializeProject" ) )
{
   messageBox( "Game Startup Error", "'initializeProject' function could not be found." @
               "\nThis could indicate a bad or corrupt common directory for your game." @
               "\n\nThe Game will now shutdown because it cannot properly function", "Ok", "MIStop" );
   quit();
}

_initializeProject();

If, for example, you pointed tgb/torsion to the game/gameScripts/main.cs you might get a result like that in your log, because it just contains function's usually, and no code for actually starting up the game.

Just something I've noticed when starting from visual studio and it asks for your starting main.cs, I accidentally clicked on the wrong one and got basically the same result as you described.

One thing you can do to debug the startup, actually, is instead of clicking "start debugging" click "step". Then you will be able to step through the initialization scripts.
#18
09/29/2008 (12:15 pm)
If I change the Entry Script to be "paddle\main.cs" instead of the root main.cs (which has all the code for dispatching to the creator and whatnot) then I can get the game to run just as if I clicked "Start Without Debugging". However, breakpoints still do not trigger.

Unfortunately, clicking "Step" does not step into anything. It behaves exactly the same as "Start".

Another thing I noticed is that after pressing "Start", the connection dialog appears but immediately goes away. Is that normal?
#19
09/29/2008 (12:47 pm)
@Chirs - You should not be using a mod folder main.cs to launch your game. It may be working in your case... but its not how Torque was designed to run. In fact in future Torque versions there will only be one main.cs in the root... the other main.cs files will be renamed to avoid this confusion.
#20
09/29/2008 (12:52 pm)
"Another thing I noticed is that after pressing "Start", the connection dialog appears but immediately goes away. Is that normal?"

Yes, that means it connected.

Chris, you are using TGB 1.7.4, right? If your game is starting up, and you are using the main.cs that contains the call to _initializeProject, then that much should be right.

In 1.7.4 this seems to be fixed, but I noticed that in some cases you need to use the same filename capitalization when you exec a file as the file-itself has in order for breakpoints to hit.

Or it could be something else simple going on...
Page «Previous 1 2