找回密码
 点一下
查看: 827|回复: 0

占用内存过多是延迟的原因么

[复制链接]
发表于 2010-12-29 10:55:48 | 显示全部楼层 |阅读模式
我曾经以为用等待时延迟的主要原因,不过测试的时候感觉好像不是.....难道占用内存过多是延迟的原因么??
这是从一个论坛看到的一个帖子
Massive lag and then disconnect

Hello, I recently started playing my old map again and wanted to update ( I wasn't mapping for a long time) and I thought of something and tried to make it in GUI but It proved to be difficult, so I tried JASS. In single player it works perfectly, but I tried this online and it caused a huge lag and then everyone disconnected. ( I am super noob in JASS ) So how could I fix this? and what is wrong with it??
[pre]

function Trig_Mod_Actions takes nothing returns nothing
local fogmodifier fog
call CreateFogModifierRadiusLocBJ( true, udg_GapPlayer, FOG_OF_WAR_MASKED, udg_Point[1], 1200.00 )
set fog = GetLastCreatedFogModifier()
call TriggerSleepAction( 0.04 )
call DestroyFogModifier( fog )
endfunction
//===========================================================================
function InitTrig_Mod takes nothing returns nothing
set gg_trg_Mod = CreateTrigger(  )
call TriggerAddAction( gg_trg_Mod, function Trig_Mod_Actions )
endfunction


This trigger is called after point[1] is being set at the location I want it and GapPlayer is set too, this code is called every 0.01 s (0.03s causes bugs with black mask).
Other trigger which is in GUI that runs the JASS:
GAP test Copy 2
Events
Time - Every 0.01 seconds of game time

Conditions
Actions
For each (Integer A) from 1 to 12, do (Actions)
Loop - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(GapUnit[(Integer A)] is alive) Equal to True

Then - Actions
Set Point[1] = (Position of GapUnit[(Integer A)])
Set Tforce = (All enemies of (Owner of GapUnit[(Integer A)]))
Player Group - Pick every player in (All enemies of (Owner of GapUnit[(Integer A)])) and do (Actions)
Loop - Actions
Set Temp_Group = (Units within 1400.00 of Point[1])
Unit Group - Pick every unit in Temp_Group and do (Actions)
Loop - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Owner of (Picked unit)) Equal to (Picked player)

Then - Actions
Set Gap[Gapindex] = False

Else - Actions



Custom script: call DestroyGroup (udg_Temp_Group)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Gap[Gapindex] Equal to True

Then - Actions
Set GapPlayer = (Picked player)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
BlackMaskOn Equal to True

Then - Actions
Trigger - Run Mod <gen> (ignoring conditions)

Else - Actions
Trigger - Run Mod2 <gen> (ignoring conditions)



Else - Actions

Set Gap[Gapindex] = True
Set Gapindex = (Gapindex + 1)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Gapindex Greater than 144

Then - Actions
Set Gapindex = 0

Else - Actions



Custom script: call DestroyForce( udg_Tforce )
Custom script: call RemoveLocation (udg_Point[1])

Else - Actions







(Mod2 is the same as Mod1 but with FOGGED instead of MASKED)


tigger before I used JASS which didn't really lag at first but then leaked visibility modifiers:
GAP test
Events
Time - Every 0.01 seconds of game time

Conditions
Actions
For each (Integer B) from 1 to 144, do (Actions)
Loop - Actions
Visibility - Destroy VisibilityGAP[(Integer B)]


For each (Integer A) from 1 to 12, do (Actions)
Loop - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(GapUnit[(Integer A)] is alive) Equal to True

Then - Actions
Set Point[1] = (Position of GapUnit[(Integer A)])
Player Group - Pick every player in (All enemies of (Owner of GapUnit[(Integer A)])) and do (Actions)
Loop - Actions
Set Temp_Group = (Units within 1400.00 of Point[1])
Unit Group - Pick every unit in Temp_Group and do (Actions)
Loop - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Owner of (Picked unit)) Equal to (Picked player)

Then - Actions
Set Gap[Gapindex] = False

Else - Actions



Custom script: call DestroyGroup (udg_Temp_Group)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Gap[Gapindex] Equal to True

Then - Actions
Visibility - Create an initially Enabled visibility modifier for (Picked player) emitting Black mask from Point[1] to a radius of 1200.00
Set VisibilityGAP[Gapindex] = (Last created visibility modifier)

Else - Actions

Set Gap[Gapindex] = True
Set Gapindex = (Gapindex + 1)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Gapindex Greater than 144

Then - Actions
Set Gapindex = 0

Else - Actions



Custom script: call RemoveLocation (udg_Point[1])

Else - Actions



内存泄露了...........




您需要登录后才可以回帖 登录 | 点一下

本版积分规则

Archiver|移动端|小黑屋|地精研究院

GMT+8, 2024-11-24 05:00 , Processed in 0.046311 second(s), 18 queries .

Powered by Discuz! X3.5

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表