Is Torque a Threaded application?
by Steven Peterson · in Torque Game Engine · 09/20/2005 (6:51 am) · 4 replies
Is Torque a Threaded application? (Specifically TGE+LP1.3.5)
Reason I'm asking is i'm looking at an old resource (celestial.cc). It's supposed to be a singleton class, it's pretending to be a singleton class, but it's not a singleton class, so I want to fix it.
If Torque uses threads though I'll have to make it double-locking.
thanks,
Raven
ps. are there any other GOOD examples of a singleton class in Torque? I kind've haven't doen them in a while - had to pull the book out on this one...
Reason I'm asking is i'm looking at an old resource (celestial.cc). It's supposed to be a singleton class, it's pretending to be a singleton class, but it's not a singleton class, so I want to fix it.
If Torque uses threads though I'll have to make it double-locking.
thanks,
Raven
ps. are there any other GOOD examples of a singleton class in Torque? I kind've haven't doen them in a while - had to pull the book out on this one...
#2
09/21/2005 (4:25 am)
It's not very multithreaded, in that sense that most of what Torque does is linear by nature. But it is much friendlier to multithreaded programming in the engine.
#3
Ok, Thanks!
@Ben - I'm surprised, I would think all sorts of things could be separate threads but then I'm just the r00kie Programer... :'-(
Ok, *FOLLOW-UP QUESTION*
--------------------------------------
(reference - The Singleton Pattern)
http://www.informit.com/guides/content.asp?g=cplusplus&seqNum=148&rl=1
I'm still trying to make celestials a singleton class because I'm pretty sure we never want more than one of them. Depending on how it is now, I want to instantiate(sp?) the object with somthing like:
Celestials *gCelestials = Celestials::getCelestialsInstance();
or
celestials&c = (*(Celestials::getCelestialsINstance()));
As far as I can find the class is only called in the *.mis file as:
new Celestials(SunCycles) {
position = "0 0 0";
rotation = "1 0 0 0";
scale = "1 1 1";
...
...
};
So how can this be accomplished?
thanks,
Raven
09/23/2005 (5:27 pm)
@allOk, Thanks!
@Ben - I'm surprised, I would think all sorts of things could be separate threads but then I'm just the r00kie Programer... :'-(
Ok, *FOLLOW-UP QUESTION*
--------------------------------------
(reference - The Singleton Pattern)
http://www.informit.com/guides/content.asp?g=cplusplus&seqNum=148&rl=1
I'm still trying to make celestials a singleton class because I'm pretty sure we never want more than one of them. Depending on how it is now, I want to instantiate(sp?) the object with somthing like:
Celestials *gCelestials = Celestials::getCelestialsInstance();
or
celestials&c = (*(Celestials::getCelestialsINstance()));
As far as I can find the class is only called in the *.mis file as:
new Celestials(SunCycles) {
position = "0 0 0";
rotation = "1 0 0 0";
scale = "1 1 1";
...
...
};
So how can this be accomplished?
thanks,
Raven
#4
Anyway, I'm a little unclear on the importance of implementing a singleton here. But hey, if you want to - just kill the one in the mission and do it in C++ code! Maybe make it part of the SceneGraph?
09/23/2005 (9:29 pm)
Interestingly, Q3A had multithreaded rendering support (well, SMP support, actually). This sometimes gave an improvement... and sometimes gave a performance hit, even on SMP hardware. :-/Anyway, I'm a little unclear on the importance of implementing a singleton here. But hey, if you want to - just kill the one in the mission and do it in C++ code! Maybe make it part of the SceneGraph?
Associate Ron Yacketta
-Ron