Turning off the TMK
by Daniel Buckmaster · in Torque Game Engine · 01/21/2008 (10:15 am) · 12 replies
In the interests of compatability with computers with older specs, I want to leave the MK out of my project. In the interest of my project's graphics, I want it in. The simply way is to have two projects, one with TMK rolled in and one without. However, that means it's rather an annoyance to make other engine changes, because you have to change everything twice.
If there a simple way, some define I can change, that stops the TMK from operating? Simply getting rid of the call to MKInit() resulted on a crash at startup (in tVector.h, for some reason...).
If there a simple way, some define I can change, that stops the TMK from operating? Simply getting rid of the call to MKInit() resulted on a crash at startup (in tVector.h, for some reason...).
About the author
Studying mechatronic engineering and computer science at the University of Sydney. Game development is probably my most time-consuming hobby!
#2
01/21/2008 (11:43 am)
It wasn't really designed to be turned on/off. Or rather it was, but that went out the window pretty early in development. I've heard from one team that simply #ifdef'd the whole thing in their codebase and that apparently worked well for them.
#3
I see why it's necessary to #ifdef the whole thing :P
I think I'm just going to copy my build and merge out all the TMK bits. I'll do all my main work in the TMKed engine build, then merge it all across to the non-TMK engine periodically.
01/21/2008 (11:59 am)
Heh, I'm trying to do that by #ifdefing main.cc, which is where the MK gets initialised from. Seems to work, except that th build fails with a link error: (I think) guiCanvas.obj uses Platform::onWindowCreated, but that function is not defined except with the TMK code changes. Oh, wait...I see why it's necessary to #ifdef the whole thing :P
I think I'm just going to copy my build and merge out all the TMK bits. I'll do all my main work in the TMKed engine build, then merge it all across to the non-TMK engine periodically.
#4
After that, I had the corresponding #define in TorqueConfig.h.
That's all and it works.
Nicolas Buquet
www.buquet-net.com/cv/
01/25/2008 (4:57 am)
I did it by #ifdef around all the modifications of TMK and by keeping the original code in the #else section.After that, I had the corresponding #define in TorqueConfig.h.
That's all and it works.
Nicolas Buquet
www.buquet-net.com/cv/
#5
I am not ready to upgrade to TGEA however I would like the benefits of having nicer effects for my engine.
Either way, I will be installing TMK into a fresh version of TGE1.5.2 and checking to see if its really what I want/need for upgrading my Custom TGE 1.5.2 Core.
@Daniel: Have you figured out the method they have mentioned or are you still going with the two project method?
08/24/2009 (12:24 am)
I'm not sure exactly how to accomplish the #ifdef method Alex and Nicolas is talking about, I'm guessing that #ifdef is a basic If/else statement based on a #define variable... however if someone could post the exact syntax for the if/else statement and how the #define is set I would be extremely grateful.I am not ready to upgrade to TGEA however I would like the benefits of having nicer effects for my engine.
Either way, I will be installing TMK into a fresh version of TGE1.5.2 and checking to see if its really what I want/need for upgrading my Custom TGE 1.5.2 Core.
@Daniel: Have you figured out the method they have mentioned or are you still going with the two project method?
#6
Well I did some testing of the TMK and Stock TGE1.5.2 and the most notable scene was where our very special friend KORK does his very special breakdance in the Demo inside of the GreatHall Interior where I was getting avg90fps w/Stock and avg30fps w/TMK...
Now while this is a very big differance in framerate the quality was well worth the drop in fps, however being able to turn off certain items at runtime (or even upon restarting) would make this resource completely worth every TGE 1.5.2 coder having.
I know this thread is old, However I completely feel it to be relevant now that TGE 1.5.2 can now be used by Current Modern PC's beyond its originally intended limits!
My main goal here is to be able to turn on/off some/all of the features that the TMK has so beautifully graced TGE with for the use of TGE on the low to non-shader computers and super-high powered monsters!
This is a call to all those still using TGE1.5.2 that want the quality of the TMK and the flexibilty/optimizations of Stock TGE!
08/24/2009 (2:10 am)
OK, just installed the TMK into a fresh copy of TGE and I have to say WOW... I cant believe I havnt checked this out before!!! Well I did some testing of the TMK and Stock TGE1.5.2 and the most notable scene was where our very special friend KORK does his very special breakdance in the Demo inside of the GreatHall Interior where I was getting avg90fps w/Stock and avg30fps w/TMK...
Now while this is a very big differance in framerate the quality was well worth the drop in fps, however being able to turn off certain items at runtime (or even upon restarting) would make this resource completely worth every TGE 1.5.2 coder having.
I know this thread is old, However I completely feel it to be relevant now that TGE 1.5.2 can now be used by Current Modern PC's beyond its originally intended limits!
My main goal here is to be able to turn on/off some/all of the features that the TMK has so beautifully graced TGE with for the use of TGE on the low to non-shader computers and super-high powered monsters!
This is a call to all those still using TGE1.5.2 that want the quality of the TMK and the flexibilty/optimizations of Stock TGE!
#7
#ifdef SOME_VARIABLE
...code here...
#else
...other code here...
#endif
You'd need to merge the MK by hand (or by WinMerge), but instead of replacing stock code with MK code, keep both bits in there, surrounding them in the #ifdef structure.
However, this #define must be defined (somewhere) in engine code before compiling - you can't change it after you've compiled it. So this route will give you the ability to compile two separate .exe files, one with the MK and one without.
Also make sure you search for Koushik's add-on code, which lets you use shaders on DTS files.
08/24/2009 (3:07 am)
I didn't eventually continue down that path - for now I'm working without shaders, and I'll probably upgrade to TGEA at some point in the future (start of next year-ish, I hope). #ifdef is, like you said, a kind of if/else statement that works based on a #define somewhere in the code. The basic syntax is:#ifdef SOME_VARIABLE
...code here...
#else
...other code here...
#endif
You'd need to merge the MK by hand (or by WinMerge), but instead of replacing stock code with MK code, keep both bits in there, surrounding them in the #ifdef structure.
However, this #define must be defined (somewhere) in engine code before compiling - you can't change it after you've compiled it. So this route will give you the ability to compile two separate .exe files, one with the MK and one without.
Also make sure you search for Koushik's add-on code, which lets you use shaders on DTS files.
#8
The #ifdef / #else / #endif is correctly described by Daniel.
For example, you can #define TMK.
Then:
And about Koushik add-on, it never worked correctly on my part : black and incomplete faces.
And I just added a patch I did on the TMK to avoid a crash when exiting my application with TMK activated. See here : www.garagegames.com/community/forums/viewthread/63991/17#comment-668207
Nicolas Buquet
www.buquet-net.com/cv/
08/24/2009 (6:07 am)
Hi,The #ifdef / #else / #endif is correctly described by Daniel.
For example, you can #define TMK.
Then:
#ifdef TMK // put here entire function modified by the TMK #else // put here entire unmodified original function #endif
And about Koushik add-on, it never worked correctly on my part : black and incomplete faces.
And I just added a patch I did on the TMK to avoid a crash when exiting my application with TMK activated. See here : www.garagegames.com/community/forums/viewthread/63991/17#comment-668207
Nicolas Buquet
www.buquet-net.com/cv/
#9
The two .exe method is not as bad as two seperate projects and is almost feasible, though I have to think that there is a way to pass a variable over to (possibly) a $pref:: that can be modified via the options menu for easy feature enable/disable. (even if a .exe restart is required)
I have tried "$pref::Water::Refract = "0";" in the console to disable water refraction and it seems that it did not work the way i expected it to. (nor did it work upon restarting...)
I appreciate your patience with me as I try and find out if what I'm trying is possible. :)
Again, I do not plan on a TGEA purchase anytime soon given the possibilities of the TMK and the optimizations of TGE in which again I will explain, (to those that are still using TGE and have not used the TMK yet, as I have just now personally used the TMK and I am astonished by the quality I have only now seen from TGE) having the pure compatibility of TGE with the quality of TMK can be a real selling point to any project that is trying to reach the Lower-End Chipsets along with the Quality to crunch even the High-End PC's.
08/24/2009 (12:15 pm)
OK, Thanks for the help with the "if defined" statement I'm still kind of inexperienced when it comes to c++. :)The two .exe method is not as bad as two seperate projects and is almost feasible, though I have to think that there is a way to pass a variable over to (possibly) a $pref:: that can be modified via the options menu for easy feature enable/disable. (even if a .exe restart is required)
I have tried "$pref::Water::Refract = "0";" in the console to disable water refraction and it seems that it did not work the way i expected it to. (nor did it work upon restarting...)
I appreciate your patience with me as I try and find out if what I'm trying is possible. :)
Again, I do not plan on a TGEA purchase anytime soon given the possibilities of the TMK and the optimizations of TGE in which again I will explain, (to those that are still using TGE and have not used the TMK yet, as I have just now personally used the TMK and I am astonished by the quality I have only now seen from TGE) having the pure compatibility of TGE with the quality of TMK can be a real selling point to any project that is trying to reach the Lower-End Chipsets along with the Quality to crunch even the High-End PC's.
#10
08/24/2009 (3:39 pm)
ok, for the time being I am trying the ifdef method for dual .exe's, I have merged all of the needed files and I have recieved 18 errors (technically 9), all from fluidRender.cc and consist of the following:..engineterrainfluidRender.cc(216) : error C2065: 'MKGFX' : undeclared identifier
..engineterrainfluidRender.cc(216) : error C2227: left of '->copyBackBufferToRefractionTexture' must point to class/struct/union/generic type
type is ''unknown-type''
#11
so far I've gotten the DRL and the Water(w/ minor fog issues) working, however I cannot seem to get it to load any map with Interiors...
@Daniel, I noticed you had a thread (the only) about TMK crashing on viewing Interiors, I was wondering what might have been causing the problem?
08/24/2009 (8:37 pm)
I have installed this into my custom TGE Core without the ifdef statments as I have run into the above problem... I also managed to get this into my Custom/MG Starter Kit script directories.so far I've gotten the DRL and the Water(w/ minor fog issues) working, however I cannot seem to get it to load any map with Interiors...
@Daniel, I noticed you had a thread (the only) about TMK crashing on viewing Interiors, I was wondering what might have been causing the problem?
#12
I agree that it should be easy as a $pref change, but from what Alex said (and it was he who wrote the TMK), it wasn't designed with that in mind, so there are probably good reasons why it can't happen.
08/24/2009 (8:45 pm)
It was an older video card which didn't support the functions TMK needs to render normal-mapped interiors.I agree that it should be easy as a $pref change, but from what Alex said (and it was he who wrote the TMK), it wasn't designed with that in mind, so there are probably good reasons why it can't happen.
Torque 3D Owner Marc Dreamora Schaerer
Gayasoft
Thats one of the reasons we currently took it out of our project again and are going to reintegrate it more "peacefully" so the regular rendering and the advanced work side aside.