wc3campaigns
WC3C Homepage - www.wc3c.netUser Control Panel (Requires Log-In)Engage in discussions with other users and join contests in the WC3C forums!Read one of our many tutorials, ranging in difficulty from beginner to advanced!Show off your artistic talents in the WC3C Gallery!Download quality models, textures, spells (vJASS/JASS), systems, and scripts!Download maps that have passed through our rigorous approval process!

Go Back   Wc3C.net > Resources > Code Resources > Systems
User Name
Password
Register Rules Get Hosted! Chat Pastebin FAQ and Rules Members List Calendar



Reply
 
Thread Tools Search this Thread
Old 07-19-2007, 05:09 PM   #1
Anitarf
Procrastination Incarnate


Development Director
 
Join Date: Feb 2004
Posts: 8,028

Submissions (19)

Anitarf has a brilliant future (883)Anitarf has a brilliant future (883)Anitarf has a brilliant future (883)Anitarf has a brilliant future (883)Anitarf has a brilliant future (883)Anitarf has a brilliant future (883)Anitarf has a brilliant future (883)Anitarf has a brilliant future (883)

2008 Spell olympics - Fire - SilverApproved Map: Old School Alliance TacticsHero Contest #2 - 3rd PlaceSpell making session 2 winner

Default ABuff System

Click image for larger version

Name:	ABuffSystem_Thumbnail_New.jpg
Views:	1003
Size:	7.2 KB
ID:	46623

Update log:
12. 8. 2007: v1.2
20. 3. 2008: v1.3
24. 9. 2008: v1.4
19. 11. 2009: v1.5
26. 7. 2010: v1.6
21. 8. 2010: v1.7
18. 6. 2011: v1.8
15. 1. 2012: v1.9
17. 7. 2012: v1.9b
ABuff system

The ABuff system was designed to provide a framework within which all kinds of triggered buffs can be created. Buffs can be made to respond to all sorts of events, including custom user-defined ones, thus allowing for interactions with map-specific gameplay mechanics. Custom user data can be attached to both buff types and specific buffs to make sure that the ABuff engine does not represent a limiting factor in buff design.

The system was developed to support and promote the creation of interesting new buff spells, in hope that this will lead to new, more exciting gameplay in established map genres. Use your creativity.

Version 1.8 was developed using the NewGen editor v5d with JassHelper 0.A.2.B.

Required libraries:|
|
|
|
|
|
System components:
  • ABuff
  • ABuffDisplay
  • ABuffDispel
  • ABuffStruct
  • ABuffHeroSkill
  • ABuffSpell
  • ABuffItem
  • ABuffAura
|
|
|
|
|
|
Acknowledgements:
  • Thanks to Vexorian for creating vJass and to all the people
    who have contributed to the NewGen editor.
  • Thanks to Vexorian and PipeDream for helpful suggestions
    provided during the system's design phase.
  • Thanks to other users of wc3campaigns.net for their input.
Changelog

Version 1.9b
- Fixed a bug in ABuffDisplay that could result in the display ability not being preloaded correctly.

Version 1.9
- Fixed a bug in ABuffDispel that would cause it not to work.
- Fixed a bug where an aBuff could get destroyed twice when a unit died.
- Fixed a bug where new buffs could be added on dying units and would then never get removed.
- ABuff can now use .evaluate instead of .execute to run its event callbacks.
- Made minor optimizations to the ABuffAura library.


Version 1.8
- Fixed a bug in ABuffAura where updating the level of the aura did not update the aura buffs.
- Fixed ABuffHeroSkill and ABuffItem to optionally use AutoEvents instead of the old StatusEvents.
- The AutoIndex version of ABuff will no longer attempt to create buffs on units that are not indexed.

Version 1.7
- Moved ABuff from Table to AutoIndex, the old Table version is still supported.
- Fixed a bunch of bugs in ABuffStruct, code that uses it should actually compile now.
- ABuffDisplay now properly preloads abilities when created in struct/module onInit methods.
- ABuffItem now removes buffs before recreating them on unit reincarnation, avoiding bugs.
- Added the ABuffDispel helper library.

