Game Development Community

Attempting to get invalid GFX device

by Kirk Longendyke · in Torque Game Engine Advanced · 01/26/2008 (7:07 am) · 4 replies

Reproduction Methodology:
Create dif.
Create dts.
Embed dts in dif via constructor.
run executeable in _dedicated_ mode. after having placed the dif in the .mis

fatal fault lies in:

bool Interior::read(Stream& stream)
{
...
      for (i = 0; i < mStaticMeshes.size(); i++)
      {
         mStaticMeshes[i] = new ConstructorSimpleMesh;
         mStaticMeshes[i]->read(stream);
      }
}
bool ConstructorSimpleMesh::read(Stream& stream)
{
...
   buildBuffers();
...
}
// set up the vb and fill all at once
   vertBuff.set(GFX, packedverts.size(), GFXBufferTypeStatic);
and of course crashes hard at
AssertFatal( smActiveDeviceIndex > -1 && smGFXDevice[smActiveDeviceIndex] != NULL, "Attempting to get invalid GFX device." );

now since theres no reason on earth to go running a gfx device on a dedicated server...

#1
01/26/2008 (7:53 am)
Well, as expected, this one turned out to be a fairly hacky fix (see atlas for crossrefference):

buildBuffers();
to
// BJGTODO - fix this hack!
   bool dedicated = Con::getBoolVariable("$Server::Dedicated");
   if( !dedicated )
   {
       buildBuffers();
   }
#2
01/26/2008 (9:08 am)
Same issue as with VolLight and some other classes that break when you run a dedicated server.
I went with the same hack, works well.
#3
01/26/2008 (9:59 am)
The next TGE-A release includes a NULL GFX device, which should take care of many of these, if not all.
#4
01/26/2008 (4:37 pm)
Awesome!!