Wc3C.net

Wc3C.net (http://www.wc3c.net/forums.php)
-   Systems (http://www.wc3c.net/forumdisplay.php?f=648)
-   -   Intuitive Buff System (http://www.wc3c.net/showthread.php?t=107613)

Rising_Dusk 09-12-2009 07:50 AM

Intuitive Buff System
 
2 Attachment(s)
Zoom (requires log in)
Intuitive Buff System
v1.05

Background:
So, here's a bit of history about this library. The original version was developed for use with my map, Desert of Exile. Eventually, I was asked by Cassiel to work on some things for Tides of Blood. It was for that map that I developed round two of the system, which is the predecessor to the version posted here. Eventually, I was removed from the team for Tides of Blood due to my inability to actually do enough work in a reasonable time frame. Since then, I've had this sitting on my hard drive and just recently managed to motivate myself to clean it up, update it to modern day coding standards, add some new functionality, and write the documentation. The interface for the system is about as intuitive as possible, and I am extremely proud to present it to you, the community, at last. I hope you all find it as useful as I have over the years!

Requirements:Notes:
  • This system only supports up to 8192 buff types and 8192 buffs at a given time. This limit should be reasonable for all intents and purposes.
System Code:
Expand Library:

Attached is a demo map that shows many of the facets of the system being used. There are also sufficiently many examples inside the test map to show anyone how to use it. Enjoy!

Flame_Phoenix 09-12-2009 10:22 AM

Seems quite small... I was doing something like this but Anitarf told me it was a bad idea because his system would be better with more features. Ani's system seems more complete I admit, but I wish you good luck on this.

Tot 09-12-2009 11:50 AM

yipeee....the first buff-system i understand....

sry, Anitarf...

Toadcop 09-12-2009 12:42 PM

Quote:

Intuitive Buff System
iBS xDDD 10101010101
iDusk ^_^

the interface is kind a weird...
yes i don't see any sense what buffs are separate structures... cause you have only periodical action and on end action =) there should be also on begin action... (callback)
otherwise spell stealing will be not possible (for example)

but idk do what you want O_o this db is full of shit anyway xD

Flame_Phoenix 09-12-2009 12:49 PM

Anitarf's system is quite complex but once you understand it you won't need anything else.

Tot 09-12-2009 12:58 PM

Quote:

Originally Posted by Flame_Phoenix
Anitarf's system is quite complex but once you understand it you won't need anything else.


do you see my prob? :emote_smile:

Flame_Phoenix 09-12-2009 01:16 PM

Quote:

Once you understand it
Anitarf is usually busy and he is not the perfect example of patience either. If you need help understanding how to use his system I can give you a short introduction.

Viikuna- 09-12-2009 02:50 PM

It works fine and all, but I got one double free of type: dbuff when spamming those spells to those abos.

Rising_Dusk 09-12-2009 02:52 PM

Quote:

Originally Posted by Flame_Phoenix
Seems quite small... I was doing something like this but Anitarf told me it was a bad idea because his system would be better with more features. Ani's system seems more complete I admit, but I wish you good luck on this.

Just like there are 3 different approved Damage Detection Systems in the database, there is nothing wrong with different approaches to buff systems. Ani likely suggested to you to not make yours because he didn't want to have to review your code. :p
Quote:

Originally Posted by Toadcop
yes i don't see any sense what buffs are separate structures... cause you have only periodical action and on end action =) there should be also on begin action... (callback)

I thought about begin, but I mean, you have to call "UnitAddBuff" so you already know when the buff begins. I didn't think the added argument would really be all that useful. Maybe I should add it for completeness?
Quote:

Originally Posted by Viikuna-
It works fine and all, but I got one double free of type: dbuff when spamming those spells to those abos.

What exactly were you doing in the testmap? I saved it in debug mode in case someone found something like that, but I need to know more about what you were doing.

Here-b-Trollz 09-12-2009 03:15 PM

Quote:

Originally Posted by Rising_Dusk
I thought about begin, but I mean, you have to call "UnitAddBuff" so you already know when the buff begins. I didn't think the added argument would really be all that useful. Maybe I should add it for completeness?


There are cases in which you don't actually know what buff you are getting, such as buff steal or buff push spells, in which case Anitarf has the upper hand on you, because his system has support for 'abstract' onAdd and onRemove.

Provided you aren't doing stuff that involves indefinite buffs, this is the way to go; Intuitive Buff System is indeed intuitive.

Flame_Phoenix 09-12-2009 03:16 PM

Quote:

Just like there are 3 different approved Damage Detection Systems in the database, there is nothing wrong with different approaches to buff systems. Ani likely suggested to you to not make yours because he didn't want to have to review your code. :p
The truth is so painful sometimes ...

Rising_Dusk 09-12-2009 03:28 PM

Quote:

Originally Posted by Here-b-Trollz
There are cases in which you don't actually know what buff you are getting, such as buff steal or buff push spells, in which case Anitarf has the upper hand on you, because his system has support for 'abstract' onAdd and onRemove.

Provided you aren't doing stuff that involves indefinite buffs, this is the way to go; Intuitive Buff System is indeed intuitive.

Hrm, yes, a GetRandomBuff might be valuable, or a GetTopBuff for purposes of hooking and stealing buffs. The system actually supports it happily, it just doesn't give you a way of finding that buff. I mean, I already use Table, a second table call for finding top/random buff wouldn't be a problem.

Viikuna- 09-12-2009 06:18 PM

Quote:

What exactly were you doing in the testmap? I saved it in debug mode in case someone found something like that, but I need to know more about what you were doing.

I can upload my last replay tomorrow, since I havent played anything after that. You can check what happened by yourself.

Rising_Dusk 09-12-2009 06:41 PM

Uh, I guess. My WC3 doesn't run single player or replays that great, so it'd be way easier if you could just explain the circumstances leading up to the doublefree, but whatever.

Here-b-Trollz 09-12-2009 07:06 PM

Quote:

Originally Posted by Rising_Dusk
Hrm, yes, a GetRandomBuff might be valuable, or a GetTopBuff for purposes of hooking and stealing buffs. The system actually supports it happily, it just doesn't give you a way of finding that buff. I mean, I already use Table, a second table call for finding top/random buff wouldn't be a problem.


Sorry, what I meant by that was that onAdd and onRemove and onPeriodic should be defined for a bufftype, not in UnitAddBuff or whatever.


All times are GMT. The time now is 03:51 PM.

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