Wc3C.net

Wc3C.net (http://www.wc3c.net/forums.php)
-   Systems (http://www.wc3c.net/forumdisplay.php?f=648)
-   -   xe0.9 (http://www.wc3c.net/showthread.php?t=101150)

Vexorian 06-27-2008 09:55 PM

xe0.9
 
5 Attachment(s)
Developed by Vexorian
Maintained by Anitarf
Current version: 0.9

The successor to the Caster System, xe is a collection of libraries primarily aimed at spell makers. The core of this system is the xebasic library and the all-purpose dummy unit that comes with it. The rest of the system are all optional modules, each one designed to provide a specific feature that is commonly needed in spell making such as dummy casters and various projectiles.
  • xepreload prevents the lag that occurs ingame when any ability is first added to a unit.
  • xedummy recycles dummy units to help optimize maps that rapidly create and remove such units.
  • xecast handles dummy casters so you don't have to, making it easier to cast spells with triggers.
  • xefx allows you to move, rotate, scale and recolor special effects by attaching them to dummy units.
  • xedamage provides a standardized interface for dealing and identifying triggered damage.
  • xecollider is a directional projectile that detects collisions with units in its path.
  • xemissile is a targeted projectile with arced trajectory, like standard Warcraft missiles.

Changelog


0.9: - Added xemissile.
- Added xedummy.
- xefx can now use xedummy to recycle dummy units.
- xepreload can now be used from struct initializers.
- Fixed a bug in xecast that would occur if recycledelay was shorter than
the duration of the spell cast by the dummy caster.
- Fixed a bug in xefx where hiddenReset did not properly assign the new fxpath.
- Optimized the xecollider collision detection.
- Fixed some errors in xefx and xecast documentation.
- new sample: Firestrike.
- Removed an xecast leak in the IllusionRune sample.
- Removed a handle id leak in SheepStaff sample.
0.8: - No longer let xecollider hit corpses...
- When xecollider misses targetUnit (the unit dies, it will stop homing and
keep going on its current direction).
- angleSpeed no longer implicitly makes rotation automatic unless there is homingm,
If you want rotation, set the boolean member rotation to true.
- xedamage: Added MAX_DAMAGE_FACTOR to prevent some deads, a debug message will
appear if the unit dies when being tested for a damage factor.
- xepreload: debug message when preloading an ability at a wrong time.
0.7: - Requires jasshelper 0.A.2.4 or greater.
- xepreload will now show an useful error when the ability does not exist
(in debug mode).
- xepreload may now use TimerUtils to recycle its timer if you happen to have
TimerUtils in the map.
- xecast automatically resets mana and cooldown for the dummy before making it
cast stuff. If this behaviour concerns you, you may disable it through a
constant.
- Added targetUnit, setTargetPoint and forgetTarget to xecollider's
documentation.
- Added abilityLevel to xefx.
- Fixed a mistake in xefx's documentation that said "copy the xecast trigger"
- xedamage: Added a constant FACTOR_TEST_DAMAGE, which allows you to set the
amount of damage to do when testing for damage...
- xedamage: Added an isDummyDamage event response boolean to detect test
damages.
- xedamage: Added a lot of things to documentation about the issues with armor.
- xedamage: fx is for sure not shown when there is no damage.
- xefx: added hiddenDestroy and hiddenReset
- new sample: Chains of fire.
0.6: - The demo map is playable in patch 1.24.
- Only the samples and demomap system needed to be updated, xe's libraries themselves have not changed.
0.6: - allowedTarget does not perform damage on ignored damage/attack types.
- fixed a bug inside a commented out line in FireNovaStrike.
- xecollider.terminate should work correctly outside of onHit events.
- removed safeMove method that did nothing from xefx
- xefx can now optionally use ARGB's ARGBrecolor module.
0.5: - xecollider.terminate now prevents events from firing.
- fixed a unit handle index kidnap in inRangeEnum (xecollider).
- fixed a small documentation bug about xecollider.terminate
- xecast's anti-AI protection now pauses the unit instead of removing the
ability (since that seemed to have bad side effects)

- xecast is now able to deal with units not visible to the player by setting
a constant to true.
- Due to technical split, xecast.castOnTarget now only takes unit and not
widget, old castOnTarget that takes widget has been renamed castOnWidgetTarget.
- xecollider now will not miss the detection of certain units that get inside
the range too fast anymore, however now creates a group per collider (damn) I
hope to find a better solution.
- Added a notice in xepreload's documentation about order events firing during
the preload.
- Added gem of double green fire
0.4: - More documentation fixes.
- xecast no longer has double frees when using create/Basic/A and the
AOE/group methods.
- damageDestructablesInAOE now actually works and does not leak a xedamage
reference.
- damageTarget now returns true if it was succesful and false if it wasn't.
- xefx's recycle bin now extends array.
- added rune of illusions sample.
0.3: - More documentation fixes.
- xefx requires xebasic in the library declaration (as it was supposed to)
- xefx now creates the effects at the correct place (used to consider pathing
during creation for some reason).
- xebasic sample uses 197.0 for max collision size since that's the default in
warcraft 3 (The default + 1)
- xebasic now includes an explanation for max collision size and its effects.
- added useSpecialEffect to xedamage
- included BoundSentinel
- added xecollider
- xedamage's required unittype field is not ignored anymore.
- Added the fireNovaStrike example.
0.2: - Fixed a bug with xecast.castInPoint basically ignoring the arguments.
- Fixed a bug with xecast.createBasic ignoring the order id.
- Fixed documentation bugs.
- Added xedamage.
- Added sheep staff sample.
0.1 : Initial release


darkwulfv 06-27-2008 10:02 PM

So if that small snip of code is the entire system... then how does this work, and what makes it great?

Vexorian 06-27-2008 10:06 PM

Since when are systems supposed to be great? Anyway THE system is 20% code, 50% a dummy model and 30% an object editor 'unit'

Here-b-Trollz 06-27-2008 10:39 PM

YAY!!!!

I never did enjoy the caster system just because of how ungainly it was. Simplicity, modularity, efficiency wins.

Excited to see this, though I probably won't use it. I've always liked the idea of every spells' scope containing absolutely everything that the spell needs to function. It just makes things so much easier.

Either way, more power to ya :emote_thumbup:

EDIT: I hate myself for making this post. Somebody kick me in the face.

darkwulfv 06-28-2008 12:12 AM

I just wanted to know what this did. I can hardly tell by the spell code, it just contains a little bit of constant data.

I do like that it is simple. CS was really big and hard to use.

Vexorian 06-28-2008 12:41 AM

Yes, I need better samples, I haven't made them yet since object editing is a little tiresome on WINE:

Most people may find it more complicated than the caster system, because of the rather alien way to use it, this is the xecast module:

Collapse JASS:
 local xecast mp = xecast.createA()
    set mp.abilityid='Ahpm' //let's say this is polymorph's rawcode, ok?
    set mp.orderstring="polymorph"
    set mp.owningplayer = GetOwningPlayer(GetTriggerUnit())
    call mp.castOnAOE(x,y,radius)

Now, what I wanted is more flexibility and things that look similar, this casts AOE polymorph on various points:



Collapse JASS:
 local xecast mp = xecast.create()
    set mp.abilityid='Ahpm' //let's say this is polymorph's rawcode, ok?
    set mp.orderstring="polymorph"
    set mp.owningplayer = GetOwningPlayer(GetTriggerUnit())
    call mp.castOnAOE(x,y+500.0,radius)
    call mp.castOnAOE(x-500.0,y,radius)
    call mp.castOnAOE(x,y,radius)
    call mp.castOnAOE(x-500.0,y-500.0,radius)
    call mp.destroy()

The real deal is that you don't need to keep creating stuff and worry about struct 'leaks'



Collapse JASS:
globals
    private xecast mp
endglobals

//.. on init
   set mp = xecast.create()
    set mp.abilityid='Ahpm' //let's say this is polymorph's rawcode, ok?
    set mp.orderstring="polymorph"


// later:
    set mp.owningplayer = GetOwningPlayer(GetTriggerUnit())
    call mp.castOnAOE(x,y+500.0,radius)
    call mp.castOnAOE(x-500.0,y,radius)
    call mp.castOnAOE(x,y,radius)
    call mp.castOnAOE(x-500.0,y-500.0,radius)

What if you want to target a unit group instead? you keep everything and just replace mp.castOnAOE(x,y,radius) with mp.castOnGroup(g) ,

And when all the modules are done, it will probably get larger than the caster system. Though very few people will have to implement them all.

And... spells with embedded systems are an abomination, not something 'good' it is terrible and no reason for pride.

I don't really like how xecast works right now, xefx on the other hand...

Here-b-Trollz 06-28-2008 02:14 AM

actually, that's not alien at all really. that's just making awesome use of methods. actually that looks really awesome. load up the module with everything it needs to know, and then tell it what actions to run - a very dynamic, open style to coding, and I like it.

Switch33 06-28-2008 04:25 AM

Why not change xecast to being a cast module to more or less a group module as in-- using group functions with being able to set the functions that effect picked units with? I think it would have a lot more uses.
(Also i never really got the idea of making a spell that casts more spells it just sounds odd and inefficient, as you could just do the effect of the spell and avoid having to use a caster to cast it at all. The only real reason you would use such a thing would be for having single target spells dealt to a group, and that could even be handled in a picked unit function also.)

Another thing, why would you ever do separate location and x/y functions(so you could use both)? It's only a few lines of code to transfer into just x and y. Isn't it better just to always use x and y than a location?
(Although i remember hearing locations transfer faster between functions; i also think i remember hearing that x/y is faster in functions. And i think the x/y won better in performance either way.)

Below is taken from exfx documentation;
Quote:

________________________________________________________________________________
player owner
----
For some reason you might want to change ownership of the effect, for
example, if you use abilityid (see bellow) and the ability does damage.

Example: set myfx.owner = GetOwningPlayer(GetTriggerUnit() )

________________________________________________________________________________
player owningplayer
----
The player that owns the spell (Who gets credited for it)
Example: set somevar.owningplayer = Player(2)

These should be the same thing... (If not it's just too weird having one player deal the damage and another player get the rewards.)


Quote:

________________________________________________________________________________
playercolor teamcolor
----
The recycle delay is the time to wait before recycling the dummy caster, if
it is 0.0 the ability will be considered instant.

A proper recycle delay is important since when a dummy caster is recycled
its owner becomes player passive. Every damage done by the casted spell will
not credit the correct player.

Some other spells need some time in order to cast correctly. Not to mention
the channeling ones that require the caster to last during that situation.

Example: set somevar.recycledelay=10.0
And.. This doesn't explain what the playercolor teamcolor setting is for...

Themerion 06-28-2008 07:09 AM

Since you always want to set an orderstring and an ability id (and since you are not very likely to do it multiple times for the same xecast), I think it would be justified to shape the create method like method create takes integer abi_id, string order returns xecast which would save 2 lines of code for each spell, making it look cleaner. Does only cost 1 extra function call/spell, and that's at map init.

Vestras 06-28-2008 07:10 AM

in the xepreload trigger, don't you need a PauseTimer(..) and a nulling when destroying?

Vexorian 06-28-2008 05:57 PM

It is not necessary to pause non-periodic timers, There is also nothing to null as I am not using a variable there.

Themerion:

Collapse JASS:
    //========================================================================================================
    // you are always allowed to use .create() but you can also use createBasic which sets some things that
    // are usually necessary up.
    //
    public static method createBasic takes integer abilityID, integer orderid, player owner returns xecast
     local xecast r=xecast.allocate()
        if(r==0) then
            debug call BJDebugMsg("Warning: unbelievable but you actually used all xecast instances in your map! Please make sure you are not forgetting to destroy those what you create intensively, if that's not the case, then you'll have to increase xecast MAXINSTANCES")
        endif
        set r.abilityid=abilityID
        set r.owningplayer=owner
     return r
    endmethod
Though I should probably add an orderstring version, people like orderstrings for some reason.

Switch: That's an error with xefx's documentation, I was using xecast's as a template and it looks I left some garbage there

fixed?:

xefx
----
  This module just allows you to have movable special effects, they are actually
 dummy units, you can do plenty of things like changing their position, their
 height, their rotation (in the xy and in the z axis as well), color, and things
 like that. It is all about assigning attributes, the only two important methods
 xefx objects have are create and destroy. There are other accessory methods.
 
implementation
--------------
  Just copy the xecast trigger to your map.
 
xecast object
-------------

__________________________________________________________________________________________________
  static method create    takes real x, real y, real facing returns xefx
--
  This is the create method, it will make a new xefx for you to use, there are
 initial values you must specify, like the x,y coordinate and the facing angle.
 facing is in radians.

  Eg. set myfx = xefx.create()
__________________________________________________________________________________________________
  method destroy  takes nothing returns nothing
--
  This just destroys your xefx object. (call myfx.destroy() )

* List of attributes *

________________________________________________________________________________
    string fxpath
----
    Determines the model of the special effect, yes, you may  change it after
 assigning it if necessary to change the model path.
   
    Example: set myfx.path = "abilities\thisisamadeup\modelpath.mdl"

________________________________________________________________________________
    real x
    real y
    real z
----
    Determine the position of your special effect, you can keep moving the
  effect in a periodic loop, etc.
   
    Example: set myfx.x=myfx.x + 65.0
            set myfx.y=GetUnitY(u)
            set myfx.z=JumpParabola(t)
           
________________________________________________________________________________
    real xyangle
----
    The angle in the xy plane, also called 'facing' angle. (Note: uses radians)
   
    Example: set myfx.xyangle = AngleBetweenPoints(target, source)*bj_DEGTORAD
   
________________________________________________________________________________
    real zangle
----
    The angle in the z-axis (inclination?), (Note: uses radians)
   
    Example: set myfx.zangle = bj_PI/2 //Now the model will look towards the sky

 
________________________________________________________________________________
    integer r
    integer g
    integer b
    integer a
----
    Well, the model's vertex coloring in RGB , a is the opacity value (use
 values from 0 to 255 here)
   
    Example: set myfx.r=255
            set myfx.g=0
            set myfx.b=255
            set myfx.a=128
           
______________________________________________________________________________________
    method recolor takes integer r, integer g , integer b, integer a returns nothing
----
    This one assigns all the color values in one pass.

________________________________________________________________________________
    real scale (write-only)
----
    Allows you to resize the xefx object, the default scale is 1.
   
    Example:  set myfx.scale=2.0 //double size (in fact 8x)
              set myfx.scale=0.5 //half size  (in fact 1/8x)
________________________________________________________________________________
    player owner
----
    For some reason you might want to change ownership of the effect, for
  example, if you use abilityid (see bellow) and the ability does damage.
 
    Example: set myfx.owner = GetOwningPlayer(GetTriggerUnit() )
________________________________________________________________________________
    integer abilityid
----
    Well, you may use a xefx object to grab a passive ability, perhaps you need
    it for ye candy reasons or you want to use it as a damage dealer.

        Example: set myfx.abilityid = 'Hphf'
________________________________________________________________________________
    playercolor teamcolor
----
    The recycle delay is the time to wait before recycling the dummy caster, if
    it is 0.0 the ability will be considered instant.
   
    A proper recycle delay is important since when a dummy caster is recycled
    its owner becomes player passive. Every damage done by the casted spell will
    not credit the correct player.
   
    Some other spells need some time in order to cast correctly. Not to mention
    the channeling ones that require the caster to last during that situation.

        Example: set somevar.recycledelay=10.0
 
________________________________________________________________________________
    method flash          takes string modelpath returns nothing
----
    It shows the dead animation of the model specified by modelpath. This is
    in case you need this sort of eye candy.
   
   
   


Quote:

(Also i never really got the idea of making a spell that casts more spells it just sounds odd and inefficient, as you could just do the effect of the spell and avoid having to use a caster to cast it at all. The only real reason you would use such a thing would be for having single target spells dealt to a group, and that could even be handled in a picked unit function also.)
The truth is that blizz spells are always going to be more efficient than you coding the effects yourself, there are also many things where dummy casters is just nice. Also your suggestion about groups is not something I agree with, mostly because I think, we should stop using groups that much, I also think a planned vJass feature would make such system unnecessary.

Here-b-Trollz 06-28-2008 06:06 PM

The most we ever really need out of a group is:

Collapse JASS:
private function Enumer takes nothing returns boolean
    call DamageUnit(GetFilterUnit())

    return false
endfunction

//...

call GroupEnumUnitsInRange(DummyGroup,x,y,radius,Filter(function Enumer))

That, and if we want to tag units in perhaps a spell that deals damage in a line, so they aren't hit more than once.


Awww.... Table is just a more robust form of gamecache. Cute :> I have to agree that gamecache is awesome, and now, with tables, you've given us arrays that have any size. Kewl.

Themerion 06-28-2008 10:26 PM

Ah, createBasic is what I wanted, yes.

Shouldn't you add a debug keyword for the if-statement too?

Vexorian 06-28-2008 10:32 PM

I think it needs a return 0

Flame_Phoenix 06-30-2008 11:43 AM

Hey, isn't this one of the spells you used on your dragon hero on the hero contest ?
Looks great !
mmm, why call it xe ? xD


All times are GMT. The time now is 04:35 AM.

Powered by vBulletin (Copyright ©2000 - 2018, Jelsoft Enterprises Ltd).
Hosted by www.OICcam.com
IT Support and Services provided by Executive IT Services