Game Development Community

1.4 Status/Problem solving Thread.

by Ben Garney · in Torque Game Engine · 09/14/2005 (10:18 am) · 148 replies

Hey guys,

I'm kicking off this thread to clear up the posts a bit on my .plan, as a lot of the stuff there is for private forums only. If you have outstanding 1.4 issues, I'd much appreciate you reposting it here (if I haven't given you a tracking number for the issue, which I usually do by saying "Ah, that's a bug. #324" or something of that nature)..

Just trying to get things a little bit better organized. :)

Thanks,
Ben
#61
10/06/2005 (2:25 pm)
@Steven:

I would be really interested to know how you got VS 2005 Beta 2 compiling with Torque 1.4. Even with the Microsoft Platform SDK installed I get a slew of errors in winnt.h (specifically relating to a typedef of a 64 bit pointer), and unicode errors (can't convert from UTF16 to LPCWSTR), etc.

I caught that 'i' too, and yes - it seems like it should be changed.

- Eric
#62
10/06/2005 (3:26 pm)
@eric:

In your project options/C++/Language/Treat whar_t as built in type -> set it to NO

~neo
#63
10/06/2005 (7:29 pm)
@Neo: That certainly helped thank you.

And as a last desperate attempt to try and not to hijack this thread. Anyone else having problems with VC++ 8.0 Express Beta 2 / Microsoft Platform SDK ? It seems like a lot of my header files are pretty worthless. I keep on finding bugs with my headers - and I'm wondering if it's because of something else that I seem to be missing that's fundamental to something as simple as type definitions.
For example : PFLS_CALLBACK_FUNCTION is undefined in winbase.h . And indeed the compiler is right - nowhere else is it defined. So what's the deal? Something I'm missing?

Thanks again for your help,

- Eric
#64
10/06/2005 (8:07 pm)
@Eric and whoever else will find this useful.

Here is a link to my unapproved resource that I did this under.

www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=8853

Note this is for VS2005, not VC++ 8.0 Express, so it may or may not work. let me know
#65
10/06/2005 (8:31 pm)
Steven I think you meant to say
Quote:Error is here, because the variable i is now out of scope
#66
10/06/2005 (9:03 pm)
Yep thanks.
#67
10/06/2005 (9:16 pm)
@Tim Hutcheson: WOW THANKS! THOSE FIXES HELPED MUCHO! THE AI VEHICLE DRIVES RIGHT NOW!
#68
10/07/2005 (4:35 am)
@Chris: If you want a little bit better tracking you can add a simple gain control to reduce the amount of negative feedback coming from the wheels, like this ( where K1 is about 0.3f):

case Left:
         steer = (myAngle< maxSteeringAngle) ? -myAngle - [b]K1[/b]*steering.x: -maxSteeringAngle - K1*steering.x;
         mLastSteered = steer;
         break;
      case Right:
         steer = (myAngle < maxSteeringAngle) ? myAngle - [b]K1[/b]*steering.x: maxSteeringAngle - K1*steering.x;
         mLastSteered = steer;
         break;

Without that the bot can seem to scrape along the walls without moving to the center of the hallway, for example. But this depends a lot on vehicle datablock setup and the steering geometry, so it may not matter much to you.
#69
10/07/2005 (6:04 am)
* bs.png for the tree control is missing from common\ui.
* Alt-Enter to go full screen still doesn't work in starter.fps. Bad texture in resurrect().
#70
10/07/2005 (7:53 am)
@Chris: I just posted a resource that you can peek at, as yet unapproved, that you might like. It gives you a graphical view of the steering triangle while driving. And it fixes some numerical errors that might have only been generated because of the original problem that I fixed. But I left it in as it is good practice to check those denominators.

www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=8883

For best effect, commented out the line that says

glDisable(GL_DEPTH_TEST);
#71
10/07/2005 (7:55 am)
I think resource approval has been put on hold while IGC is going on, so we will see a ton or resources come through all at once. That should be interesting.
#72
10/07/2005 (8:01 am)
All,

I have updated the make files, fixed the lib dir and added ogg/vorbis to the xiph directories. Several other minor (capitalization, misspeled class names etc.) were also checked into SVN late on 10/4/05. Once I get the UNICODE cruft working for x86UNIXFont I'll be checking that in as well, which should (in theory) make the linux platform functional for 1.4RC2

Hopefuly I'll have something working to show at IGC which openes its doors at noon today (currently 8:01 AM PST)

-Ron
#73
10/07/2005 (9:14 am)
@Tim, thanks man, this stuff should help alot!
#74
10/08/2005 (1:45 pm)
Fixed one more bug in the original getSteeringAngle and fixed up some of my render code so that the world transform is done in getSteeringAngle, not renderImage.

void AIWheeledVehicle::renderImage(SceneState *state, SceneRenderImage *image)
{
	Parent::renderImage(state, image);

   mDataBlock->gShowSteeringConstructs = true;
   if (mDataBlock->gShowSteeringConstructs) 
   {
      glDisable(GL_LIGHTING);
      glPushMatrix();
      dglMultMatrix(&getRenderTransform());

      Point3F center = mDataBlock->center;
      Point3F front = mDataBlock->front;
      Point3F desired = mDataBlock->desired;
      int steerState = mDataBlock->steerState;

      F32 s = 0.05f;
      glBegin(GL_LINES);
      glColor3f(1, 0, 0);
      glVertex3f(front.x, front.y, front.z);
      glVertex3f(desired.x, desired.y, desired.z);
      glEnd();
      wireCube(Point3F(s,s,s),front);

      glBegin(GL_LINES);
      glColor3f(0, 1, 0);
      glVertex3f(desired.x, desired.y, desired.z);
      glVertex3f(center.x, center.y, center.z);
      glEnd();
      wireCube(Point3F(s,s,s),desired);

      glBegin(GL_LINES);
      glColor3f(0, 0, 1);
      glVertex3f(center.x, center.y, center.z);
      glVertex3f(front.x, front.y, front.z);
      glEnd();
      if( steerState == 2) 
         glColor3f(0, 1, 0);
      wireCube(Point3F(s,s,s),center);

      glPopMatrix();
      glEnable(GL_LIGHTING);
   }
}



F32 AIWheeledVehicle::getSteeringAngle()
{
   F32 K1 = -0.3f; 
   F32 K2 = 0.75f;

   Point3F desired = mMoveDestination;
   MatrixF mat = getTransform();
   Box3F box = getObjBox();	   
   Point3F center;
   box.getCenter(&center);

   Point3F front = center;
   front.y = box.max.y; // should be true for all these objects


   getWorldBox().getCenter(&center);
   front = center+front;


   EulerF rot;
   rot = extractEuler(mat);
   MatrixF transform(rot);
   Point3F wFront;   

   Point3F offset(0.0,box.max.y,0.0);
   transform.mulV(offset, &wFront);
   front = wFront + center;
   center = center + K2*wFront;
   
   objFront = front;
   mDataBlock->center = center;
   mDataBlock->front = front;
   mDataBlock->desired = desired;

   MatrixF wt = this->getWorldTransform();
   wt.mulP(mDataBlock->center);
   wt.mulP(mDataBlock->desired);
   wt.mulP(mDataBlock->front);

   Point3F A = desired - center;    // ltoc
   Point3F B = front - center;      // ftoc
   Point3F C = front - desired;     // ftol
   F32 a2 = A.x*A.x + A.y*A.y;
   F32 b2 = B.x*B.x + B.y*B.y;
   F32 c2 = C.x*C.x + C.y*C.y;
   F32 a = mSqrt(a2);
   F32 b = mSqrt(b2);
   F32 c = mSqrt(c2);

   F32 acosarg = 0.0f;
   F32 myAngle;
   if( a*b == 0.0f ) {
      if( a2 + b2 - c2 >= 0.0f )
         myAngle = M_PI/2.0f;
      else myAngle = -M_PI/2.0f;
   }
   else {
      acosarg = (a2 + b2 - c2)/(2*a*b);
      if(acosarg > .99999f) myAngle = 0.0f;
      else if(acosarg < -.99999) myAngle = M_PI;
      else myAngle = acos(acosarg);
   }


   Point3F location = getPosition();

   F32 xDiff = desired.x - location.x;
   F32 yDiff = desired.y - location.y;
   F32 finalYaw = myAngle/RADIANS;

	VehicleData *vd = (VehicleData*) getDataBlock();
	F32 maxSteeringAngle = vd->maxSteeringAngle;
   
   Point3F rotData = objFront - desired;
   MatrixF leftM(-rot);
   Point3F leftP;
   leftM.mulP(rotData, &leftP);
   leftP = leftP + desired;

   Point2F steering = mSteering;

   F32 steer;
   if(leftP.x < desired.x) {
      steerState = Right;
      steer = (myAngle < maxSteeringAngle) ? 
         myAngle + K1*steering.x : maxSteeringAngle + K1*steering.x;
   }
   else {
      steerState = Left;
      steer = (myAngle < maxSteeringAngle) ? 
         -myAngle + K1*steering.x : -maxSteeringAngle + K1*steering.x;
   }
   mDataBlock->myAngle = myAngle;
   mDataBlock->steer = steer;
   mDataBlock->steerState = (int)steerState;
   return steer;  // in radians.
}
#75
10/08/2005 (1:50 pm)
Comments for the above which I trimmed so the code fit in the limit:

void AIWheeledVehicle::renderImage(SceneState *state, SceneRenderImage *image)
{

// This tool provides a graphical diagnostic of the state of the
// steering algorithm for the AIWheeledVehicle. It consists of
// three colored cubes connected by the steering triangle.
// The red cube is placed at the front of the vehicle, the blue
// cube is at the "center" point (where the cosine is taken) and
// the red cube is at the vehicle destination. The "center" cube
// switches color when the steeringState changes: blue for left
// and green for right. Running the vehicle around a path, observe
// the behaior and tune the loop gain (K1) and the triangle (K2)
// for your bot.
}

F32 AIWheeledVehicle::getSteeringAngle()
{
// K1 is the negative feedback or damping factor from the wheels.
// The magnitude should not be too large as it will introduce
// steady state errors or too small as it will make the closed loop
// unstable (wheel waggle). But it depends on the mass of the vehicle
// springs and steering geometry, so best results are had by tuning using
// the tools in the renderImage method.
F32 K1 = -0.3f;

// K2 determines the length of the line from center to front of the
// steering triangle and affects the steering of the vehicle somewhat
// in close corners, so it is adjustable.
F32 K2 = 0.75f;
}
#76
10/09/2005 (10:34 pm)
Issues I have encountered with 1.4rc2:
I compiled using included the vc6 Project solution, fixing vorbis path errors (mentioned above) and commented out the following in torqueConfig.h:
//#define TORQUE_UNICODE
Which allowed me to compile bypassing the linking errors regarding imm32.dll. (I can't even locate that file, so fixing the link path is a no-go)

In the Mission Editor- Terrain Texture Painter:
When clicking add or change buttons below the 6 texture thumbnails, the presented open file screen does not list any files. Thus selecting a texture doesn't work =/

tutorial.base, starter.racing both load up fine.

starter.fps complains as follows:
Warning: (c:\torque\sdk\engine\gui\core\guitypes.cc @ 347) GuiControlProfile: requested gui profile (GuiDialogProfile) does not exist.
#77
10/10/2005 (5:20 am)
@Tom: I ran into the same problem. The VC 6 project did not have some new files added to it so some GUI controls are not compiled into your torque executable and they throw errors when the script tries to run. Try comparing the list of files included in the VC 6 project with those in the VC 7 ones.
#78
10/10/2005 (5:35 am)
My problem with 1.4 RC2 is apparently an insoluble one at this point.

We have a linkage in our code from the TGE to a mySQL database via ODBC. While the mySQL database can handle Unicode in its file systems the current ODBC driver (myODBC) to link from the game to the database does not handle Unicode.

This blocks us from using RC2 unless we go through and carefully back out all use of the I18N Unicode additions.

Is anyone aware of an ODBC driver - even in development - which can handle the linkage from the engine to the database, that we can actually get our hands on? My last look on the myODBC site suggested they have one in development but it is not available yet even on a beta basis.
#79
10/12/2005 (4:39 pm)
I am now using VC7.1 and it compiles perfectly (just like Ben promised) however I seem to have found a segfault.

Opening up stronghold in starter.fps and switching to the world creator mode, If you add a static shape (I have tried lantern, tree2 and healthpatch.) and then try to delete it immediately, torque crashes. I was able to reproduce the behavior for the three static shapes I just mentioned.

However, as soon as I relit and saved the mission. I was able to create and delete shapes without any segfaults at all. Since I still know very little about the engine, I'm guessing the problem lies with the new editor code when an object is added to a mission but before it is saved to the file.

Just for kicks, I tried the same procedure in 1.3release and it did not crash as 1.4rc2 did.
#80
10/18/2005 (1:13 pm)
The about dialog says "Torque 1.2 Demo" (aboutDlg.gui)