View unanswered posts | View active topics It is currently Mon Mar 30, 2020 2:41 am



Reply to topic  [ 1 post ] 
 AI_GOTO optimation 
Author Message
User avatar

Joined: Wed May 20, 2009 3:10 pm
Posts: 366
Location: Ã…rhus, Denmark
Reply with quote
Post 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


Fri Feb 04, 2011 4:51 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 1 post ] 

Who is online

Users browsing this forum: No registered users


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by STSoftware for PTF.
[ Time : 0.011s | 13 Queries | GZIP : Off ]