Version 1.6
- Added the ABuffSpell library that simplifies making abuffs applied by spells.
- Added the ABuffStruct module that allows simple encapsulation of abuffs in structs.
- Minor updates to ABuffHeroSkill and ABuffItem to help detect common user errors.
- Updated some of the samples to make use of the new libraries.

Version 1.5
- Added support for three different buff categories: STANDARD, STACKING, REFCOUNT.
- Added the ABuffDisplay library that simplifies displaying buffs with tornado-based auras.
- Added the ABuffHeroSkill library that simplifies making passive hero skills.
- Added the ABuffItem library that simplifies making abuffs applied by items.
- ABuff now uses DamageEvent instead of ADamage. It now also uses SpellEvent.
- ABuff still works without these two libraries, it just does not use these events without them.
- Completely recoded the ABuffAura library, it should be much more efficient now.
- Renamed ABuffDestroy to ABuffRemove, the old function name is still supported.
- Changed how custom events work, the new code is not backwards compatible.
- Recoded the samples to utilize other useful libraries besides ABuff.


Version 1.4b
- Updated the test map to use 1.24-compatible Table and TimerUtils, ABuff remains unchanged.

Version 1.4
- The system now uses standard libraries, Table for gamecache use and TimerUtils for timers.
- Damage detection has been moved to an independant library, which also supports damage prevention.
- The dummy units section has been replaced with the UnitRunsEvents function.
- The aBuff core engine has been reworked and optimised.
- The Aura subsystem has been reworked, removing dynamic trigger use and some bugs.
- Fixed a bug in the SetABuffTimeRemaining function that prevented the duration from being decreased.

Version 1.3
- Added effect delay safety checks to the stun system and to examples with dummy casters.
- Added the functions GetABuffFromBuffedUnitByType and BuffedUnitHasABuff.
- Did minor changes to the code to make use of new vJass syntax.

Version 1.2
- Added an aura subsystem.
- Fixed some non critical coding errors.
- Made the system more robust by using .execute instead of .evaluate for user event response functions.
- Added a safety check so buffs that are reapplied while being destroyed are not immediately cleaned up.
- Added a safety check so buffs can no longer be applied to dying units on the unit dies event.

Version 1.1
- Fixed an error which caused damage events not to be ingored even if the user specified that.
- Added the RefreshNeverReduceDuration function.

Attached Files
File Type: w3x ABuffSystem1.9b.w3x (233.6 KB, 94 views)

Last edited by Anitarf : 12-11-2013 at 04:58 AM.
Anitarf is offline   Reply With Quote
Sponsored Links - Login to hide this ad!
Old 07-19-2007, 07:25 PM   #2
rain9441
User
 
Join Date: Jan 2007
Posts: 195

rain9441 will become famous soon enough (61)rain9441 will become famous soon enough (61)rain9441 will become famous soon enough (61)

Default

Well I have to say that this is pretty sweet. I've spent some time looking into this system and am pretty pumped about it. The possibilities are pretty much astounding. I got a lot of ideas that were never before possible but are now... But I have a few questions (probably the same as others)

How practical is this on heavy action maps? Can it support 50 units with multiple buffs/debuffs, 100? 500?

Is it feasible to use this system with auras? Example: TriggerRegisterUnitInRange on a unit with an action of ABuffApply with duration 0, where the ABuff has a periodic event to check the range of the target with the caster.

Whats the bottleneck of the system? I can easily change the implementation of GetUnitABuffData to use Get/SetUnitUserData, would this increase performance (by drastically reducing gamecache usage)?

Any tips for implementing ABuff's with some sort of Orb Effect Detection engine?

And regarding your mini Stun System, does it interact well with other non-ABuff related stuns?

Whats the A stand for?
rain9441 is offline   Reply With Quote
Old 07-19-2007, 08:01 PM   #3
Rising_Dusk
Obscurity, the Art


Projects Director
Project Leader: OD
 
Join Date: Feb 2006
Posts: 9,726

Submissions (27)

Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)

Hero Contest #3 - 1st PlaceApproved Map: Desert of ExileApproved Map: Advent of the ZenithHero Contest #2 - 1st PlaceHero Contest - Third place>

Send a message via AIM to Rising_Dusk Send a message via MSN to Rising_Dusk
Default

