Couple Questions

Level 7
Joined
Apr 1, 2019
Messages
156
1. For bribes damage engine, it's faster if you combine all your triggers into one with the GDD_Damage_event. Does the same concept apply to other triggers? Say combining all your, "a unit is sold" or "periodic Event .03 sec" along with the many other events to reduce lag?

2. On version wc3 1.31 the trigger editor is hella laggy, I do have lots of triggers tho, but it wasn't like that on 1.30, is there a fix for this?

3. In Jass
call DestroyGroup(udg_temp)
call DestroyForce(udg_temp)
call RemoveLocation(udg_temp[bj_forLoopAIndex])
call SetUnitState(u, UNIT_STATE_LIFE, GetUnitState(u, UNIT_STATE_MAX_LIFE))

is like this in lua
DestroyGroup(udg_temp)
DestroyForce(udg_temp)
RemoveLocation(udg_temp[bj_forLoopAIndex])
SetUnitState(u, UNIT_STATE_LIFE, GetUnitState(u, UNIT_STATE_MAX_LIFE))

Like is all the function calls in lua exactly the same as Jass but without the "call"
 

Wrda

Spell Reviewer
Level 23
Joined
Nov 18, 2012
Messages
1,734
1. No. If you're talking about the speed of execution of the first two then it makes literally no difference, what's different is your triggers' organization. Having all your "periodic events" in one trigger would not only NOT make sense, but also probably cause processing than needed, thus some spike lags.
2. Doubt it is the trigger editor alone, maybe it's your map in general, like if you have lots of imported models and it's quite large, has lots of doodads, destructibles, buildings, units. That all adds up.
3. Obviously.
 
Level 12
Joined
Feb 22, 2010
Messages
1,115
1- This is asked many times. First note that lag and spike are two different things. Lag is a continuous delay (what you order happens later/slowly), and spikes are little game freezes which are (most of the time) caused by execution of lots of actions at the same time, sometimes they are caused by bad object editor values on abilities too.

For non-periodic events, yes, most of the time you will gain a very slight performance boost if you combine all your events into a single trigger with a bunch of if-then-else statements. But there is a trade-off between performance and maintaining/complexity, performance you gained simply not worth it in my opinion, if there is a lag problem in your map combining your events into a single trigger will almost never fix the issue.

For periodic events, things are different. If actions inside your periodic triggers are lightweight, same thing will happen as normal events. You will gain a slight performance gain. But the problem is, stuff inside periodic triggers are mostly performance heavy such as: Triggered unit movement, unit/player group enumerations(picks), AI checks ... Running separate timers allow you to separate things (well, obviously), if you merge all stuff inside a single trigger you may start to encounter spikes due to lots of actions being executed at an instant. So we can say that you will have better performance until some point, but after that point you will encounter spikes.

But I advise you to always find a larger problem to fix first.

3- Names of native functions (which are in the common.j file) are the same, names of bj functions (which are in the blizzard.j file) should also be same. However, some operators (like modulo) might be different and there might be new LUA language specific functions.
 

Uncle

Warcraft Moderator
Level 48
Joined
Aug 10, 2018
Messages
4,697
1) I'm not sure how significant the performance gains are but I find it fairly easy to combine Events using Lua. I attached a map with an example of this.

2) I've definitely experienced slow down with a completely empty map that had some massive triggers. Maybe converting everything to Lua would fix this. Also, try turning off Brush List under Window for better performance-at least in the Object Editor.

3) Referring to Ceday's comment, Modulo is % in Lua, and here's a nice list of things you can do with Lua (blue = can be used):
[Lua] Basic lua functions
 

Attachments

  • Lua Cast Example.w3x
    17.1 KB · Views: 43
Level 15
Joined
Aug 14, 2007
Messages
936
Alright I don't really care about previous comments but about this topic, strictly splitting them into many triggers is better, allow me to explain myself.

Firstly you require the turn on and turn off triggers (as suggested by my friend who were doing triggers with me back in the days),

That said, by splitting the task into many triggers then controlling their flow by turning them on or off greatly reduces lag as to having everything in one trigger.

Correction: In the second case where you put everything in the trigger, you literally have no lag control.
 
Top