Debugging engine code
by Hahn Bak · in Technical Issues · 07/07/2007 (10:59 am) · 5 replies
<-- CS major who just picked up TGE and knows no C++
Lets say that I try to instantiate an object through a script, and the console gives me an error: "Unable to instantiate non-conobject class _______"
the C++ code compiled just fine. Are there any engine-level debugging logs or tools that I could use to track the source of this problem down in the C++ code? Perhaps a call stack?
thank you very much in advance for your time
Lets say that I try to instantiate an object through a script, and the console gives me an error: "Unable to instantiate non-conobject class _______"
the C++ code compiled just fine. Are there any engine-level debugging logs or tools that I could use to track the source of this problem down in the C++ code? Perhaps a call stack?
thank you very much in advance for your time
#2
Using Visual Studio, how would one use the debug tools to step through a run of starter.fps? I do understand that starter.fps is scripts and not c++.
07/07/2007 (11:54 am)
Response very much appreciated.Using Visual Studio, how would one use the debug tools to step through a run of starter.fps? I do understand that starter.fps is scripts and not c++.
#3
I want to follow the c++ engine logic as starter.fps runs, step by step.
thanks :)
07/07/2007 (12:02 pm)
Maybe i should elaborate -- I'm not trying to step through the scripts of starter.fps using VS. That makes no sense.I want to follow the c++ engine logic as starter.fps runs, step by step.
thanks :)
#4
gameDemo.cc is the starting point, it contains the static main function that is executed when you run the EXE -- it then instantiates all the C++ Objects it needs, allocates all the resources, and begins to process your specific game scripts and continue to allocate resources ...
If you follow all the code in gameDemo.cc down, you'll get a really good understanding on how the engine processes things -- keep in mind though, some of the engine functions are threaded ... so execution is not necessarily 100% linear ... but you can start in gameDemo.cc and follow all the thread creations.
One note though, gameDemo.cc is fairly simplistic in nature, all the guts of the engine and what not are more or less hidden from view as gameDemo.cc just instantiates objects and calls methods, and then runs a while(1) loop that performs your basic "game loop" operations.
If you place a break point in visual studio at the top of the main() function, you can then step through it line by line and even follow specific thread instances along (nice feature VS has is the ability to lock onto a thread and debug it)
Good luck.
07/07/2007 (1:12 pm)
Hahn, the game starts in game/gameDemo.cc in the 'main' function ... from there, you can follow it all the way down to the end ... gameDemo.cc is the starting point, it contains the static main function that is executed when you run the EXE -- it then instantiates all the C++ Objects it needs, allocates all the resources, and begins to process your specific game scripts and continue to allocate resources ...
If you follow all the code in gameDemo.cc down, you'll get a really good understanding on how the engine processes things -- keep in mind though, some of the engine functions are threaded ... so execution is not necessarily 100% linear ... but you can start in gameDemo.cc and follow all the thread creations.
One note though, gameDemo.cc is fairly simplistic in nature, all the guts of the engine and what not are more or less hidden from view as gameDemo.cc just instantiates objects and calls methods, and then runs a while(1) loop that performs your basic "game loop" operations.
If you place a break point in visual studio at the top of the main() function, you can then step through it line by line and even follow specific thread instances along (nice feature VS has is the ability to lock onto a thread and debug it)
Good luck.
#5
07/08/2007 (8:47 pm)
I have a problem where a Debug run won't load any mods where a Release run will. I'm now getting so deep in the code debugging this that my head is spinning. I think i can handle it though. Thanks for helping me get set up, now i can figure out like... anything!
Torque 3D Owner Stephen Zepp
The specific error you see indicates that you are trying to instantiate a class that is not marked as able to be instantiated from script. If it's a standard game class that's part of the engine already, then check for typos in the class name in the instantiation script, and if it's something you added to the project, make sure that you are properly using the DECLARE_XXX() and IMPLEMENT_XXX() macros properly within the new class, as well as confirming you added the new class to the project itself.