Spell FarSightBJ

Bribe

vJass errors are legion
Reaction score
67
Fair enough.

Then I don't get why you are not using just using a customized dust of appearance, plus a fogmodifier. Because the dust of appearance sets a unit detected without making it completely visible.

You could make a dust of appearance with max predicted radius, for example, with a custom buff. And pick all units in that radius and remove the buff if they are not in the dynamic range. That's one, simple way to do it.

Although it still would not be modular enough to be a system, it could at best be a spell.
 

Sgqvur

FullOfUltimateTruthsAndEt ernalPrinciples, i.e shi
Reaction score
62
Ok an update:

1. Now uses a multiplayer compatable/sync TSA aka PolledWait with nulled timer.
2. Also uses the proposed method by Bribe for invisible detection [tnx =) Bribe] and his optimization for only creating 1 rect and just "spamming"/using SetRect.
3. It now uses 1 xecast instance which could be thought as an optimization as well.
 

Bribe

vJass errors are legion
Reaction score
67
You do this whole thing completely overkill and it bugs.

Dust of Appearance with collision 32 could affect flying air units above, for example.

Is its buff really hardcoded? That's quite depressing. So even removing the buff from unwanted units == false.

You don't need a region and a bunch of rects in this, better to just use a periodic group enum check, say every 0.5 seconds should be enough for this one.
 

Sgqvur

FullOfUltimateTruthsAndEt ernalPrinciples, i.e shi
Reaction score
62
Bribe:
1. Dust of Appearance with collision 32 could affect flying air units above, for example.
2. You don't need a region and a bunch of rects in this, better to just use a periodic group enum check, say every 0.5 seconds should be enough for this one.
3. So even removing the buff from unwanted units == false.
4. You do this whole thing completely overkill and it bugs.

1. Well after a copy of Dust of Appearance ability is made it's pretty easy to change the targets allowed.
2. I don't think so. It would be inaccurate and slower.
3. I've never seen the detected buff being used in any UMS map, so I don't think this is a problem.
4. Bugs?
 

Bribe

vJass errors are legion
Reaction score
67
Note that "bugs" came right before saying how the AoE will be able to hit air units above it. But now that I think of it this is not such a problem.

I don't know where you get the idea that your way is faster. Periodic group enum with a FirstOfGroup loop every 0.5 seconds is pretty efficient, uses no pointless regions, rects, triggers, conditions, and does not need to remove/destroy any of them, making it wicked light on RAM as well. If you are worried about the accuracy even with something as easy and infrequeent as a simple "reveal" then lower the timer a little bit.

This isn't wc3c.net where you need to use huge bulky waste of space systems to do a simple cast, you could use DummyCaster by Jesus4Lyf, for example, which fits better for TheHelper.net people.
 

Dirac

22710180
Reaction score
147
Offtopic:
Out of plain curiosity, is it FirstOfGroup really faster than common ForGroup or EnumGroup calls? are unit arrays even more faster than groups?
 

Bribe

vJass errors are legion
Reaction score
67
ForGroup and Enum filters open up new threads, and new threads are incredibly expensive operations. If you insist on using a filter or a for group or a FirstOfGroup loop, then choose one of the three. But FirstOfGroup is best because it gives you access to locals without re-declaring them, does not open up a new thread...

We do need some FPS benchmarks to show the speed difference, however.
 

Dirac

22710180
Reaction score
147
Benchmark Time (groups with 8 units inside)
JASS:
scope Tests
    // 24 - 27 fps
    private struct Main extends array
        private static method period takes nothing returns nothing
            local group g
            local unit u
            local integer i=150
            loop
                exitwhen 0==i
                set g=CreateGroup()
                call GroupEnumUnitsInRange(g,0,0,600,null)
                loop
                    set u=FirstOfGroup(g)
                    exitwhen null==u
                    call GroupRemoveUnit(g,u)
                endloop
                call DestroyGroup(g)
                set i=i-1
            endloop
            set g=null
            set u=null
        endmethod
        private static method onInit takes nothing returns nothing
            call TimerStart(CreateTimer(),0.005,true,function thistype.period)
        endmethod
    endstruct
endscope
JASS:
scope Tests
    // 5 fps - crashes
    private struct Main extends array
        private static method enum takes nothing returns boolean
            return false
        endmethod
        
        private static method period takes nothing returns nothing
            local group g
            local integer i=150
            loop
                exitwhen 0==i
                set g=CreateGroup()
                call GroupEnumUnitsInRange(g,0,0,600,Filter(function thistype.enum))
                call DestroyGroup(g)
                set i=i-1
            endloop
            set g=null
        endmethod
        private static method onInit takes nothing returns nothing
            call TimerStart(CreateTimer(),0.005,true,function thistype.period)
        endmethod
    endstruct
endscope
Proof that FirstOfGroup is actually faster
 

Bribe

vJass errors are legion
Reaction score
67
That looks pretty reasonable, logically.

I wonder what it would be like for a lower number of units? I'm sure it'd be consistently faster though.
 

tooltiperror

Super Moderator
Reaction score
231
No.

I see no reason to use this over Far Sight ability, and maybe some triggered enhancements. For your Day/Night Dilemma, you can use 2 different abilities and swap them at day and night. This library is massive overkill, and "BJ", as Dirac pointed out, is Blizzard Jass.

Graveyarded.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      • Ghan
        Administrator - Servers are fun

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top