System Projectile

Kenny

Back for now.
Reaction score
202
What do you mean hardcoded timer loops being slower than T32???

I meant regular timer loops. Like the ones that use an array and counter, not the ones that Jesus4Lyf implemented into T32. Of course a timer loop using T32's method will be the same as T32. But it will be just that, the same.

I find little point in removing a perfectly good system from the requirements. It is like saying that TimerUtils is redundant because every system that needs timers should have its own timer recycling and data attaching mechanisms built in.

I have already removed AutoFly in an internal build for the next version. There is no efficiency gain in doing so, but since you were so diligent in arguing your point, I gave in.

I don't think I will be removing ListModule though. I know how to write my own linked lists (I wrote ListModule) but I find that ListModule does an excellent job (Plus it saved me something like 20-25 lines of code, and makes it so that I don't have to have public struct members that could be misused by users.
 

Sevion

The DIY Ninja
Reaction score
413
Actually, my method is, in fact, a bit more efficient than T32. T32 doesn't pause its timer when there are no instances to work with.

I'm not saying that you should remove it. It's merely a suggestion. I only say to remove systems that will both add efficiency and not bulk up code. The hardcoded timed loop isn't exactly a bulky addition. Besides, it's basically the same in the end.

Actually, there is an efficiency gain in removing AutoFly. Instead of it slapping fly onto every single unit in the game, it only slaps it on projectiles.

Either way, removing or keeping ListModule doesn't really make a difference.
 

Kenny

Back for now.
Reaction score
202
I talked with Jesus4Lyf about the timer issue with T32. He said that having the periodic timer run even when there is nothing to use it with equates to a few [ljass]DoNothing()[/ljass] calls every iteration.

He said he came to the conclusion that not using a timer would be more efficient for the system as a whole as it decreases the work done when adding and removing instances from the list (no checking if the timer is running and stuff). The overhead made from those functions during adding and removing seemed to out way the [ljass]TriggerEvaluate()[/ljass] that was used each iteration (which is nothing really when you think about how much crap goes on in a game every second).

At least I think he said something like that. I also think he talks about it in his T32 thread.

Anywho, thank you heaps for your suggestions. They have been thought over quite thoroughly and I am actually willing to get rid of AutoFly and GroupUtils in the next version (replacing them with a couple of lines of code and a normal group respectively).
 

Kenny

Back for now.
Reaction score
202
Version 0.2.2 (Beta) released.

  • Version 0.2.2 (Beta): Added features and removed requirements.
    • Removed AutoFly as a requirement.
    • Removed GroupUtils as a requirement.
    • Added Recycle as an optional requirement.
    • Added distance retrieval operators, including: this.distanceMax, this.distanceLeft and this.distanceDone (all of which will only calculate distance in a straight line on the X and Y axes).
    • Added two new public members: this.timeScale and this.timedLife.
    • Renamed .expireOnReach to this.expireOnTimeUp to better represent what it does.
    • Added an new parameter to this.setTargetPoint() to set a projectile’s new facing direction instantly. This is only a test run so far.
    • Updated documentation to include all changes (plus some things I forgot).
    • Various small changes to the system script.

Could a moderator please put this back into the submissions forums for further feedback?
 

Sevion

The DIY Ninja
Reaction score
413
PM a mod :p

You should also allow a global timeScale option in the case anyone ever wants to do some kind of global slow/speedup spell with this.

Will take a look at the code soon. I'm playing Alien Swarm with my buddies and awaiting my SC2 :D
 

Kenny

Back for now.
Reaction score
202
You should also allow a global timeScale option in the case anyone ever wants to do some kind of global slow/speedup spell with this.

You mean like:

JASS:
library SlowAllProjectiles initializer OnInit

    globals
        private constant integer ABIL_ID = 'A000'
    endglobals

    private function SlowProjectiles takes nothing returns nothing
        set EnumProjectile.timeScale = 0.25
    endfunction

    private function Actions takes nothing returns boolean
        local unit cast = GetTriggerUnit()

        if GetSpellAbilityId() == ABIL_ID then
            call TEMP_PROJGROUP.enumNearby(0.00,0.00,0.00,10000.00)
            call TEMP_PROJGROUP.forGroup(SlowProjectiles)
        endif    
    
        set cast = null

        return false
    endfunction
    
    private function OnInit takes nothing returns nothing
        local trigger trig = CreateTrigger()
        call TriggerRegisterAnyUnitEventBJ(trig,EVENT_PLAYER_UNIT_SPELL_EFFECT)
        call TriggerAddCondition(trig,Condition(function Actions))
    endfunction
    
endlibrary


I think that would work.

'm playing Alien Swarm with my buddies and awaiting my SC2

Nice.
 

Maapik

New Member
Reaction score
3
Just a random suggestion :p
You could also allow users to make projectiles collide on terrains that don't allows Air Units to pass (Air Pathing Blocker, for example). It's easy then destructible, since you could just change trees' pathing to Pathing Blocker (Both), then and place some Pathing Blocker (Air) or (Both) on cliffs and doodads :thup:
 

Kenny

Back for now.
Reaction score
202
Thanks Jesus4Lyf. I think I will be making another small update to this pretty soon (whenever I can get on a computer with a wc3 editor).

