• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

anti-lag

Status
Not open for further replies.
Level 4
Joined
Sep 6, 2010
Messages
100
I saw a couple of maps have a anti-lag system, so I thought and I wanted to put one in my map but I don't know how to do it. Can anyone tell me?
 
Is there another way to do it, like say, by scaling unit sizes down?
Nah it won't work that way :p

Although some might argue, you can destroy your initialization triggers (on map initialization).
You know, the ones you'll never need again 100% for sure once they execute properly the first time.
You can also remove corpses of creeps - unless you have towers that can raise the dead in which case you might want to rethink that, but for the most part, removing corpses is amazing for anti-lag purposes.
Simply create a trigger that runs whenever a unit owned by the creep player dies, wait 2 seconds, and then remove the unit from the game, corpse and all.
However, the largest anti-lag issue relates to creating large numbers of units at one time, and ordering them to move.
Try to limit how many creeps appear per level to 20 or so.
From how to make TD map! Can help here I guess!
 
Level 21
Joined
Mar 19, 2009
Messages
444
Don't you think you speak about GHost or GProxy who can prevent people to be kicked because of lag?


If it is about unit amount, in my own map (RC601) they are arround 400 units at the same time on the map (creeps,NPCs,buildings,heroes,dummies and fake destructables).

Creeps group is ordered to move each 6. seconds, and it cas have up to 80 units at the same time (+dummy units). There is no more lag since I delay the order to each unit of the different groups with a timer (I do not order creeps to move all at the same time, I delay it for 0.03 second per creeps).

You can also use players 13 and 14 for your creeps. The more players used for creeps mass, the less risk of lags.
 
Level 15
Joined
Jul 9, 2008
Messages
1,552
this can also help for mass unit maps

  • dead units
    • Events
      • Unit - A unit Dies
    • Conditions
      • ((Triggering unit) is A Hero) Equal to False
    • Actions
      • Wait 15.00 seconds
      • Unit - Remove (Triggering unit) from the game
more conditions may be needed depending on your map
 
Level 11
Joined
Sep 12, 2008
Messages
657
hmm.. sry
what you sayd above does this:

a unit dies,
its a hero == false,
wait 15 seconds (aha! allready destroyed mui!)
remove unit.

i wanna hear what happends when using wait with many units?
1 dies, and another 1 dies at the distance of 1 ~ 15 seconds.
what happends?
1 unit is removed, the other WILL not.
so this is not helping.
most'ly ill do this:

  • Anti Lag
    • Events
      • Unit - A unit Dies
    • Conditions
      • ((Triggering unit) is A Hero) Equal to False
    • Actions
      • Set MaxCount = (MaxCount + 1)
      • Set CurrentUnit[MaxCount] = (Triggering unit)
      • Set CurrentTime[MaxCount] = 15.00
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Anti Lag 2 <gen> is on) Equal to False
        • Then - Actions
          • Trigger - Turn on Anti Lag 2 <gen>
        • Else - Actions
  • Anti Lag 2
    • Events
      • Time - Every 0.05 seconds of game time
    • Conditions
    • Actions
      • For each (Integer A) from 1 to MaxCount, do (Actions)
        • Loop - Actions
          • Set CurrentTime[(Integer A)] = (CurrentTime[(Integer A)] - 0.05)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • CurrentTime[(Integer A)] Less than or equal to 0.00
            • Then - Actions
              • Unit - Remove CurrentUnit[(Integer A)] from the game
              • Set LocalCount = (LocalCount - 1)
              • Custom script: if udg_LocalCount <= 0 then
              • Custom script: if udg_CurrentUnit[GetForLoopIndexA()] == null then
              • Custom script: call DisableTrigger(GetTriggeringTrigger())
              • Custom script: endif
              • Custom script: endif
            • Else - Actions
make sure Anti Lag 2 is intially off.
 
this can also help for mass unit maps

  • dead units
    • Events
      • Unit - A unit Dies
    • Conditions
      • ((Triggering unit) is A Hero) Equal to False
    • Actions
      • Wait 15.00 seconds
      • Unit - Remove (Triggering unit) from the game
more conditions may be needed depending on your map

and if a player pauses the wait will continue running and all dead units will be removed instantly
could be abused to stop corpse explosion type spells

That's because "Triggering unit" is an event response. It's no variable stored that can be overwritten it just checks whatever made it go off. (or am I wrong?)

as far as I know it's a local variable and therefore won't be overwritten
triggers can't return stuff which is not saved somewhere

hmm.. sry
what you sayd above does this:

a unit dies,
its a hero == false,
wait 15 seconds (aha! allready destroyed mui!)
remove unit.

i wanna hear what happends when using wait with many units?
1 dies, and another 1 dies at the distance of 1 ~ 15 seconds.
what happends?
1 unit is removed, the other WILL not.
so this is not helping.
most'ly ill do this:

  • Anti Lag
    • Events
      • Unit - A unit Dies
    • Conditions
      • ((Triggering unit) is A Hero) Equal to False
    • Actions
      • Set MaxCount = (MaxCount + 1)
      • Set CurrentUnit[MaxCount] = (Triggering unit)
      • Set CurrentTime[MaxCount] = 15.00
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Anti Lag 2 <gen> is on) Equal to False
        • Then - Actions
          • Trigger - Turn on Anti Lag 2 <gen>
        • Else - Actions
  • Anti Lag 2
    • Events
      • Time - Every 0.05 seconds of game time
    • Conditions
    • Actions
      • For each (Integer A) from 1 to MaxCount, do (Actions)
        • Loop - Actions
          • Set CurrentTime[(Integer A)] = (CurrentTime[(Integer A)] - 0.05)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • CurrentTime[(Integer A)] Less than or equal to 0.00
            • Then - Actions
              • Unit - Remove CurrentUnit[(Integer A)] from the game
              • Set LocalCount = (LocalCount - 1)
              • Custom script: if udg_LocalCount <= 0 then
              • Custom script: if udg_CurrentUnit[GetForLoopIndexA()] == null then
              • Custom script: call DisableTrigger(GetTriggeringTrigger())
              • Custom script: endif
              • Custom script: endif
            • Else - Actions
make sure Anti Lag 2 is intially off.

your local count is weird
and you don't really need 0.05 sec timer for units which are dead already
 
Level 4
Joined
Sep 6, 2010
Messages
100
Here's another question. If a person starts to lag and if someone pauses the game (normal pause, menu and pause) for 20 seconds or so then will he stop lagging?
 
Level 11
Joined
Sep 12, 2008
Messages
657
well.. it wont do much,
but the pause game option does balance the game more,
because fps goes back to normal.. cuz no instance is running,
thought if the player's inet connection is in a bad state,
he will still lag. no matter what.
 
Level 11
Joined
Aug 6, 2009
Messages
697
One trigger,MUI,lagless,tested,might be long but whatever it works.
  • Events
    • Unit - A unit Dies
  • Conditions
    • ((Triggering unit) is A Hero) Equal to False
  • Actions
    • Set DyingUnit = (Dying unit)
    • Unit Group - Add DyingUnit to UnitGroup
    • Set UnitCountReal = (UnitCountReal + 1.00)
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • UnitCountReal Greater than or equal to 2.00
      • Then - Actions
        • Set UnitCountReal = 0.00
        • For each (Integer A) from 1 to 3, do (Actions)
          • Loop - Actions
            • Unit Group - Pick every unit in UnitGroup and do (Actions)
              • Loop - Actions
                • Unit - Remove (Random unit from UnitGroup) from the game
      • Else - Actions
 
Status
Not open for further replies.
Top