• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Lag Issues on map.

Status
Not open for further replies.
I have been working on this map for 3 days now. I put all my effort into it and done the best, leakless triggers i could... The problem i still have though, is that it lags in game. At first, there isn't much but then i get LOTS of lag. Could someone please optimize the triggers in the map or at least tell me how i could improve it.

I am trusting the members of hive workshop with this so please, don't steal it.

Btw is this the right forum to post it?

------------------------------------
EDIT
Thanks a lot for helping me, hopefully this will be pretty lag free now =]
 

Attachments

  • Ice Arena 0.1a.w3x
    231.1 KB · Views: 65
Last edited:
Level 8
Joined
Oct 8, 2005
Messages
409
You have way too many periodic time events.

you have 4 triggers that happen every second
2 triggers that happen every .03 second
2 triggers that happen every .01 second
a trigger that happens every .1 second
and a trigger that happens every .3 second

1) combing a few of these triggers to remove a timer or two might remove some lag
2) try increasing the seconds on some of the triggers
3) try to find an event to use, other than
  • Time - Every 0.01 seconds of game time
4) use the wc3mapoptimizer1.8
5) turn off triggers when you are not using them
6) remove some of the frost traps, you have way too many of them
7) try to keep the number of units on the map under 500
 

Lej

Lej

Level 3
Joined
Jun 5, 2004
Messages
36
There seems to be a lot of big triggers running at 0.03/0.01 seconds interval though a quick look didn't reveal any leaks in them. You clean most things up nicely but you seem to forget player groups.

The Income trigger leaks a player group every second.
The Create trigger leak a single player group.
The Refresh trigger leak a player group every 0.1 second.
The Set trigger leaks a player group every second.
 

Lej

Lej

Level 3
Joined
Jun 5, 2004
Messages
36
Shamelessly stolen from the "things that leak" thread:
( http://www.hiveworkshop.com/forums/showthread.php?p=275043#post275043 )

  • Player Group
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Some Spell
    • Actions
      • Set PlayerGroup = (All enemies of Player 1 (Red))
      • Player Group - Pick every player in PlayerGroup and do (Do nothing)
      • Custom script: call DestroyForce(udg_PlayerGroup)
 

Lej

Lej

Level 3
Joined
Jun 5, 2004
Messages
36
You seem to be right. The (All Players) uses the GetPlayersAll() which only returns the value of bj_FORCE_ALL_PLAYERS which is a constant as you say.

If so then the Income and Set triggers are fine.
 

Lej

Lej

Level 3
Joined
Jun 5, 2004
Messages
36
Well, less horrible :p

I took a look at the trigger that run periodically and using

  • Events
    • Unit - A unit comes within 100.00 of SPECIFIC_UNIT
might be able to improve performance of the pick up items and hit trigger . Not sure how effective/precise it is but at least the triggers would run a lot less. It would however require that you create a local trigger for each item/ball which means some JASS knowledge is required.
 
Each item / ball?
That's bizarre. Couldn't you do with arrays? EG:
  • SetUnit
  • Events -
  • A Unit Uses an Item
  • Conditions -
  • Actions -
    • Unit - Create 1 blah blah
    • Set Unit[UnitCount] = Last Created Unit
    • Set UnitCount = UnitCount + 1
then have a trigger

  • SetUnit
  • Events -
  • Every 0.01 Seconds of the game
  • Conditions -
  • Actions -
    • For each integer A from 1 to (UnitCount) do:
    • [Actions corresponding to the unit]
 

Lej

Lej

Level 3
Joined
Jun 5, 2004
Messages
36
After a taking a closer look I noticed there is no Event Response to get the Ball if you are watching if a slider gets in range of it. This means you have to use handle vars (or similar) and it gets even more complicated.

This might be flawed. I haven't tested it. (Made a test map and attached it. There's one problem in doing it like this. You must create the Hit trigger first in the Trigger Editor to make sure it is inserted above the Throw trigger in the map script file)

But here's my idea if you feel like learning something. This uses kattana's local handle vars ( http://www.wc3jass.com/viewtopic.php?t=224&start=0)

  • Throw
    • Events
      • Unit - A unit Uses an item
    • Conditions
      • (Item-type of (Item being manipulated)) Equal to Normal Ball
    • Actions
      • -------- First create the ball like you do now. --------
      • -------- Then create a local trigger for the ball. --------
      • Custom script: local trigger t = CreateTrigger()
      • -------- Then add a event to the created trigger. --------
      • -------- bj_lastCreatedUnit is the last created unit i.e. the ball. --------
      • Custom script: call TriggerRegisterUnitInRange(t, bj_lastCreatedUnit, RANGE, null)
      • -------- Finally add an action to the trigger. This function will be run when the event occurs. --------
      • -------- Trig_{TRIGGERNAME}_Action is the standard name for trigger action so now you just have to create a trigger named Hit and do the actions there --------
      • Custom script: call TriggerAddAction(t, function Trig_Hit_Actions)
      • -------- As we will only be able to get the unit entering in range i.e. the Slider in the hit trigger we need to "attach" the Ball unit to the trigger so we may use it there. --------
      • -------- Here I use Kattanas handle vars. There are other and maybe better systems but this is simple. --------
      • -------- This attaches the Unit bj_lastCreatedUnit to trigger t in a field named "Unit" --------
      • Custom script: SetHandleHandle(t, "Unit", bj_lastCreateUnit)
  • Hit
    • Events
    • Conditions
    • Actions
      • -------- This retrives the Unit attached to this trigger in the field named "Unit". --------
      • Custom script: set udg_TempUnit = GetHandleUnit(GetTriggeringTrigger(), "Unit")
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of (Triggering unit)) Equal to Slider
        • Then - Actions
          • -------- Here you do you hit stuff. Triggering unit refers to the unit getting in range i.e. the Slider. --------
          • -------- and TempUnit is the ball. --------
          • -------- When you are finished you want to flush (destroy) the variables attached to the trigger so they don't leak. --------
          • Custom script: call FlushHandleLocals(GetTriggeringTrigger())
        • Else - Actions
More help on using handle vars ( http://www.wc3jass.com/viewtopic.php?t=2006 )

Test map. Peasant = Ball. Footman = Slider.
 

Attachments

  • HitDetectTest.w3x
    17.5 KB · Views: 57
Last edited:

Lej

Lej

Level 3
Joined
Jun 5, 2004
Messages
36
To use the Local Handle Vars function I used you need to insert this into the Custom Script section of hte map. You get to it by clicking on "hittest.w3x" in the trigger editor.

Secondly you need to create locals before you do any other action so move
  • Custom script: local trigger t = CreateTrigger()
to the top

Thirdly for this way to work the Hit trigger needs to be above the ThrowNormal trigger in the text file that contains the triggers. The triggers are added in the order they are created in the editor and you created ThrowNormal before Hit. To fix this copy all actions from ThrowNormal, delete it, create a new trigger named ThrowNormal and paste the actions.
 
Status
Not open for further replies.
Top