Game Development Community

Code problems

by Larry Dolyniuk · in Torque 3D Professional · 07/05/2010 (11:36 am) · 2 replies

Hello, I have created a function to spawn 50 AI to 50 spawnpoints in my "battlefield", unfortunately my noobish way of doing things has led to increased memory consumption (my client gets extremely laggy) and lack of my AI players :p, each spawnpoint is named either GS1 - GS50 or BS1 - BS50 giving two sides to a battlefield.

function spawn()
{
for(%i = 1; %i <= 50; %i++)
{
%Gq = "G" @ %i;
%Bq = "B" @ %i;
%GSpawn = "GS" @ %i;
%BSpawn = "BS" @ %i;
AIPlayer::spawn(%Gq, %GSpawn);
AIPlayer::spawn(%Bq, %BSpawn);
%Gq = null;
%Bq = null;
}
}

as you can see I even tried setting each indexed string to null after I finished using them, but that did nothing haha, any help would be wonderful, sorry if this is too noobish of a problem, thanks :).

#1
07/05/2010 (12:14 pm)
I have discovered a helpful resource which accomplishes what I need, it is old though so I still had to get it working with T3D, but it is now working like a charm :) heres the link if anyone is curious:

http://www.garagegames.com/community/blogs/view/15961
#2
07/05/2010 (12:30 pm)
Try throwing in echoes and see what they say in console.

eg: echo("Name " @ %Gq @ " Spawnpoint " @ %GSpawn);

AIPlayer::spawn gives %name as the shapename rather than the object name ...

[edit] lol ... slowest typing ever ... glad you sorted it out