Game Development Community

RTS Prototype - AI activity changes since docs were written

by Norm Koger · in Torque 3D Professional · 10/07/2009 (7:15 pm) · 2 replies

I've been working with the Torque3d RTS prototype docs. A few things have changed in the full template scripting since the docs were created. I managed to work around most of the changes, but I do still have an issue. While it is possible to assign a move destination via setMoveDestination() in the onRightMouseDown() function, decal is placed and the variables are indeed being set - verified by stepping through under debugger, the AI logic isn't acting upon the direction. In another post in the forum it has been suggested that spawning AIPlayer as opposed to Player spawnClass is no longer fully supported by the default code. Apparently something else needs to be done now (that didn't need doing when the prototype docs were written) to actually enable processing of the AI handling. How do I kick off the AI in the current environment, assuming I am following the RTS prototype instructions, and where is the best place to do it?

About the author

Professional game designer since 1987, with 11 mainstream titles released over the years. M.S. Physics. Software developer for SSI, TalonSoft, and now Storm Eagle Studios.


#1
10/08/2009 (12:48 am)
I had the same problem, and this thread helped me:

http://www.garagegames.com/community/forums/viewthread/102761/1#comment-682539
#2
11/02/2009 (3:49 pm)
i'm having trouble spawning enemies... i followed the instructions and typed this into "default.bind.cs"
// Spawn an AI guy when key is pressed down
function spawnAI(%val)
{
   // If key was pressed down
   if(%val)
   {
      // Create a new, generic AI Player
      // Position will be at the camera's location
      // Datablock will determine the type of actor
      new AIPlayer() 
      {
         position = LocalClientConnection.camera.getPosition();
         datablock = "DefaultPlayerData";
      };
   }
}

// Bind the function spawnAI to the keyboard 'b' key
moveMap.bind(keyboard, b, spawnAI);
when i press 'b', nothing happens. i've checked over the code, and the rest of the RTS prototype tutorial, and made sure i didn't skip any steps. i had a feeling that it had something to do with the datablock "DefaultPlayerData" since that didn't ring a bell and i didn't find it anywhere in the folders. sure enough, i hit b and check the console and there's an error message saying datablock "DefaultPlayerData" can't be found.