I need help from experts

Tom_Kazansky

--- wraith it ! ---
Reaction score
157
sorry that I can't write a more descriptive title :(

I have something that bugged me, more like "not sure", here are they:
  1. I want a "custom regeneration" system, that do the regeneration of units manually, so I add units to a group and use a 0.1s static timer to do the regeneration, but I got lag if there are too many units (about 40 units, I think)

    I think my method is not efficient so I think using AIDS and T32 would be better. Yea, T32 add a period timer to AIDS struct, and AIDS struct hold the unit's data. I only need 0.1s period for this.
    So will I be able to have more units before the lag ?
    (I know the lag would depend on what I do with each period, but assume that I do the same things with my method and with T32 )

    (I know this can be self-tested but currently, my remake map is in terraining so I can't test it myself)

  2. I make a filter system (for group enuming):

    JASS:
    scope CustomFilter
    
    globals
        private real X
        private real Y
        private real RANGE
        private unit GB_U = null
        private group GB_G = null
        private integer GB_ID = 0
        private integer array GB_Filter
    endglobals
    
    private function IsUnitTypeElite takes unit u returns boolean
        return IsUnitType(u, UNIT_TYPE_ANCIENT) and IsUnitType(u, UNIT_TYPE_GIANT )
    endfunction
    
    private function IsUnitTypeChampion takes unit u returns boolean
        return IsUnitType(u, UNIT_TYPE_SAPPER) and IsUnitType(u, UNIT_TYPE_TAUREN)
    endfunction
    
    private function IsUnitInvisibleEx takes unit u, player p returns boolean //thank to Flare
        local real ux = GetUnitX(u)
        local real uy = GetUnitY(u)
        local boolean invisible = false
        if IsUnitFogged(u,p) or IsUnitMasked(u,p) then
            call SetUnitX(u, tj_VisibleCheckerX )
            call SetUnitY(u, tj_VisibleCheckerY )
            set invisible = IsUnitInvisible(u,p)
            call SetUnitX(u, ux)
            call SetUnitY(u, uy )
        else
            set invisible = IsUnitInvisible(u,p)
        endif
        return invisible
    endfunction
    
    private function CustomBoolExprFilter takes nothing returns boolean
        local unit f = GetFilterUnit()
        local boolean array b
        local boolean ok = true
        local integer i
        
        if GetUnitAbilityLevel(f,NoNeedToCheck)>0 then //units that have "NoNeedToCheck" ability will never be enumed
            set f = null
            return false 
        endif
        set b[0] = not IsUnitInGroup(f,GB_G)
        set b[1] = GetUnitAbilityLevel(f,GB_ID) == 0
        set b[2] = not IsUnitInvulnerable(f) //check 'Avul' and data to detect the "SetUnitInvulnerable"
        set b[3] = (IsUnitIllusion(f) == false)
        set b[4] = not ( GetUnitState(f,UNIT_STATE_MAX_MANA) == 0 )
        set b[5] = (IsUnitType(f,UNIT_TYPE_MELEE_ATTACKER)==true)
        set b[6] = (IsUnitType(f,UNIT_TYPE_GROUND)==true)
        set b[7] = (IsUnitType(f,UNIT_TYPE_DEAD)==false)
        set b[8] = IsUnitEnemy(f,GetOwningPlayer(GB_U))
        set b[9] = not IsUnitTypeElite(f)
        set b[10] = not IsUnitTypeChampion(f)
        set b[11] = (IsUnitType(f,UNIT_TYPE_HERO)==false)
        set b[12] = (IsUnitType(f,UNIT_TYPE_MECHANICAL)==false)
        set b[13] = (IsUnitType(f,UNIT_TYPE_STRUCTURE)==false)
        set b[14] = (IsUnitType(f,UNIT_TYPE_MAGIC_IMMUNE)==false)
        set b[15] = (IsUnitType(f,UNIT_TYPE_ETHEREAL)==false)
        set b[16] = (GetUnitAbilityLevel(f,tj_IsWardCheck)==0) //an ability that all wards has
        set b[17] = (IsUnitFogged(f,GetOwningPlayer(GB_U))==false and IsUnitMasked(f,GetOwningPlayer(GB_U))==false)
        set b[18] = (IsUnitInvisibleEx(f,GetOwningPlayer(GB_U))==false)
        
        set i = 0
        loop
            exitwhen i > 18
            if not ( ( GB_Filter<i> == 0 ) or ( (GB_Filter<i> == 1) and b<i> ) or ( (GB_Filter<i> == 2) and not b<i> ) ) then
                set ok = false
            endif
            set i = i + 1
        endloop
        set f = null
        return ok
    endfunction
    
    private function CustomBoolExprFilterTrue takes nothing returns boolean
        return true
    endfunction
    
    function CustomBoolExprGet takes unit ufilter,integer buffid, group gfilter, string filter returns boolexpr
        local integer i = 0
        if filter == &quot;&quot; or filter == null then
            return Condition( function CustomBoolExprFilterTrue )
        endif
        loop
            exitwhen i &gt; 18
            set GB_Filter<i> = S2I(SubString(filter,i,i+1))
            set i = i + 1
        endloop
        set GB_G = gfilter
        set GB_U = ufilter
        set GB_ID = buffid
        return Condition( function CustomBoolExprFilter )
    endfunction
    
    endscope</i></i></i></i></i></i>


    so, when I want to enum units that are: has 'B000' buff, not invulnerable , alive, enemy of unitA, non-structure, non-magic immue, non-ward
    I will get boolexpr: [ljass]CustomBoolExprGet( A, 'B000', null, "0110000110000110100" )[/ljass]

    I have once told that boolexpr ( conditional functions) must be optimized as much as possible, but it's inconvenient for me to create filter for each spell (or for each group enum) so I use this CustomFilter, it's convenient for me but is it good for the game ?
    (I don't really need "good", I only need "not bad" or even "not too bad" :) )


    [*] How to calculate the maximum height of an arc projectile ? the height that projectile will reach when it fired at X range and its arc=Y.
    e.g: I have a projectile fired at 1000 range and arc = 0.15 => what is the maximum height ?
    I think I have seen this function before but I can't remember when/where so I will just ask.


thank you for reading and for the (later) answers :D
 

Larcenist

REP: Respect, Envy, Prosperity?
Reaction score
211
For #3:

This is all assuming you have a projectile speed.

I can't really remember how WC3 handles arcs, but if I recall correctly an arc value of 1.0 gives somewhat of an 90-ish degree. I'll assume the angle based on arc is ARC_VALUE*bj_PI/2. This constant can be changed if different info is given.

Some simple physics formulas tell us the following:

x = Vx * t = V0 * t * cos(a)
y = V0 * t * sin (a) - g * t^2 / 2 (unless you use some custom gravity system this can be set to V0 * t * sin (a) to simplify things).

V0 = PROJ_SPD
a = ARC_VALUE * bj_PI / 2
t[end] = RANGE / (PROJ_SPD * cos(a)) (The time for the whole arc to finish)

The time we wish to use would then be the one it takes to reach halfway through the arc, t[end] / 2

t = RANGE / (2 * PROJ_SPD * cos(a))

y[max] can then be calculated using the above formula for y:

y[max] = PROJ_SPD * RANGE / (2 * PROJ_SPD * cos(ARC_VALUE * bj_PI / 2)) * sin (ARC_VALUE * bj_PI / 2)
 

Tom_Kazansky

--- wraith it ! ---
Reaction score
157
wow, kinda complex.... :eek:

I will see if I can understand these, thank anyways +rep :)
--
don't mind about 1) and 2)
  1. I do too much stuffs per period, yea, I'm just stupid
  2. now I decide to not lazy, i will write filter for each group enum
 

Zwiebelchen

You can change this now in User CP.
Reaction score
60
  1. I do too much stuffs per period, yea, I'm just stupid
  2. now I decide to not lazy, i will write filter for each group enum
Very wise. A filter system looping through a string is just plain BAD. The speed loss is absolutely NOT worth the saved time, especially if you take into account that string usage in wc3 is incredibly slow.


Just create your own naming convention for filters (so you do not need to check all the time wether you already have them) and fill up a custom library with all your filters, so you do not need to search in all your jass classes in order to find a particular one.

I recommend using "FilterUnitAliveAndP1" for example as naming convention, as it matches the way blizzard names their filters.
 

Happysmiley

New Member
Reaction score
22
He wanted an answer. Not a "I have AIDS and it's awesome.

I really was just saying this. I just started with JASS and it's to complicated for me and it seems to be vJASS, so whatever. Sorry :banghead:

I admit that the joke was unappropriate. Thanks though for the -6 rep :) No but seriously, as I didn't have any intelligent answer to his thread I thought, well, some attention is better than none, no?

