Game Development Community

GuiObjectView crash after created server.

by Tuanlucky · in Torque Game Engine · 06/05/2006 (8:06 pm) · 2 replies

Hi,

Dont know it is a bug or not?
I create select character gui by guibobjectview and try to switch 2 shapes with animation.. after few times changing shape I received an error "TSThread::selectKeyFrame:: Invalid keyframe" at tsthread.cc line 85.

It only happens when I load the object view gui after calling command "map_createServer();" to create server. If I load the object gui in main menu gui or any gui before callling above command, the error won't happen.

#1
06/06/2006 (11:22 am)
Hi, when the assert occurs what are the calls in the stack trace? I'm trying to see when that code is called.

Also does it assert on all objects, or just specific objects? And does it always fail on the second time an object is loaded or randomly?
#2
06/06/2006 (10:47 pm)
The error occurs exactly when the same object reloaded at the third time. My character list has 3 races (Orc, alien, wizard). When the Orc displays again at third time, the above error will occurs.

Quite hard to trace where it break in engine because too many loops. It breaks at this line 1363 in winWindow.cc
if(event.elapsedTime > sgTimeManagerProcessInterval)
   {
      gTimer.advance();
      Game->postEvent(event); //[b]Error occur right after this[/b]
   }

continue deeper trace at Game->postEvent(event). I see an AssertFatal, at line 52 gameinterface.cc. The values of sReentrranCount =1
#ifdef TORQUE_DEBUG
   sReentrantCount++;
   AssertFatal(sReentrantCount == 1, "Error! ProcessEvent is NOT reentrant.");
#endif

and it exactly stop right this line 635 in main.cc
bool tickPass;
   PROFILE_START(ServerProcess);
   tickPass = serverProcess(timeDelta); //[b] the error occurs.[/b]
   PROFILE_END();
   PROFILE_START(ServerNetProcess);

Here my code:
CreateCharacter.cs (for CreateCharacter.gui)
function CreateCharacterGui::onWake(%this)
{
    CreateCharacterGui.ReloadPlayer();
    CreateCharacterGui.ClearSkillPoint();
}

//----------------------------------------
$CC_NumSkillPoint = 30;
$CC_BaseNumSkillPoint = 30;
$CC_BaseInitPoint = 2;
$CC_CurrentCharID = 0;
$CC_Point[STR] = 2;
$CC_Point[DEX] = 2;
$CC_Point[AGI] = 2;
$CC_Point[INT] = 2;
$CC_Point[CHA] = 2;
$CC_Point[LUK] = 2;
$CC_Element = 1;

function CreateCharacterGui::NextID()
{
   if ($CC_CurrentCharID >= $CR_MaxRace-1)
     $CC_CurrentCharID = 0;
     else
     $CC_CurrentCharID++;
     
     CreateCharacterGui.ReloadPlayer();
}

function CreateCharacterGui::PrevID()
{
   if ($CC_CurrentCharID > 0)
     $CC_CurrentCharID--;
     else
     $CC_CurrentCharID = $CR_MaxRace-1;
     CreateCharacterGui.ReloadPlayer();
}

function CreateCharacterGui::ReloadPlayer()
{
   //CharSelector.setEmpty();
   CharSelector.setObject("Selector", CR_GetShape($CC_CurrentCharID), 
      CR_GetSkin($CC_CurrentCharID), 0);
   CharSelector.loadDSQ("Selector", CR_GetSeq($CC_CurrentCharID));
   CharSelector.setSequence("Selector", CR_GetSeqName($CC_CurrentCharID), 1);
}

CreateCharacter.gui
new GuiObjectView(CharSelector) {
      Profile = "qhGuiDefaultProfile";
      HorizSizing = "right";
      VertSizing = "bottom";
      Position = "40 33";
      Extent = "270 422";
      MinExtent = "8 2";
      Visible = "1";
      applyFilterToChildren = "1";
      cameraZRot = "0";
      forceFOV = "0";
      lightDirection = "-0.57735 -0.57735 -0.57735";
      lightColor = "0.6 0.58 0.5 1";
      ambientColor = "0.3 0.3 0.3 1";
      emapAmount = "1";
   };
   new GuiBitmapButtonTextCtrl() {
      Profile = "qhGuiButtonProfile";
      HorizSizing = "right";
      VertSizing = "bottom";
      Position = "33 472";
      Extent = "77 23";
      MinExtent = "8 2";
      Visible = "1";
      Command = "CreateCharacterGui.PrevID();";
      text = $L_PREV;
      groupNum = "-1";
      buttonType = "PushButton";
      bitmap = "./qhui/button1";
   };
   new GuiBitmapButtonTextCtrl() {
      Profile = "qhGuiButtonProfile";
      HorizSizing = "right";
      VertSizing = "bottom";
      Position = "196 473";
      Extent = "77 23";
      MinExtent = "8 2";
      Visible = "1";
      Command = "CreateCharacterGui.NextID();";
      text = $L_NEXT;
      groupNum = "-1";
      buttonType = "PushButton";
      bitmap = "./qhui/button1";
   };

