Data Realms Fan Forums

AI_GOTO optimation
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
function Battlegrounds:Teleport(from , to , actor)
   --Teleport the actor.
   actor.Pos = to;
   actor.Vel.Y = 0;
   --Make the actor glow for a while.
   --Create the teleportation effect for both teleporters in the set.
   local fxa = CreateAEmitter("Teleporter Effect A");
   fxa.Pos = from;
   local fxb = CreateAEmitter("Teleporter Effect B");
   fxb.Pos = to;
  actor.AIMode = Actor.AIMODE_GOTO;
  if actor.Team == 0 then
    actor:AddAISceneWaypoint(Vector(4128, 876));
    actor:AddAISceneWaypoint(Vector(120, 876));

Page 1 of 1 All times are UTC [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group