Enumerations

weaaddar

New Member
Reaction score
6
ForGroup does filter them out but piss poorly. It actually leaves shadow references, and for some reason with each iteration these shadow references cost a lot of memory. There's a reason that GroupRefresh exists.

Eitherway,[ljass] if(GetWidgetLife(someUnit) < .405) [/ljass] is lightening fast.
 

Troll-Brain

You can change this now in User CP.
Reaction score
85
ForGroup does filter them out but piss poorly. It actually leaves shadow references, and for some reason with each iteration these shadow references cost a lot of memory. There's a reason that GroupRefresh exists.

Eitherway,[ljass] if(GetWidgetLife(someUnit) < .405) [/ljass] is lightening fast.

AFAIK a ghost unit doesn't fire ForGroup, or i'm wrong ?
I'm aware about ghost units, read again my previous post.

But i don't really understand this sentence :
and for some reason with each iteration these shadow references cost a lot of memory
You mean each time we do a ForGroup it leaks when we have ghost units inside it ?!

Checking the life isn't safe.
Without modify the life with triggers i've already got a dead hero with hp more than 0.405 hp because of a bugged ability.
You've also to care about life when you change it, else you can got a dead unit with more than 0.405 hp.

But i supposed if you code carefully and trigger all abilities then you can use it.
 

weaaddar

New Member
Reaction score
6
I remember reading somewhere that forgrouping through a group that had lots of removed units costed more memory. I've never tested it admittedly.
There are more complicated ways to determine if a unit is alive (adding an ability and seeing if the unit has it), and i imagine since its 4 times faster then the forGroup you can still beat the forGroup statement.
 

Troll-Brain

You can change this now in User CP.
Reaction score
85
Ok if you say it, i'm bad with speed theories anyway.
I will test the eventual leak of ghost units on each ForGroup call later though, if it's confirmed i won't use group for more than one instant anymore ...
 

Troll-Brain

You can change this now in User CP.
Reaction score
85
About the leak :

JASS:
scope testGroupLeak initializer onInit

globals
    private group Grp
    private timer Tim
endglobals

private function Callback takes nothing returns nothing
endfunction

private function Handler takes nothing returns nothing
    call ForGroup(Grp,function Callback)
endfunction

private function Actions takes nothing returns nothing
    call BJDebugMsg(&quot;test begin&quot;)
    call TimerStart(Tim,0.01,true,function Handler)
endfunction

