System Projectile System

Reaction score
341
I'm not sure if your system has it or not, or if it's relevant to a projectile system.

But what about detecting collision between objects, that included destructables and walls.
 

Viikuna

No Marlo no game.
Reaction score
265
You could save projectiles data struct to its UnitUserData and make somekind of GroupProjectilesInRange -function, so people can easily group projectiles and change their values.

( Like move speed, to make spells like Slow Time in Diablo 3 trailer. )

Also, use only one unit type for projectiles. Vexorians dummy model with attached effect is good. It also has Z angle animations, which are useful for 3d arrows and stuff..
 

Gwypaas

hook DoNothing MakeGUIUsersCrash
Reaction score
50
@Viikuna Maybe but if could also just use PUI and have an boolean array that sets to true for the projectiles upon creation.

It's up to the user if he wants to use the model since my system only takes a unit and then runs with that. If he wants to have a special dummy unit then he would just create it and attach the effects and then just modify it within the onLoop method.



@TriggerHappy This is not a physics system and if the user wanted to detect collisions then he would just code that into the onLoop method using whatever method he want.
 

Viikuna

No Marlo no game.
Reaction score
265
One dummy unit type allows you to use group all units of projectile unit type, with IsUnitInRangeXY to make GroupEnumProjectilesInRange..

Direct use of UnitUserData is better than PUI in this case, because these units are like private objects. ( Just make PUIs filter to ignore them, if you use PUI )

Also, your system should detect collinsion with unwalkable point and Extension library should have z angle calculations coded in it.

Also you should add homing missile support. ( xecollider has it and im planning to do it for my projectile system ) It couldt be an extending struct or something, so its easier for people to choose not to use it.

@TriggerHappy This is not a physics system and if the user wanted to detect collisions then he would just code that into the onLoop method using whatever method he want.

Physics systems do a lot more than detect collinsions. If you want this to be a projectile system, this should do everything that is needed for projectile usage. ( Add wrapper for IsTerrainWalkable, so people can choose which walkability check to use )
 

Gwypaas

hook DoNothing MakeGUIUsersCrash
Reaction score
50
> One dummy unit type allows you to use group all units of projectile unit type, with IsUnitInRangeXY to make GroupEnumProjectilesInRange..

Then it's up the user to code his map to work that way and then use this system for the movement.

> Direct use of UnitUserData is better than PUI in this case, because these units are like private objects. ( Just make PUIs filter to ignore them, if you use PUI )

It's not since maybe he want to use PUI based stuff on the projectile that is not coded into his struct, then his stuff would just completely fail.

> Also, your system should detect collinsion with unwalkable point

onLoop method ftw?

> Extension library should have z angle calculations coded in it.

This is a framework for creating projectiles, not a take everything that any user might ever use and put in system. If you want that then use Caster System.

> Also you should add homing missile support. ( xecollider has it and im planning to do it for my projectile system ) It couldt be an extending struct or something, so its easier for people to choose not to use it.

It's already added, check the "SlideTowardsUnit" extension.

> Physics systems do a lot more than detect collinsions. If you want this to be a projectile system, this should do everything that is needed for projectile usage. ( Add wrapper for IsTerrainWalkable, so people can choose which walkability check to use )

Still, onLoop method ftw?
 
Reaction score
341
I'm using your system for a spell, this is a rough version of it, please tell me if I did anything wrong.

I'm pretty sure it's leaking, I don't destroy the struct.

JASS:
scope ArrowStorm initializer InitTrig

globals
    private constant integer RAW_CODE = 'A002'
    private constant integer DUMMY = 'h000'
    private constant integer ARROW_COUNT = 50
endglobals

private function Conditions takes nothing returns boolean
    return GetSpellAbilityId() == RAW_CODE
endfunction

function GetSpellTargetLocX takes location l returns real
    local real r = GetLocationX(GetSpellTargetLoc())
    call RemoveLocation(l)
    return r
endfunction

function GetSpellTargetLocY takes location l returns real
    local real r = GetLocationY(GetSpellTargetLoc())
    call RemoveLocation(l)
    return r
endfunction

private function Actions takes nothing returns nothing
    local player p = GetOwningPlayer(GetTriggerUnit())
    local real x = GetSpellTargetLocX(GetSpellTargetLoc())
    local real y = GetSpellTargetLocY(GetSpellTargetLoc())
    local integer i = 0
    local unit u
    local Jump j
    loop
        exitwhen i == ARROW_COUNT
        set u = CreateUnit(p, DUMMY, GetUnitX(GetTriggerUnit()), GetUnitY(GetTriggerUnit()),0)
        call UnitApplyTimedLife(u, 'BTLF', 2)
        set j = Jump.create(u, true)
        call j.Jump(x, y, 10, 800)
        set i = i + 1
    endloop
