• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[Spell] Damage detection system, which one?

Status
Not open for further replies.
There is a couple of damage detection systems out there, and I'm looking for the one that fit my needs the best.

I work in vJass/jass mostly, so that is not a problem.

I generally don't like unit indexing systems / other gui systems, that try to solve things that is already solved just by using jass. As it just takes up space and makes it more complicated (for me at least).

It should preferably has as little exceptions as possible, would like to have to redo as little spells as possible in triggers, and it should work for both triggered damage and non triggered damage. Even if it takes up more space.

Obviously it should be leakless.

Any suggestions. Also, does this even exist?
 
Last edited:
Level 24
Joined
Aug 1, 2013
Messages
4,657
Stuff:
No problem if it is JASS/vJASS.
Should have as little exceptions as possible.
Redo as little spells as possible.
Both triggered damage and non triggered damage.
Must be leakless.

I will just ignore that other part.

Leakless is obvious.
Triggered damage and non triggered damage is part of any damage detection system.
What also comes with such a system is that you will have exceptions.
If you made your spells properly, you wont have to redo many of it.

Any dds will do for you.
 
Level 24
Joined
Aug 1, 2013
Messages
4,657
I don't get it Wietlol, what's your problem with Silent disliking indexing?

Things that prove to be good over and over again should not be called "try to solve things that is already solved just by using jass"
Something like a unit indexer is important in GUI but far more in JASS... there is no way that it is already done or "tries to do something".
There are some things that you shouldn't just say because you think a certain way is better than... whatever you think.
At least having some arguments to back up your statement is recommended if you try to do it.
 
Level 11
Joined
Aug 24, 2012
Messages
429
Things that prove to be good over and over again should not be called "try to solve things that is already solved just by using jass"
Something like a unit indexer is important in GUI but far more in JASS... there is no way that it is already done or "tries to do something".
There are some things that you shouldn't just say because you think a certain way is better than... whatever you think.
At least having some arguments to back up your statement is recommended if you try to do it.

See, you are doing the exact same thing, you did not back up your dislike of his dislike of indexing with arguments, you automatically discredited it with the phrase "I'm going to ignore that". Your argument was provided only AFTER.

I have no problem with using indexing, my issue was with your tone.
 
Level 24
Joined
Aug 1, 2013
Messages
4,657
I didnt say that you had to give them immediately either.
I said you need them when you place such a statement.
You should use them when necessary... like when someone says something about it.

@The Silent
You can try Bribe's DDS, iirc LFH didnt update his health reset part so I cant actually recommend it :/
Those are the only two that come to my mind that are easy to use (sorry Nes) and fully working.
 
Level 24
Joined
Aug 1, 2013
Messages
4,657
Yea maybe that is correct (dunno), but you see people using hashtables and are then told to just use arrays instead (which require a unit indexer in most cases).

I never use hashtables unless it is necessary which is in my opinion far better than using it whenever you can.
 
Level 21
Joined
Mar 27, 2012
Messages
3,232
Hashtables are considerably slower than arrays. The point of a unit indexer is making it easier to use arrays so you wouldn't be pushed into using hashtables when it's not really necessary. Thus, it improves performance despite the overhead.
Also, the overhead isn't really all that bad. Creating and destroying units will kill you and your computer way before the overhead of a unit indexer does.
 
Level 22
Joined
Feb 6, 2014
Messages
2,466
Depends, when your spell spams a lot of units like what is currently seen on the left most GIF of my signature, then I think the overhead will have a great effect.
And also, if you periodically retrieve a value from Hashtable like 32 times a second, you're doing it wrong. I only use a Hashtable to prevent O(n) search in a linked list or indexing, not periodically.
 
Level 21
Joined
Mar 27, 2012
Messages
3,232
When you create 200 units then creating 200 units is what will lag the game, not the overhead of a unit indexer. Creating units is way more expensive.

When your goal is to assign some data to a unit, then in most cases you can use a unit indexer and parallel arrays for that and it will be faster. Note that every hashtable read/write is over twice as expensive as an array read/write. Unit indexers are dirt cheap.

I can't even imagine a case where hashtables are actually faster than just getting the index of a unit and using that as the array index.
 
Level 22
Joined
Feb 6, 2014
Messages
2,466
In most cases, you only need to retrieve once from a Hashtable and that value is usually the index (instance) of the spell arrays.

And also, if I'm not mistaken (and too lazy to look), Unit Indexer uses Event - Unit enters playable map area so everytime you create (and destroy) a unit, triggers are evaluated. And in the allocation, you'll retrieve some value from the stack (if there is some) and will cost you some array lookup, else you'll allocate by incrementing the last allocated value. Then you'll use SetUnitUserData and GetTriggerUnit which will cost you some function calls. Point is, it's still using PC resources and if The_Silent doesn't need one, then why use one? That's like using the DoNothing function.
 

Bribe

Code Moderator
Level 50
Joined
Sep 26, 2009
Messages
9,468
GUI Unit Indexer only uses one event which is extremely lightweight. Creating a unit is probably 100 times more expensive than running the event.

Also, if you filter dummy units out of the indexer, nothing will be evaluated when they are removed from the game.

Hashtables are OK for general data storage, but you still need to clear unused data out of them when their child or parent reference is gone else their data will "leak". A unit indexer eliminates that problem by giving you access to the deallocation of a unit.
 
Level 12
Joined
May 22, 2015
Messages
1,051
I think it's fair to say that hashtables and unit indexers are used for the same thing (hashtables maybe even doing more), and hashtables are built into the editor, while unit indexers are not. You don't limit your maps capabilities unless you are doing something insane with hashtables.

I can't speak for a unit indexer, but hashtables are not difficult to use. Maybe if you use GUI they are bad - I stopped doing that pretty quickly after learning about hashtables lol.
 
Level 14
Joined
Dec 12, 2012
Messages
1,007
It should preferably has as little exceptions as possible, would like to have to redo as little spells as possible in triggers, and it should work for both triggered damage and non triggered damage. Even if it takes up more space.

Use GUI-Friendly Damage Detection by Weep. Since you don't need damage type detection, this should serve all your needs and is very simple (both to use and understand).

I wouldn't care about the hashtable/indexer discussion here, it really doesn't matter. If you use an indexer thats fine too, but the "overhead" of hashtables is neglectable. I would use an indexer to have clean and readable code but not because of performance.
 
Level 14
Joined
Dec 12, 2012
Messages
1,007
He was talking about the "overhead" of a unit indexer :D

Yes but I think with overhead he meant making code more complex/hard to understand, not really performance.

iirc LFH didnt update his health reset part so I cant actually recommend it :/

What do you mean? I don't know what you mean with "health reset part", but health is handled correctly in PDDS.

However, I would only recommend a DDS with damage type detection if you actually need damage type detection. I'm not sure if he needs that or not.
 
Status
Not open for further replies.
Top