private function onInit takes nothing returns nothing
    local integer i = 0
    local unit u
    local trigger trig = CreateTrigger()
    
    set Grp = CreateGroup()
    set Tim = CreateTimer()
    call TriggerRegisterPlayerEventEndCinematic(trig,Player(0))
    call TriggerAddAction(trig,function Actions)
    
    loop
    exitwhen i == 1000
    
        set u = CreateUnit(Player(0),&#039;hfoo&#039;,0.,0.,0.)
        call GroupAddUnit(Grp,u)
        call RemoveUnit(u)
        set u = null
        
    set i = i+1
    endloop
    
    call GroupAddUnit(Grp,CreateUnit(Player(0),&#039;hfoo&#039;,0.,0.,0.))
    call BJDebugMsg(&quot;init done&quot;)
endfunction

endscope


Yes i know the callback is empty but still, there is no leak just because of ghost units.
 

Nestharus

o-o
Reaction score
84
I wasn't event personally talking about ForGroup natives ><

I was talking about Enum natives, lol.
 

Troll-Brain

You can change this now in User CP.
Reaction score
85
Yeah it was off-topic but informative, fair enough, no ?

OFF-TOPIC again

weaaddar said:
There are more complicated ways to determine if a unit is alive (adding an ability and seeing if the unit has it)
Hmm, i don't see how you can handle it properly, AFAIK there is no revive event.
I suppose you can emule it with the defend ability though, maybe grim001 has already did it, i don't care about it anyway, i'm just curious.
For me GetUnitTypeId != 0 and GetUnitState(UNIT_TYPE_DEAD) is just fine.
 

Akolyt0r

New Member
Reaction score
33
Yeah it was off-topic but informative, fair enough, no ?

OFF-TOPIC again


Hmm, i don't see how you can handle it properly, AFAIK there is no revive event.
I suppose you can emule it with the defend ability though, maybe grim001 has already did it, i don't care about it anyway, i'm just curious.
For me GetUnitTypeId != 0 and GetUnitState(UNIT_TYPE_DEAD) is just fine.

u could use UnitAlive from common.ai aswell ;)
 

Xorifelse

I'd love to elaborate about discussions...........
Reaction score
87
Let me go on-topic on this one.

When you do a group enumeration with units or an item enumeration or w/e, it probably goes through all of the created handles and if it's like units in range, will see if in range or w/e and then call your code passing in the current enumerated handle.

Yes, you where thinking. Truth is we can't know for sure how enumerations work, we only can observe the behavior of the native and pull conclusions out from it.

Well.. do you guys think it would be faster with JASS with likes AIDS or PUI or something? You'd be eliminating the extra function calls per handle and it could be a massive performance saver.
Perhaps it will be faster, most likely not. But let's assume it is faster, creating a system in Jass to have the same flexibility as enumerations do now will most likely make it slower for sure.

Enumerations are a powerful thing, and looping just can't compare with that.
Although enumerations and looping behave the same way, enumerations are designed with flexibility in mind which is in most cases more important than execution time.

What do those few micro seconds matter to you anyways? These days computers are getting faster and faster and usually the GPU is too slow for those games. But I mean, com'on It's Warcraft III. 1.4Ghz was high at that time when it was released.
 

Lyerae

I keep popping up on this site from time to time.
Reaction score
105
1.4GHz was incredibly high when WC3 was released.
I remember playing it on a 667MHz processor...
 

weaaddar

New Member
Reaction score
6
I suppose if someone were nuts they could create a UnitSet library ontop of AIDS or AutoIndex. For large enough datasets the UnitSets would probably outperform groups (forGroup and Enumeration action of running boolexprs slow it down due to thread launching and what not), but again why reinvent the wheel.
 

Troll-Brain

You can change this now in User CP.
Reaction score
85
Akolytor said:
u could use UnitAlive from common.ai aswell
No.
Wc3 mapping is already build enough with bug exploits, work around to add one quite useless and not very tested.
 

Viikuna

No Marlo no game.
Reaction score
265
Maybe, but then again theres another way to see it too: [lJASS]GetWidgetLife(unit) > .405[/lJASS] has never failed me, and will not fail me, because I know not to change dead units health.

Shit, I dont even have to remember that all the time, just when I code that one function, which is used to change units current health, and which is then used by systems like Heal system, which is again used by spells that heal units and so on.


You can of course try to find solutions for problems that dont exist, but I personally see no reason to do such thing and I dont wanna see you teaching that bad habit to all these kids.

In other words: Quit the bullshit already, please.
 

Troll-Brain

You can change this now in User CP.
Reaction score
85
Maybe, but then again theres another way to see it too: [lJASS]GetWidgetLife(unit) > .405[/lJASS] has never failed me, and will not fail me, because I know not to change dead units health.

Shit, I dont even have to remember that all the time, just when I code that one function, which is used to change units current health, and which is then used by systems like Heal system, which is again used by spells that heal units and so on.


You can of course try to find solutions for problems that dont exist, but I personally see no reason to do such thing.

In other words: Quit the bullshit already, please.
Yes i know you are this silly guy which trigger all your abilities.
It was just a personal opinion, and we had already this discussion on an other site, keep you cool, thx.
 

Viikuna

No Marlo no game.
Reaction score
265
Yea.

Well, anyways, everyone has their own taste. Some people prefer to do stuff with GUI, for example. Some guys find that pretty damn stupid.

All we can do is to do stuff in our way, and then argue about why the way we do it is the best.



I myself mostly believe that if you want something done properly, you gotta do it by yourself.

Example being: If I want to make a simple missile spell, like storm bolt but with some extra stuff, I need to either use dummy storm bolt and detect when it hits the target, or trigger that missile movement by myself. Option one might seem to be easier, but it has the downside that once that storm bolt is out there, you cant take it back. This is why later when desinging some new spell I realize I should have triggered that shit in the first place, because right now this new "Take It Back" spell I wanna make, is impossible to do.

edit. Yea, sorry, I know I should not talk about any of this stuff here, but I just cant help myself sometimes.
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • Ghan Ghan:
    Howdy
  • Ghan Ghan:
    Still lurking
    +3
  • The Helper The Helper:
    I am great and it is fantastic to see you my friend!
    +1
  • The Helper The Helper:
    If you are new to the site please check out the Recipe and Food Forum https://www.thehelper.net/forums/recipes-and-food.220/
  • Monovertex Monovertex:
    How come you're so into recipes lately? Never saw this much interest in this topic in the old days of TH.net
  • Monovertex Monovertex:
    Hmm, how do I change my signature?
  • tom_mai78101 tom_mai78101:
    Signatures can be edit in your account profile. As for the old stuffs, I'm thinking it's because Blizzard is now under Microsoft, and because of Microsoft Xbox going the way it is, it's dreadful.
  • The Helper The Helper:
    I am not big on the recipes I am just promoting them - I use the site as a practice place promoting stuff
    +2
  • Monovertex Monovertex:
    @tom_mai78101 I must be blind. If I go on my profile I don't see any area to edit the signature; If I go to account details (settings) I don't see any signature area either.
  • The Helper The Helper:
    You can get there if you click the bell icon (alerts) and choose preferences from the bottom, signature will be in the menu on the left there https://www.thehelper.net/account/preferences
  • The Helper The Helper:
    I think I need to split the Sci/Tech news forum into 2 one for Science and one for Tech but I am hating all the moving of posts I would have to do
  • The Helper The Helper:
    What is up Old Mountain Shadow?
  • The Helper The Helper:
    Happy Thursday!
    +1
  • Varine Varine:
    Crazy how much 3d printing has come in the last few years. Sad that it's not as easily modifiable though
  • Varine Varine:
    I bought an Ender 3 during the pandemic and tinkered with it all the time. Just bought a Sovol, not as easy. I'm trying to make it use a different nozzle because I have a fuck ton of Volcanos, and they use what is basically a modified volcano that is just a smidge longer, and almost every part on this thing needs to be redone to make it work
  • Varine Varine:
    Luckily I have a 3d printer for that, I guess. But it's ridiculous. The regular volcanos are 21mm, these Sovol versions are about 23.5mm
  • Varine Varine:
    So, 2.5mm longer. But the thing that measures the bed is about 1.5mm above the nozzle, so if I swap it with a volcano then I'm 1mm behind it. So cool, new bracket to swap that, but THEN the fan shroud to direct air at the part is ALSO going to be .5mm to low, and so I need to redo that, but by doing that it is a little bit off where it should be blowing and it's throwing it at the heating block instead of the part, and fuck man
  • Varine Varine:
    I didn't realize they designed this entire thing to NOT be modded. I would have just got a fucking Bambu if I knew that, the whole point was I could fuck with this. And no one else makes shit for Sovol so I have to go through them, and they have... interesting pricing models. So I have a new extruder altogether that I'm taking apart and going to just design a whole new one to use my nozzles. Dumb design.
  • Varine Varine:
    Can't just buy a new heatblock, you need to get a whole hotend - so block, heater cartridge, thermistor, heatbreak, and nozzle. And they put this fucking paste in there so I can't take the thermistor or cartridge out with any ease, that's 30 dollars. Or you can get the whole extrudor with the direct driver AND that heatblock for like 50, but you still can't get any of it to come apart
  • Varine Varine:
    Partsbuilt has individual parts I found but they're expensive. I think I can get bits swapped around and make this work with generic shit though
  • Ghan Ghan:
    Heard Houston got hit pretty bad by storms last night. Hope all is well with TH.
  • The Helper The Helper:
    Power back on finally - all is good here no damage
    +1
  • V-SNES V-SNES:
    Happy Friday!
    +1

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top