Quote:
Whats the A stand for?
Anitarf, I would guess.
Who cares about being modest when you made a system. :p
__________________
Home Page
DoE v1.14c Download
AotZ v2.03d Download
OD v0.10x Download

Coming soon eventually...

Personal To-Do List:
ICARUS
Aot3

WC3C Chat
Chat IP: 66.103.20.109
Earthbound 2 in English
vJass Manual

"DAMAGE_TYPE_POISON motherfucker!" ~Anitarf
Rising_Dusk is offline   Reply With Quote
Old 07-19-2007, 08:18 PM   #4
Ammorth
I blink, therefore I am.
 
Ammorth's Avatar
 
Join Date: Sep 2006
Posts: 1,812

Submissions (10)

Ammorth is a glorious beacon of light (453)Ammorth is a glorious beacon of light (453)Ammorth is a glorious beacon of light (453)Ammorth is a glorious beacon of light (453)

Default

Nice system, although (correct me if I'm wrong) but it seems that the stunning unit shows it's health bar. Otherwise awesome job!
__________________
Ammorth is offline   Reply With Quote
Old 07-19-2007, 08:27 PM   #5
Skater
User
 
Skater's Avatar
 
Join Date: Jan 2007
Posts: 80

Skater is on a distinguished road (17)

Default

I just say: "Just another WarCraft III map".
Will look through it soon.
Skater is offline   Reply With Quote
Old 07-20-2007, 12:20 AM   #7
Anitarf
Procrastination Incarnate


Development Director
 
Join Date: Feb 2004
Posts: 8,028

Submissions (19)

Anitarf has a brilliant future (883)Anitarf has a brilliant future (883)Anitarf has a brilliant future (883)Anitarf has a brilliant future (883)Anitarf has a brilliant future (883)Anitarf has a brilliant future (883)Anitarf has a brilliant future (883)Anitarf has a brilliant future (883)

2008 Spell olympics - Fire - SilverApproved Map: Old School Alliance TacticsHero Contest #2 - 3rd PlaceSpell making session 2 winner

Default

Quote:
Originally Posted by rain9441
How practical is this on heavy action maps? Can it support 50 units with multiple buffs/debuffs, 100? 500?
I can't give you a direct answer to that. It always depends on what you do with the system and what else is going on in the map. When it comes to more trigger/sfx heavy spells, the system is not the critical component anyway; when the game starts lagging, it's because of the spells, not the system. If you have simpler spells, but a lot more of them, then the system plays a bigger role, but still, to geta lot of buffs you need a lot of units so the graphics and pathing are contributing to lag as much as the system.

You can always turn off some events to increase performance. Turning them all off would limit what you can do with buffs considerably, but turning one or two off would still leave you with enough creative space to make enough buff spells for one map. For example, the map I designed this system for will most likely not use the "other buff" and damage events. (speaking of which, I just noticed that I forgot to add an if statement in there somewhere, so turning off damage detection doesn't stop on damage triggers from being created... it's not critical, I'll fix it later :) )

Consider it like this: most events require two gamecache lookups and then a bit of array access, how much depends on the number of buffs the units involved in the event have but it's not an issue either way, it's just looking up global variables and comparing stuff. Now, if the system finds a buff that has a response function to the event, it takes one more .evaluate to run it and of course whatever the user wrote in that function. Except on common events like attack and damage with a lot of units with fast attack speeds (and probably not even then unless we're talking excessive amount of attacks), the system alone handling a bunch of blank buffs shouldn't be a problem.

Quote:
Is it feasible to use this system with auras? Example: TriggerRegisterUnitInRange on a unit with an action of ABuffApply with duration 0, where the ABuff has a periodic event to check the range of the target with the caster.
I didn't make an aura template because I thought it was impractical but the way you described it's implementation it sounds rather feasible. You could even have a seperate custom periodic event (by enumerating buffs by type) that only runs only once or twice per second to lower the load (or lower the frequency of the default periodic event if no other buff requires it to be smoother), but it might not be neccessary at all, IsUnitInRange() is a native, and getting the two units is trivial. I think I will write that aura template for the next version. :)

Quote:
Whats the bottleneck of the system? I can easily change the implementation of GetUnitABuffData to use Get/SetUnitUserData, would this increase performance (by drastically reducing gamecache usage)?
Gamecache calls seem like a bottleneck considering how slow they are together with H2I but they are only used twice for each event to get the unit's data and then it's looping through linked lists of buffs. Now, if you have many events occuring, but only few units involved in them have buffs or most buffs don't respond to frequent events, then GC calls may have a considerable contribution compared to the rest of the code, but that's because there is almost no "rest of the code". Otherwise, not really.

That's why I decided to go with game cache, I don't need to use much of it so it's not that heavy, but the system is a lot more import friendly as it doesn't conflict with any other system that would use unit custom values. If you change the implementation, however, note that you need to alter GetUnitABuffData(), IsUnitAllocated() and the create and destroy methods of the aBuffUnit struct. I think that's it.

Quote:
Any tips for implementing ABuff's with some sort of Orb Effect Detection engine?
Nope. What specificaly did you have in mind?

Quote:
And regarding your mini Stun System, does it interact well with other non-ABuff related stuns?
If you use the stun system, you should do all your stunning through it. It might not conflict if you use different buffs though.

Quote:
Whats the A stand for?
Rising_Dusk is correct, I afforded myself a moment of vanity when trying to think of a name. I was really out of ideas so it was either ABuff or no buff (I couldn't really start coding if I didn't know how to name the most basic structs :) ).

Quote:
Originally Posted by Ammorth
Nice system, although (correct me if I'm wrong) but it seems that the stunning unit shows it's health bar. Otherwise awesome job!
Not sure what you mean, but dummy stunners have the locust ability so I choose to blame Blizzard (either that, or your sight :P ).

As for the "Just another WarCraft III map", it shows how eager I was to get this out after a month of coding followed by a month of no computer (when I was finishing it up today I realised I should really comment my code more :) ). It's not that important, all the documentation is in the map anyway. I'll fix it with the next version.
__________________
Anitarf is offline   Reply With Quote
Old 07-20-2007, 12:21 AM   #8
Fulla
Evil Overlord
 
Fulla's Avatar
 
Join Date: Jan 2006
Posts: 1,416

Submissions (3)

Fulla has a spectacular aura about (79)Fulla has a spectacular aura about (79)Fulla has a spectacular aura about (79)

Default

Well this is interesting, I was just planning on building a buff system, will have to take a look at this, should come in very handy.
__________________
Fulla is offline   Reply With Quote
Old 07-20-2007, 06:25 AM   #9
PipeDream
Moderator
 
PipeDream's Avatar


Code Moderator
 
Join Date: Feb 2006
Posts: 1,405

Submissions (6)

PipeDream is a glorious beacon of light (463)PipeDream is a glorious beacon of light (463)PipeDream is a glorious beacon of light (463)PipeDream is a glorious beacon of light (463)

Default

Best JASS ever. Amazing job, Anitarf.
Comments:
  • How about GC for IsUnit(Ignored)Dummy
  • It would be nice if we could find a way to let you work around inlining basic list utilities like search
  • Automatic inlining would actually help this code
  • Indentation is funny in GroupEnumUnitsInArea
  • Switch these two lines (87/88) in the AoE buff template?
    Collapse JASS:
                call GroupRemoveUnit(g, u)
                exitwhen u== null
I'm afraid I can't give you any real feedback. Maybe someone in the content business can find something to criticize. E.g., I have no idea if this is even useful ;)
__________________
PipeDream is offline   Reply With Quote
Old 07-20-2007, 08:04 AM   #10
Toadcop
BuranX
 
