Game Development Community

Strange datablock related crash with aiPlayer

by Vijay · in Torque Game Engine Advanced · 06/12/2009 (10:14 am) · 3 replies

I'm using the T3D game example with the latest version of TGEA (1.8.1) to do some AIPlayer experiments. I copied over the aiplayer.cs file from the Stronghold demo and integrated the AIManager correctly. With the default code, I get a "Kork" based on the DefaultPlayerData block. Here's the relevant code from aiPlayer.cs:

//-----------------------------------------------------------------------------
// Demo Pathed AIPlayer.
//-----------------------------------------------------------------------------

datablock PlayerData(DemoPlayer : DefaultPlayerData)
{
   shootingDelay = 2000;
};

Since this is the T3D demo, it also has a few other player characters, each with a datablock inherited from the DefaultPlayerData. The ForgeSoldier character defines its datablock like this:
datablock PlayerData(ForgeSoldierData : DefaultPlayerData)

If I change the DemoPlayer above to inherit from anything other than DefaultPlayerData the engine crashes while loading the level. There are no errors of any sort (all the character setup is correct, I can select them from the object picker gui, play with them in the game level, etc). I can't figure out what I'm doing wrong here. Any pointers/help is appreciated.

#1
06/12/2009 (10:47 am)
Double check your spelling for your AI's datablock. Make sure it matches what the spawning code is looking for and verify that you spelled the parent datablock correctly. The crash you describe sounds like you might be trying to load an invalid (non-existent) datablock
#2
06/12/2009 (11:05 pm)
Thanks Michael! It was totally my mistake. Instead of following code, I just looked at the console.log file and the datablock file I was using was being loaded earlier but that was before the mission even started (to pick the player, weapon, etc). After I made sure the datablock is loaded before the aiplayer, everything works like a charm.
#3
06/13/2009 (12:36 am)
Yep, that'll cause that too. Sometimes that whole datablock loading order sequence can be a bit of a learning experience. Glad you got it.