• 🏆 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!
BlackHawk
Reaction score
9

Profile posts Latest activity Postings Experience Resources About

  • this should do itfunction EnumStandardFilter takes nothing returns boolean
    set udg_ue = GetFilterUnit()
    return not(IsUnitType(udg_ue,UNIT_TYPE_MECHANICAL)or IsUnitType(udg_ue,UNIT_TYPE_STRUCTURE)or IsUnitType(udg_ue,UNIT_TYPE_DEAD)or IsUnitType(udg_ue,UNIT_TYPE_FLYING)or IsUnitType(udg_ue,UNIT_TYPE_MAGIC_IMMUNE)) and IsUnitEnemy(udg_ue,udg_p)
    endfunction

    function GroupEnumStandard takes group g, unit u, real x, real y, real r returns nothing
    local boolexpr cond = Condition(function EnumStandardFilter)
    set udg_p = GetOwningPlayer(u)
    call GroupEnumUnitsInRange(g, x, y, r, cond)
    endfunction

    IsUnitVisible and UNIT_TYPE_SNARED might be worth considering, too
    just creating and destroying groups only takes 15% of the bj_wantDestroyGroup + picking all units so it is not the picking which slows things down most
    gonna try jass now
    shit....JASS really beats the crap out of GUI in this case
    filling a unitgroup is like 25 times faster (100 sec)
    compared to something like 2500 sec with GUI
    (of cause I did not wait that long but ran it 50 times less often and stopped 50 sec)
    I'll make some simple JASS functions for filling unit groups which can be used in GUI easily so GUI won't be much slower then JASS
    1k character visitor message limit :S

    here the data so far
    GetWidgetX: 23 sec
    GetUnitX: 18 sec
    r=r: 6 sec
    a[0]=a[0]: 9 sec
    SetWidgetLife: 37 sec
    SetUnitLife: 37 sec
    SetUnitState(udg_u, UNIT_STATE_LIFE, 100): 43 sec
    MoveLocation: 20 sec
    GetLocationZ: 38 sec
    GetLocationX: 20 sec
    if then else: 3 sec
    GUI if then else: 20 sec
    SetUnitX: 37 sec
    Pick every unit in map (a peasant and a footy): 2500 sec (approximately, at least it is a very very big number)
    same speed for picking units within 512 range (same units)
    5% less for 1 unit only
    no matter how inaccurate these benchmarks are, they prove that unitgroups are damn slow

    (just backing this up since hive never delete stuff :p)
    well
    you are right xD
    things will become more complicated with 2D-arrays
    if you do "set location[0] = <something>" it will be slower then "set location = <something>"
    however compared to any other function the speed difference does not matter at all

    locations are some kind of objects so they will be a lot slower and it's best to avoid them anyway(unless you are using some GUI functions which require locations[stupid blizzard did not implement coordinate stuff])
    just moving them should not be much slower though

    edit
    awesome o_O
    moving locations is only 3 times slower then setting global variables and twice as fast as setting unit's life
    however you can store 2 different variables at once + you can get a location's height
    this makes moving locations to one of the fastest/best ways to store stuff
    you could also abuse them as 2d arrays xD

    retrieving a location's x/y position takes 20 sec
    GetLocationZ takes 40 seconds
  • Loading…
  • Loading…
  • Loading…
  • Loading…
  • Loading…
Top