Game Development Community

PlayerData Inheritence issues - NOT A BUG

by John "Mythic" Henry · in Torque 3D Professional · 10/05/2011 (2:41 am) · 7 replies

While getting some work done on weapons, I decided to clear out an error message in me logs..
I don't like errors. Now it looks like I found an Inheritence issue with the PlayerData.

Modified T3D 1.1
GMK Kit
Mack/Fack Kit
My own Modifications...

Heres the message:
Executing art/datablocks/player.cs.
Loading SFX: art/sound/character/orc_death (1 channels, 22 kHz, 0.57 sec, 24 kb)
Loading SFX: art/sound/character/orc_pain (1 channels, 22 kHz, 0.88 sec, 38 kb)
Loading SFX: art/sound/character/footstep_light (1 channels, 44 kHz, 0.66 sec, 56 kb)
Loading SFX: art/sound/character/footstep_heavy (1 channels, 44 kHz, 0.66 sec, 56 kb)
Loading SFX: art/sound/character/footstep_metal (1 channels, 44 kHz, 0.66 sec, 56 kb)
Loading SFX: art/sound/character/footstep_snow (1 channels, 44 kHz, 0.34 sec, 29 kb)
Loading SFX: art/sound/character/footstep_water2 (1 channels, 44 kHz, 0.72 sec, 62 kb)
Loading SFX: art/sound/character/footstep_water (1 channels, 22 kHz, 0.28 sec, 12 kb)
Loading SFX: art/sound/character/footstep_water (1 channels, 22 kHz, 0.28 sec, 12 kb)
Executing art/shapes/actors/characters/advanced.cs.
Executing art/shapes/actors/characters/advanced_female.cs.
Executing art/datablocks/aiPlayer.cs.
Executing art/datablocks/torqueOrcBot.cs.
Loading SFX: art/sound/character/spaceOrc_death (1 channels, 44 kHz, 1.05 sec, 90 kb)
Loading SFX: art/sound/character/spaceOrc_pain_01 (1 channels, 44 kHz, 0.74 sec, 63 kb)
Loading SFX: art/sound/character/spaceOrc_pain_02 (1 channels, 44 kHz, 1.22 sec, 104 kb)

86: Unable to find parent object TorqueOrcBotData for PlayerData.

Executing art/datablocks/vehicles/vehicleParts.cs.

Now this all points to an issue with the TorqueOrcBotData DataBlock.
Heres the DataBlock:
datablock PlayerData(TorqueOrcBotData : DefaultPlayerData)
{
   renderFirstPerson = false;
   emap = true;
   
   jumpTowardsNormal = false;
   airControl = 0;
   
   maxForwardSpeed = 7;
   maxBackwardSpeed = 5; 
   maxSideSpeed = 5;
   jumpForce = 30.0 * 90;

   shapeFile = "art/shapes/actors/characters/advanced.dts";
   
   category = "AI";
   className = "AiBotData";
   
   deathSnd = TorqueOrcSoundDeath;
   //painSnd[0] = TorqueOrcSoundPain01;
   //painSnd[1] = TorqueOrcSoundPain02;
   //painSndCount = 2;
   
   ragdoll = "TorqueOrcRagDoll";
   
   weapon = RocketLauncherImage;
   ammo = RocketLauncherAmmo;
   ammoCount = 3000;
   //shootingDelay = 2000;
   
   shootingDelay = 500;
   shootingDelayVariant = 400;
   
   
   chaseFarDist = 20;
   chaseCloseDist = 14;
   attackFov = 45;
   attackDist = 50;
   
   strafeMinDist = 5;
   strafeMaxDist = 10;
   strafeChangeDirTime = 800;
   
   maxDamage = 10000;
};

datablock PlayerData(TorqueOrcBotData2 : TorqueOrcBotData)
{
   weapon = RocketLauncherImage;
   ammo = RocketLauncherAmmo;
   ammoCount = 3000;
   shootingDelay = 2000;
   shootingDelayVariant = 2000;
};

It took me a few minutes to click on where this was coming from.
It is the second DataBlock that is giving the error.
........datablock PlayerData(TorqueOrcBotData2 : TorqueOrcBotData).......
Not the first one:
........datablock PlayerData(TorqueOrcBotData : DefaultPlayerData).......

The first one is where the error starts and is then propogated to the second one.
It never inhereted properly on the first one: [ TorqueOrcBotData : DefaultPlayerData ]
I then ran it in Debug.

compiledEval.cpp
// Does it have a parent object? (ie, the copy constructor : syntax, not inheriance)
               if(*objParent)
               {
                  // Find it!
                  SimObject *parent;
                  if(Sim::findObject(objParent, parent))
                  {
                     // Con::printf(" - Parent object found: %s", parent->getClassName());

                     currentNewObject->setCopySource( parent );
                     currentNewObject->assignFieldsFrom( parent );
                  }
                  else
                     Con::errorf(ConsoleLogEntry::General, "%d: Unable to find parent object %s for %s.", lineNumber, objParent, callArgv[1]);
               }

