RTS Prototype for Torque 3D 1.1 Final - reviewed
by Richard Ranft · in Torque 3D Professional · 09/16/2011 (12:46 pm) · 12 replies
I spent two hours this morning reviewing the RTS Prototype and posted a blog here. I hope you all find it helpful.
[EDIT] Below I posted what I think is a quick fix to the camera failing to honor orbit distance min and max in camera.setOrbitObject(). Testing as I type this....
[EDIT] Below I posted what I think is a quick fix to the camera failing to honor orbit distance min and max in camera.setOrbitObject(). Testing as I type this....
About the author
I was a soldier, then a computer technician, an electrician, a technical writer, game programmer, and now software test/tools developer. I've been a hobbyist programmer since the age of 13.
#2
and yes Blogs are public.
Family is being silly, they think dinner is more important than this.
what is wrong with people??
EDIT: just tested this with a quick build and no difference.
going to do a full rebuild and see if that works. will update here.
EDIT 2: this is for the starting at improper distance correct? your comment in the blog kind of implied different. the code I added to the blog was to keep the camera from moving too far in or out with the scroll wheel.
09/18/2011 (6:32 pm)
will try that in a bit and let you know. and yes Blogs are public.
Family is being silly, they think dinner is more important than this.
what is wrong with people??
EDIT: just tested this with a quick build and no difference.
going to do a full rebuild and see if that works. will update here.
EDIT 2: this is for the starting at improper distance correct? your comment in the blog kind of implied different. the code I added to the blog was to keep the camera from moving too far in or out with the scroll wheel.
#3
And something else I have done seems to cause problems with my camera modes - maybe Sahara - because now the camera stays in first person/third person modes only regardless of what mode I set with any of my projects except a fresh gen from the toolbox. Apparently I've managed to shoot myself in the foot somewhere along the way... lol.
Well, hopefully I can get this sorted out sometime this week. It looks like we're going to be very busy at the office, but I'll try to find time to get this settled to my satisfaction.
09/18/2011 (8:24 pm)
This was supposed to fix the distance thing on the engine side (the same fix you set up on script side) - but it isn't enforced anyway. I had to wait on a full compile as I posted that. Turned out it was premature. And something else I have done seems to cause problems with my camera modes - maybe Sahara - because now the camera stays in first person/third person modes only regardless of what mode I set with any of my projects except a fresh gen from the toolbox. Apparently I've managed to shoot myself in the foot somewhere along the way... lol.
Well, hopefully I can get this sorted out sometime this week. It looks like we're going to be very busy at the office, but I'll try to find time to get this settled to my satisfaction.
#4
I'm going to bed - perhaps it'll come to me in my sleep....
09/18/2011 (9:12 pm)
The only progress I've made so far is that if you open the world editor, switch to free camera, then leave the world editor the camera then behaves as expected. I'm doing a manual comparison of the camera code from Beta 3 with the 1.1 Final and so far the only thing I'm seeing is a change of a large part of the members from private to protected (not sure why) and the CameraMotionMode member used to be named mode, but is now named mMode.I'm going to bed - perhaps it'll come to me in my sleep....
#5
glad it's not just me.
09/18/2011 (10:40 pm)
ok well in a way I am glad to hear that. I am having a problem where it is setting the orbit but it is stuck on the ground. unless I go into editor and switch camera with alt-c and then switch it back. then it pulls the height from the other alt-c camera. but other wise seems fine. glad it's not just me.
#6
09/22/2011 (12:37 pm)
I plan to compile 1.1b3 on VS 2008 and VS 2010, and then do the same with 1.1F and see if there are any differences. I'm still digesting the camera code (5~10 minutes at a time - kinda busy) and so far it looks like very little has changed (nothing functional that I've found yet). I plan to try against both compilers in case it's Microsoft's bug (or a change to their handling of deprecated features).
#7
09/22/2011 (1:40 pm)
as you get time. I have been so busy that I have not gotten back to this yet. thanks for the update.
#8
The previous version was a little different:
And the cool thing? The current addToScene():
So, I'm thinking that somehow the camera object isn't correctly assigned a SceneManager object or that it needs to be added to one of the scene graphs and isn't, and that this is remedied in the function that loads or unloads the editor.
I could be way off. I'll be testing this in a few - wish me luck!
10/05/2011 (1:46 pm)
Ok, quick update - I'm looking at the onAdd() function in camera.cpp and it looks like the function has changed. It has removed a check to add to a client or server scene manager object and jumped right to the addToScene() function.bool Camera::onAdd()
{
if(!Parent::onAdd())
return false;
mObjBox.maxExtents = mObjScale;
mObjBox.minExtents = mObjScale;
mObjBox.minExtents.neg();
resetWorldBox();
addToScene();
return true;
}The previous version was a little different:
bool Camera::onAdd()
{
if(!Parent::onAdd())
return false;
mObjBox.maxExtents = mObjScale;
mObjBox.minExtents = mObjScale;
mObjBox.minExtents.neg();
resetWorldBox();
if( isClientObject() )
gClientSceneGraph->addObjectToScene( this );
else
gServerSceneGraph->addObjectToScene( this );
addToScene();
return true;
}And the cool thing? The current addToScene():
void SceneObject::addToScene()
{
if( mSceneManager )
return;
if( isClientObject() )
gClientSceneGraph->addObjectToScene( this );
else
gServerSceneGraph->addObjectToScene( this );
}So, I'm thinking that somehow the camera object isn't correctly assigned a SceneManager object or that it needs to be added to one of the scene graphs and isn't, and that this is remedied in the function that loads or unloads the editor.
I could be way off. I'll be testing this in a few - wish me luck!
#9
A fresh compile has no problems. Anyone having this camera issue, please try downloading a fresh copy of the SDK and compile from that, then test this resource out. I'll try it myself tonight when I get home.
I tried this with my modification first, then commented it out and tried it to verify. In both cases it worked perfectly.
10/05/2011 (1:59 pm)
Ok, that's not it. And?A fresh compile has no problems. Anyone having this camera issue, please try downloading a fresh copy of the SDK and compile from that, then test this resource out. I'll try it myself tonight when I get home.
I tried this with my modification first, then commented it out and tried it to verify. In both cases it worked perfectly.
#10
And I'm tinkering with a more elegant solution to swapping camera modes that will gracefully calculate an appropriate orbit position.
10/18/2011 (9:55 pm)
I fixed this script-side, so I posted it on the blog - if anyone is looking for it.And I'm tinkering with a more elegant solution to swapping camera modes that will gracefully calculate an appropriate orbit position.
#11
10/19/2011 (3:03 pm)
Darn - didn't work on the copy at the office....
#12
I also discovered that when I cleared everything except the bounds and shapefile definitions from the BoomBot datablock I stopped spawning in first person belly button view. Still not sure why.
The work on the RTS Prototype had me thinking about cameras and a question on the forum lead me to create a new "prototype" that is an extension of this one - the Adventure Prototype! So, as soon as QA gets done with checking out my bug-ridden scripts and makes me fix them we'll be posting both of these.
For anyone who's interested, I shot a video of the Adventure Prototype finished product and put it on YouTube. Hope it whets the appetite for the new article!
12/22/2011 (2:56 pm)
Update here - I've been working on getting the RTS Prototype up and running again with Torque 3D 1.2. Steve Acaster had some very good stuff in his Tactics-Action Hybrid Game Tutorial and thanks to him I was able to save a ton of time.I also discovered that when I cleared everything except the bounds and shapefile definitions from the BoomBot datablock I stopped spawning in first person belly button view. Still not sure why.
The work on the RTS Prototype had me thinking about cameras and a question on the forum lead me to create a new "prototype" that is an extension of this one - the Adventure Prototype! So, as soon as QA gets done with checking out my bug-ridden scripts and makes me fix them we'll be posting both of these.
For anyone who's interested, I shot a video of the Adventure Prototype finished product and put it on YouTube. Hope it whets the appetite for the new article!
Torque Owner Richard Ranft
Roostertail Games
In Engine/T3D/camera.cpp at about line 1720 add:
before
object->setOrbitMode(orbitObject, Point3F(0.0f, 0.0f, 0.0f), rotation, offset, minDistance, maxDistance, initDistance, ownClientObject, locked);and see if that doesn't fix it.Posted here because I think blogs are public.
[EDIT] This doesn't fix it. I don't know why not though.