endfunction

//===========================================================================
private function InitTrig takes nothing returns nothing
    local trigger t = CreateTrigger()
    call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition(t, Condition(function Conditions))
    call TriggerAddAction(t, function Actions)
endfunction

endscope
 

Viikuna

No Marlo no game.
Reaction score
265
Still, onLoop method ftw?

You know what this means? People just try to use this, end up coding everything in onLoop and decide to make their own projectile system, because all this does is moving units in different ways, which alone is useless.

It's not since maybe he want to use PUI based stuff on the projectile that is not coded into his struct, then his stuff would just completely fail.

He is already extending Projectile struct, he should code that stuff into struct. If these missiles cant be killed by anything else but the system, using PUI ( or any other indexing system ) is useless, not needed.

Just do: SetUnitUserData(projectile.unit, integer( projectile ))
 

Gwypaas

hook DoNothing MakeGUIUsersCrash
Reaction score
50
@Triggers first post:
You don't need to destroy it since:
JASS:
            if p.distLeft <= FINISH_THRESHOLD or p.end == true or b then
                if p.onReach.exists == true then
                    call p.onReach()
                endif
            
                call p.destroy() <--- Gets removed upon completion there.
                set Datas<i> = Datas[N]
                set N = N - 1
                if N == 0 then
                    call PauseTimer(T)
                endif
            else
                // Do the movement stuff
            endif
</i>


> I have a suggestion though, why don't you use PUI or UnitIndexingUtils to remove those O[N] searches?

I don't have any O[N] searches in the system.

> You know what this means? People just try to use this, end up coding everything in onLoop and decide to make their own projectile system, because all this does is moving units in different ways, which alone is useless.

It's alot easier to code something when you only need to add your own stuff, your code feels more personal and in the end it will be easier to search for errors.

> He is already extending Projectile struct, he should code that stuff into struct. If these missiles cant be killed by anything else but the system, using PUI ( or any other indexing system ) is useless, not needed.

Just do: SetUnitUserData(projectile.unit, integer( projectile )) (Quote ends here)



I will not limit the user in any way by forcing him to not use UnitUserData onto his projectiles, it should be up to the mapper himself to decide which way he wants to use it.
 

Viikuna

No Marlo no game.
Reaction score
265
Well, its your system, so you decide what you do to it.

But in its current state I would not use it, because its not complete, and I would have to add too much stuff to it.

Its a nice for moving units, but you rarely need to just move units, without having proper projectile methods.


And forcing user to use UnitUserData for missiles doesnt limit them in any way. If you can think any way it does, feel free to tell..
 
Reaction score
91
But then someone (like me) wouldn't use it because it would conflict with systems like PUI unless one edits the Proj system to fit his needs.
 

Viikuna

No Marlo no game.
Reaction score
265
Why would it conflict with PUI?
Doesnt PUI have somekind of filter for leaving dummies outside of the indexing system?

Using PUI for projectiles is just useless.. Direct use of UnitUserData makes it faster&simplier.
 

Gwypaas

hook DoNothing MakeGUIUsersCrash
Reaction score
50
> But in its current state I would not use it, because its not complete, and I would have to add too much stuff to it.

Much stuff? If you want everything go and use Caster System, Vexorian even updated it to use Timer- and Grouputils now.


>Its a nice for moving units, but you rarely need to just move units, without having proper projectile methods.

Give me one case where you need Walkability detection and Group Projectiles in range.

> And forcing user to use UnitUserData for missiles doesnt limit them in any way. If you can think any way it does, feel free to tell..

I will not limit the user to use PUI or any other indexing system in any way. That is the point of being system independence, it wouldn't be system indepence if you limited the user.

> Gwypaas, just make two versions, pui Dependant, and not.

I will not make two versions.

> Why would it conflict with PUI?
Doesnt PUI have somekind of filter for leaving dummies outside of the indexing system?

Using PUI for projectiles is just useless.. Direct use of UnitUserData makes it faster&simplier.

Still I will not limit the user in any way.
 

Viikuna

No Marlo no game.
Reaction score
265
I dont like caster system because it has too much stuff I dont need.

Still I will not limit the user in any way.

Using user data does not limit user, because user has no need to attach anything to missiles, because system should already handle that ( by using UserData ).

Walkability check is needed for missiles that for example, bounce of from the walls.

GroupEnumProjectilesInRange would be nice for spells like SlowTime. ( makes all missiles move really slow in target AoE )
 
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