Changes will be something like this:

  • Version 0.2.3 (Beta): Minor updates and added features.
    • Added three new methods: [ljass]this.hitUnit()[/ljass], [ljass]this.isUnitHit()[/ljass] and [ljass]this.preserveUnit()[/ljass].
    • Above methods were added for system completeness. Read documentation for reasons.
    • Made it so that projectiles still collide with destructables even when paused.
    • Cleaned up some parts of the system script.
    • Updated documentation.

So the three new methods are used to manually add and remove units from the 'already passed through' group of a projectile (the groups that stores units that have already been hit by the projectile so that they aren't hit again). Some of you may think that these are completely unnecessary, but I believe that they do have their uses and deserve a spot in the projectile API.

I am thinking of renaming [ljass]this.hitUnit()[/ljass] to [ljass]this.addUnit()[/ljass] and [ljass]this.preserveUnit()[/ljass] to [ljass]this.removeUnit()[/ljass]. Still thinking of another name for [ljass]this.isUnitHit()[/ljass]. I don't like the word 'hit' in them..
 

Kenny

Back for now.
Reaction score
202
I haven't been able to get to a computer with wc3 editor yet, but the next update should be coming soon. :)

@ Tom_Kazansky:

Yeah that seems like a pretty logical idea to me. Thanks for your imput, I will probably be changing it to that when I can.

More feedback and comments please.
 

Kenny

Back for now.
Reaction score
202
The test map doesn't work because there is no recycle?

Recycle is optional, therefore the map should work with or without it. I have been using the map just fine without it, so there should be no problem.

Oh and it looks like I will be able to update this some time today. :D

Edit:

New version (v0.2.3) is now up. Check change log for changes (they are similar to what I posted above).
 

Tom_Kazansky

--- wraith it ! ---
Reaction score
157
@Kenny, I'm playing around with v0.2.2
and with the Defend ability, I want it to reflect the projectile back to the... attacker, so I change the code of the Defend a little:

JASS:
//   private function OnImpact takes nothing returns nothing

    if GetRandomReal(0.00,1.00) <= CHANCE then
            if not Grps[j].isInGroup(p) then
                set p.targetUnit = p.sourceUnit
                set p.sourceUnit = d.cast
                call DestroyEffect(AddSpecialEffectTarget("RandomSlash.mdl",d.cast,"origin"))
                call Deflector.create(d.cast,a * bj_RADTODEG)
            endif
        endif


but the projectile's flying path when it's reflected is different from when it's launched

reflectprojectile.jpg


blue arc: flying path when the projectile is launched
red arc: flying path when the projectile is reflected

is this a bug or I have missed some options?

p.s: do you know the creator of the RandomSlash model? I wanna use that too :D
 

Kenny

Back for now.
Reaction score
202
Thanks for finding that out.

It really isn't a bug, it is just how the projectile arc movement works. You would need to reset the projectile to get the correct arc for it..

I think I will add a method to reset a projectile so that it can be launched again.

I might also add a readonly member that retrieves the arc size that was used for a projectile.

Oh and the RandomSlash model was made by Callahan, but it had a horrible sound attached to it, so I edited it and removed the sound.

Edit:

  • Version 0.2.4 (Beta): Minor updates and added features.
    • Added two new general methods: [ljass]this.refresh()[/ljass] and [ljass]this.removeAll()[/ljass]. Read documentation for details.
    • Added projectile data attachment. Basically just hashtable wrappers, but they give an easy interface for storing extra data in a projectile.
    • Data attachment methods: [ljass]this.attachData()[/ljass], [ljass]this.getData()[/ljass], [ljass]this.hasData()[/ljass] and [ljass]this.detachData()[/ljass]. Details in documentation.
    • Removed some unneeded multiplications, divisions and variable sets/retrievals in the periodic method (tiny, tiny efficiency increase).
    • Added safety to [ljass]this.addUnit()[/ljass] and [ljass]this.removeUnit()[/ljass].
    • Added [ljass]this.arcSize[/ljass] as a readonly member to retrieve a projectiles arc size when it was created.
    • Renamed [ljass]this.setTargetPoint()[/ljass] to [ljass]this.setTargPoint()[/ljass] and [ljass]this.setProjectilePoint()[/ljass] to [ljass]this.setProjPoint()[/ljass].
    • Added a user event for when a projectiles timed life expires ([ljass].onExpire[/ljass]). This allows for some pretty cool things to be done.
    • The user event for when a projectile hits the ground will only when it first hits the ground, not repeatedly as it use to.
    • Inlined a method used in the core of the system for a small efficiency gain.
    • Added a max projectile limit and max projgroup limit (8190 each) for the sake of it. They will never need to be changed.
    • Completely rewrote projgroups. Same interface, just more efficient. There is now no limit to how many projectiles can be in a projgroup.
    • Changed around the [ljass].projectNormal()[/ljass] and [ljass].projectArcing()[/ljass] methods to make them neater and work properly with [ljass].refresh()[/ljass].
    • Added two more configurables for the max projectile and projgroup limits. Again, these won't need to be changed.
    • Renamed [ljass].projectileSpeed[/ljass] to [ljass].currentSpeed[/ljass].
    • Cleaned up some parts of the system script.
    • Updated documentation.

The next version will look something like that..
 

xAnaMorphine

Active Member
Reaction score
43
Line 2079: Missing requirement: optional (libraries cannot require scopes)

wha.. why? - I am Blonde.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      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