Toadcop's Avatar
 
Join Date: Jul 2006
Posts: 1,887

Submissions (4)

Toadcop is just really nice (295)Toadcop is just really nice (295)

Approved Map: TcXSpell Making Session 10 Winner

Send a message via ICQ to Toadcop
Default

well looks interesting!
...
well looks awesome ^^

so 1 year ago i have understand what to stick together a map out of custom (different) systems is a full crap. =\ cause they are not beloning together thats the problem ! what i mean ? 100% it's a best system for YOU. and it's right so. but it's not the point the feature is what someone can learn from your sys and made own one. for example i got also a buff sys it's very similar to this one ^^ (but not the code it self) and i made it more than a 6 months ago.
something about system.

i don't like the peredical event =\ it's awesome lame. in 2 ways.
1) you could symple use a new separate timer.
2) ok you are optimization junkie ^^ you use a single timer. BUT the events are launching every event tick =\ whats suxx. you could simple add counter to the buff.

the rest is ok but with some "BUT"s

Quote:
Best JASS ever.
not really see the generated jass code <_<
it maybe the best vJass code =)

Custom systems rocks ! may Tiesto be with you ! xD

~approved =)
Toadcop is offline   Reply With Quote
Old 07-20-2007, 09:59 AM   #11
Fulla
Evil Overlord
 