And by the way, why would you assume I meant the disease and not the system?
 

Larcenist

REP: Respect, Envy, Prosperity?
Reaction score
211
Never once did he mention the disease. Regardless of which one you meant it provided nothing at all to the thread, which I personally think was what Chaos_Knight commented on.

As for Kazansky, figured I might point out that the Projectile Speed in question related to my previous post is (as most physics calculations) based on the SI-system, meaning it uses distance travelled per second and not interval. Might've been obvious but I decided to point it out regardless.
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • The Helper The Helper:
    The bots will show up as users online in the forum software but they do not show up in my stats tracking. I am sure there are bots in the stats but the way alot of the bots treat the site do not show up on the stats
  • Varine Varine:
    I want to build a filtration system for my 3d printer, and that shit is so much more complicated than I thought it would be
  • Varine Varine:
    Apparently ABS emits styrene particulates which can be like .2 micrometers, which idk if the VOC detectors I have can even catch that
  • Varine Varine:
    Anyway I need to get some of those sensors and two air pressure sensors installed before an after the filters, which I need to figure out how to calculate the necessary pressure for and I have yet to find anything that tells me how to actually do that, just the cfm ratings
  • Varine Varine:
    And then I have to set up an arduino board to read those sensors, which I also don't know very much about but I have a whole bunch of crash course things for that
  • Varine Varine:
    These sensors are also a lot more than I thought they would be. Like 5 to 10 each, idk why but I assumed they would be like 2 dollars
  • Varine Varine:
    Another issue I'm learning is that a lot of the air quality sensors don't work at very high ambient temperatures. I'm planning on heating this enclosure to like 60C or so, and that's the upper limit of their functionality
  • Varine Varine:
    Although I don't know if I need to actually actively heat it or just let the plate and hotend bring the ambient temp to whatever it will, but even then I need to figure out an exfiltration for hot air. I think I kind of know what to do but it's still fucking confusing
  • The Helper The Helper:
    Maybe you could find some of that information from AC tech - like how they detect freon and such
  • Varine Varine:
    That's mostly what I've been looking at
  • Varine Varine:
    I don't think I'm dealing with quite the same pressures though, at the very least its a significantly smaller system. For the time being I'm just going to put together a quick scrubby box though and hope it works good enough to not make my house toxic
  • Varine Varine:
    I mean I don't use this enough to pose any significant danger I don't think, but I would still rather not be throwing styrene all over the air
  • The Helper The Helper:
    New dessert added to recipes Southern Pecan Praline Cake https://www.thehelper.net/threads/recipe-southern-pecan-praline-cake.193555/
  • The Helper The Helper:
    Another bot invasion 493 members online most of them bots that do not show up on stats
  • Varine Varine:
    I'm looking at a solid 378 guests, but 3 members. Of which two are me and VSNES. The third is unlisted, which makes me think its a ghost.
    +1
  • The Helper The Helper:
    Some members choose invisibility mode
    +1
  • The Helper The Helper:
    I bitch about Xenforo sometimes but it really is full featured you just have to really know what you are doing to get the most out of it.
  • The Helper The Helper:
    It is just not easy to fix styles and customize but it definitely can be done
  • The Helper The Helper:
    I do know this - xenforo dropped the ball by not keeping the vbulletin reputation comments as a feature. The loss of the Reputation comments data when we switched to Xenforo really was the death knell for the site when it came to all the users that left. I know I missed it so much and I got way less interested in the site when that feature was gone and I run the site.
  • Blackveiled Blackveiled:
    People love rep, lol
    +1
  • The Helper The Helper:
    The recipe today is Sloppy Joe Casserole - one of my faves LOL https://www.thehelper.net/threads/sloppy-joe-casserole-with-manwich.193585/
  • The Helper The Helper:
    Decided to put up a healthier type recipe to mix it up - Honey Garlic Shrimp Stir-Fry https://www.thehelper.net/threads/recipe-honey-garlic-shrimp-stir-fry.193595/
  • The Helper The Helper:
    Here is another comfort food favorite - Million Dollar Casserole - https://www.thehelper.net/threads/recipe-million-dollar-casserole.193614/

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top