It's breaking at : ... %d: Unable to find parent object %s for %s. ...
When you have the Second DataBlock defined: ... TorqueOrcBotData2 : TorqueOrcBotData ...
If you remove it, no more errors..

Now this is when I started looking into it more deeply.
I also have the following Datablocks:

datablock PlayerData(DefaultPlayerData)
{
   renderFirstPerson          = true;
   className                  = Armor;
   shapeFile                  = "art/shapes/actors/characters/advanced.dts";
   ragdoll                    = "MackRagDoll";

   cameraMaxDist              = 3;
   computeCRC                 = false;//true
   canObserve                 = true;
   cmdCategory                = "Clients";
...
....

And in the same file:
datablock PlayerData(DefaultFemalePlayerData: DefaultPlayerData)
{
   renderFirstPerson          = true;
   className                  = Armor;
   shapeFile                  = "art/shapes/actors/characters/advanced_female.dts";
   ragdoll                    = "FackRagDoll";
};

Seems to be okay as there has been no error reports about it.
BUT, go into the Editor -> DataBlockEditor
And we don't have the Second one listed: (DefaultFemalePlayerData: DefaultPlayerData)
Only the first one.

As far as I can tell, the Second one is not created properly or at least won't
show in the DataBLock Editor.
This is just the initial dig into this problem, I havent actually tried to Create one
of the other PlayerData types yet.

#1
10/05/2011 (3:04 am)
Just a quick note (on my way to work..ugh)

I tried a quick test by changing the DefaultFemale to a complete
datablock without inheretence.. It now Shows properly in the
DataBlock editor.

There is definetly a problem either with how I was inhereting from
the Base one OR a problem with inheretence in this setup (PlayerData).
#2
10/05/2011 (3:34 am)
Another note to this...
These Items do appear to be showing in the
DataBlock Editor but with a Blank Name..
It also appears to be happening with ShapeBaseImageData.
#3
10/05/2011 (5:17 am)
Check that you're execing everything in the correct order.
www.garagegames.com/community/resources/view/21081
A vague if slightly confusing reminder ...
#4
10/05/2011 (6:18 am)
Not bothered about the reminder, but that was the first check I did,
which debug shows it occurring in the correct order:

Defaultplayer
TorcOrcBot

So that aint it in this case :)

Add to that the funny issue with the Default / Female datablocks
Once I switched the female to a full datablock without inheretence
it shows properly.

Now I also went through all my DB's that used inheritence..
My tanks were not having this problem, BUT I used only a few things
from the root one into the second one.

But the StrikerIAV was having problems...
Once I dropped the inheretence, I get a new error about col materials
that had not been occuring before, which explains an issue I had with
that one version of the IAV with the Plow :)
#5
10/05/2011 (6:51 am)
I know it's annoying, but can you try deriving TorcOrcBotData2 from DefaultPlayerData instead? It might be choking on the third generation copy.
#6
10/05/2011 (6:59 am)
Actually something is not right with PlayerData / ShapeBaseImageData
inheretence, or else the Editor has trouble with displaying inhereted
DB's.

As I pointed out, it seems to be having a problem with the inheretence
as an error with one of the shapes didn't show up (StrikerIAV) until
I removed the inheretence...

By error I mean "Reported in Log" errors..
Which those shapes I did actually deploy
with some issues in testing.

I'm gonna try this with the Vanilla source and see if the same
problems occur. Ill post later.

*edit*
Yeah, I do believe it was choking on the 3rd iteration of Inheretence
as only when I removed the 2nd version of torqueorcbot did the error
report go away, also if I did a complete DB without inherentence.
But it still looks like some issue with inheretence is occurring.
Reference the bit on StikerIAV --> All single inheretence
#7
10/05/2011 (8:01 am)
Okay, vanilla test, its not the basic engine code.
Something I changed or one of the 2 add ons caused it.

Ran the Pacific Demo and added basically the same thing,
Created 2 alternate DB's for player from soldierdata.

No bad effects or log errors.
Displays correctly in Editor.
AND it can do a 3rd generation copy...

Used the Mass value as a quick test as in Physics you can easily
see the change and test it by jumping :)
The changes passed thru just fine Mass from 125 - 10
at 10 you jump about 30 feet lol

Now I have to dig in and find the underlying cause..
Maybe someone else will have run into this and found it already,
*crosses fingers*

*Edit*
Gonna have to make it a matter of habit to always double check these
things with my Vanilla source (always keep a clean copy) before I post.
I think I've been working too hard this week :(