Data Realms Fan Forums
http://45.55.195.193/

AI_GOTO optimation
http://45.55.195.193/viewtopic.php?f=73&t=21388
Page 1 of 1

Author:  akblabla [ Fri Feb 04, 2011 4:51 pm ]
Post subject:  AI_GOTO optimation

I have a problem. I am currently making a gamemode which involves buildings producing units which automatically attacks the enemy. My problem is that the AIMODE_GOTO and AIMODE_BRAINHUNT lags horribly. My 250 fps drops to 10 for a sec when AIMODE_GOTO is set by lua. When i remove the AIMODE_GOTO from my code, the lag is completely gone.

Anybody got some smart tricks to avoid it. I don't think I've had the lag in skirmish defense and anyother mode where the enemy comes by dropships.

Here is the code where I use the AI_GOTO
Code:
function Battlegrounds:Teleport(from , to , actor)
   --Teleport the actor.
   actor.Pos = to;
   actor.Vel.Y = 0;
   --Make the actor glow for a while.
   actor:FlashWhite(1500);
   --Create the teleportation effect for both teleporters in the set.
   local fxa = CreateAEmitter("Teleporter Effect A");
   fxa.Pos = from;
   MovableMan:AddParticle(fxa);
   local fxb = CreateAEmitter("Teleporter Effect B");
   fxb.Pos = to;
   MovableMan:AddParticle(fxb);
  actor.AIMode = Actor.AIMODE_GOTO;
  actor:ClearAIWaypoints();
  if actor.Team == 0 then
    actor:AddAISceneWaypoint(Vector(4128, 876));
  else
    actor:AddAISceneWaypoint(Vector(120, 876));
  end
end

Page 1 of 1 All times are UTC [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/