Fulla's Avatar
 
Join Date: Jan 2006
Posts: 1,416

Submissions (3)

Fulla has a spectacular aura about (79)Fulla has a spectacular aura about (79)Fulla has a spectacular aura about (79)

Default

The more I look at this, the more possibilities open up in my mind for some awesome spells.

EDiT: Can the system handle/have the capability:

-Storing a buffs, strength/level? For:
Magic Resistance Every 1-10 seconds destroys a negative buff on the hero, strongest ones first.
__________________

Last edited by Fulla : 07-20-2007 at 10:09 AM.
Fulla is offline   Reply With Quote
Old 07-20-2007, 10:50 AM   #12
Toadcop
BuranX
 
Toadcop's Avatar
 
Join Date: Jul 2006
Posts: 1,887

Submissions (4)

Toadcop is just really nice (295)Toadcop is just really nice (295)

Approved Map: TcXSpell Making Session 10 Winner

Send a message via ICQ to Toadcop
Default

Fulla currently not. but it's no problem to do what.
Quote:
Magic Resistance Every 1-10 seconds destroys a negative buff on the hero, strongest ones first.
what is strongest ? i mean how do you want to know it ? if you have a way to find it out then ofc using a loop through all buffs but it's not a problem.

Quote:
The more I look at this, the more possibilities open up in my mind for some awesome spells.
omg guess why Anitarf made it O_o ?! he is of the one who can see potential awesome things (it's like me ^^)
Toadcop is offline   Reply With Quote
Old 07-20-2007, 10:51 AM   #13
Silvenon
User
 
Silvenon's Avatar
 
Join Date: May 2007
Posts: 492

Submissions (1)

Silvenon will become famous soon enough (63)Silvenon will become famous soon enough (63)Silvenon will become famous soon enough (63)

Send a message via MSN to Silvenon
Default

Really nice system, now I don't have to bother with missing Add Buff action :)
__________________
Cascading Style Shit
Silvenon is offline   Reply With Quote
Old 07-20-2007, 11:42 AM   #14
Toadcop
BuranX
 
Toadcop's Avatar
 
Join Date: Jul 2006
Posts: 1,887

Submissions (4)

Toadcop is just really nice (295)Toadcop is just really nice (295)

Approved Map: TcXSpell Making Session 10 Winner

Send a message via ICQ to Toadcop
Default

hmmm =\ ... xD queation what will happen if your unit (with a buff) dies but it has reincarnation ? let me guess... the custom effect will be there but buff icon no ^^ + it was a big mistake to combine jass with spell buffs. for example i use tornado slow aura as "buff". and i don't get any trouble with it.
Toadcop is offline   Reply With Quote
Old 07-20-2007, 12:00 PM   #15
Fulla
Evil Overlord
 
Fulla's Avatar
 
Join Date: Jan 2006
Posts: 1,416

Submissions (3)

Fulla has a spectacular aura about (79)Fulla has a spectacular aura about (79)Fulla has a spectacular aura about (79)

Default

I basically meant simply something like:
Hero Ultimate Buffs - Rank 3
Hero Buffs - Rank 2
Unit Buffs - Rank 1

But ofcourse Id have a 1-10 rank, and simply set a spell on how strong/important it is.
Isnt there someting like this already in the game, buff priority or something?
__________________
Fulla is offline   Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off


All times are GMT. The time now is 09:25 AM.


Donate

Affiliates
The Hubb http://bylur.com - Warcraft, StarCraft, Diablo and DotA Blog & Forums The JASS Vault Clan WEnW Campaign Creations Clan CBS GamesModding Flixreel Videos

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