CharacterRace.cs contains list of characters.
//=================
$CR_MaxRace = 3;
//======ORC ===========
$CR_Race[0] = "Orc";
$CR_RaceInit[0,STR] = 10;
$CR_RaceInit[0,DEX] = 5;
$CR_RaceInit[0,AGI] = 5;
$CR_RaceInit[0,INT] = 0;
$CR_RaceInit[0,CHA] = 0;
$CR_RaceInit[0,LUK] = 10;
$CR_RaceInit[0,SHAPE] = "starter.fps/data/shapes/player/player.dts";
$CR_RaceInit[0,SKIN] = "starter.fps/data/shapes/player/player.png";
$CR_RaceInit[0,SEQ] = "starter.fps/data/shapes/player/player_forward.dsq";
$CR_RaceInit[0,SEQNAME] = "forward";
$CR_RaceInit[0,DATABLOCK] = "OrcBody";
$CR_RaceInit[0,DTS] = "OrcDts";

//====== ALIENT ===========
$CR_Race[1] = "Alien";
$CR_RaceInit[1,STR] = 5;
$CR_RaceInit[1,DEX] = 0;
$CR_RaceInit[1,AGI] = 10;
$CR_RaceInit[1,INT] = 10;
$CR_RaceInit[1,CHA] = 0;
$CR_RaceInit[1,LUK] = 5;
$CR_RaceInit[1,SHAPE] = "starter.fps/data/shapes/player/Glowy/glowy_player.dts";
$CR_RaceInit[1,SKIN] = "starter.fps/data/shapes/player/Glowy/player.png";
$CR_RaceInit[1,SEQ] = "starter.fps/data/shapes/player/player_forward.dsq";
$CR_RaceInit[1,SEQNAME] = "forward";
$CR_RaceInit[1,DATABLOCK] = "GlowyBody";
$CR_RaceInit[1,DTS] = "GlowyDts";

//====== Wizard ===========
$CR_Race[2] = "Wizard";
$CR_RaceInit[2,STR] = 5;
$CR_RaceInit[2,DEX] = 0;
$CR_RaceInit[2,AGI] = 10;
$CR_RaceInit[2,INT] = 10;
$CR_RaceInit[2,CHA] = 0;
$CR_RaceInit[2,LUK] = 5;
$CR_RaceInit[2,SHAPE] = "starter.fps/data/shapes/player/Wizard/player.dts";
$CR_RaceInit[2,SKIN] = "starter.fps/data/shapes/player/Wizard/ElfSorceress.jpg";
$CR_RaceInit[2,SEQ] = "starter.fps/data/shapes/player/Wizard/player_forward.dsq";
$CR_RaceInit[2,SEQNAME] = "forward";
$CR_RaceInit[2,DATABLOCK] = "ElfBody";
$CR_RaceInit[2,DTS] = "ElfDts";


//==================
	
function CR_GetDatablock(%id)
{
   if (%id>=0 && %id <$CR_MaxRace)
       return $CR_RaceInit[%id, DTS];
	return "";
}

function CR_GetNameByID(%id)
{
	if (%id>=0 && %id <$CR_MaxRace)
		return $CR_Race[%id];
	return "";
}

function CR_GetShape(%id)
{
   if (%id>=0 && %id <$CR_MaxRace)
    return $CR_RaceInit[%id, SHAPE];
   return "";
}

function CR_GetSkin(%id)
{
   if (%id>=0 && %id <$CR_MaxRace)
    return $CR_RaceInit[%id, SKIN];
   return "";
}

function CR_GetSeq(%id)
{
   if (%id>=0 && %id <$CR_MaxRace)
    return $CR_RaceInit[%id, SEQ];
   return "";
}

function CR_GetSeqName(%id)
{
   if (%id>=0 && %id <$CR_MaxRace)
    return $CR_RaceInit[%id, SEQNAME];
   return "";
}

function CR_getPlayerBody(%id)
{
   if (%id>=0 && %id <$CR_MaxRace)
     return $CR_RaceInit[%id, DATABLOCK];
   return "PlayerBody";
}

Mainmenugui.gui
[code]
//....
new GuiBitmapButtonTextCtrl() {
Profile = "qhGuiButtonProfile";
HorizSizing = "relative";
VertSizing = "relative";
Position = "19 31";
Extent = "89 25";
MinExtent = "8 8";
Visible = "1";
Command = "MainMenuGui.RunLocal();";
text = "Start";
groupNum = "-1";
buttonType = "PushButton";
bitmap = "./qhui/button1";
helpTag = "0";
};
//...
function MainMenuGui::RunLocal()
{
%mission = "starter.fps/data/missions/stronghold.mis";
%serverType = "MultiPlayer";

createServer(%serverType, %mission);

Canvas.setContent(CreateCharacterGui);
}