• 🏆 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!

What is the best way to increase stats over time for many units?

Status
Not open for further replies.
Level 12
Joined
May 22, 2015
Messages
1,051
I am working on a hero defense map. The enemy unit types never change, but they spawn more as the game goes on and they get stronger as well.

Currently, the increased spawn rate is fine. The problem is making the enemies stronger. Right now, I have a dummy unit with auras on it that affects all the enemy units (range is 50000 or something like that). It has 3 auras - each with 100 levels. I am not sure exactly how bad it is for the map loading time (creates the dummy at map initialisation), but it's definitely not how I want to do it if it is possible to do it another way.

The 3 auras are: damage, armour, health regeneration. I might be adding more as well (mana regeneration), but if the solution works for those three, it is good enough.

One solution is to make them have, say, 20 levels each and then increment them only one 5th as often, but that might make it a bit too clunky for my tastes. It's an improvement, at least, but if there is something better, I'd rather go with that.

I think I've heard that upgrades are better than auras. I could do this, but is it actually faster? I think it would also mess up the armour aura since it currently increments by 0.5 per level (seems like you can only put integers in armour per upgrade). I wouldn't mind making that one have 50 levels worth of upgrades and have it only increment half as often. I am unsure if there is a health regeneration upgrade that I can use, so upgrades might not be a complete solution. Fixing 2 of the auras would still be good, though.

In case it matters, I am using default WC3 editor. I prefer JASS, but GUI solutions are perfectly fine. I can convert the triggers myself if I need to.

That's all I've got. Thanks in advance.
 
Level 12
Joined
May 22, 2015
Messages
1,051
make units get upgrade research 5 minutes

I'm not sure I understand what you mean. Do you mean like increase each upgrade every 5 minutes? I think I can figure out how to make the upgrades go up, I just don't know what the best way to handle making the units stronger is.
 
Level 2
Joined
Feb 24, 2012
Messages
8
You can apply up to 4 different effects on a single upgrade (including defence, damage, health regeneration). Definitely superior to using auras.
 

Dr Super Good

Spell Reviewer
Level 63
Joined
Jan 18, 2005
Messages
27,191
Upgrades sound like the easiest approach however they cannot be unlearned so you cannot have the enemies getting stronger only temporarily.

Alternatively you can use a trigger system to modify unit attributes. These use a number of abilities but give you a huge modification range. For example 32 abilities gives you +/- 2 million odd damage range. This lets you buff units using triggers in any way you want which gives more flexibility than upgrades.

Be careful with scaling both armor and health. Once the player's cap attack speed at +400% then you will need to increase the rate their damage scales otherwise the monsters will take longer to kill with normal attacks. Additionally you need abilities to scale at about the same rate as health or better otherwise they will become useless.
 
Level 12
Joined
May 22, 2015
Messages
1,051
You can apply up to 4 different effects on a single upgrade (including defence, damage, health regeneration). Definitely superior to using auras.
The auras don't all go up at the same rate. It's random with and emphasis on the top one from the list that isn't maxed:
damage
armour
health regen

Upgrades sound like the easiest approach however they cannot be unlearned so you cannot have the enemies getting stronger only temporarily.
The upgrades never need to decrease. They only go up. My map has no restart functionality. This is not a problem for me.

Be careful with scaling both armor and health. Once the player's cap attack speed at +400% then you will need to increase the rate their damage scales otherwise the monsters will take longer to kill with normal attacks. Additionally you need abilities to scale at about the same rate as health or better otherwise they will become useless.
Thanks for the heads up. I don't think this will be a problem for my map, though. Heroes aren't getting to max attack speed in my map, I don't think. The scaling for the enemies is pretty tame as well.

Alternatively you can use a trigger system to modify unit attributes. These use a number of abilities but give you a huge modification range. For example 32 abilities gives you +/- 2 million odd damage range. This lets you buff units using triggers in any way you want which gives more flexibility than upgrades.
Can you link me to a tutorial for this or explain it to me more? I am not super familiar with doing this. Even though I am using JASS, I am mostly just reorganising the terrible layout that GUI triggers transform to, removing all of the BJ and swapped functions that I can, and making sure I fix any memory leaks.
 

Dr Super Good

Spell Reviewer
Level 63
Joined
Jan 18, 2005
Messages
27,191
Can you link me to a tutorial for this or explain it to me more? I am not super familiar with doing this. Even though I am using JASS, I am mostly just reorganising the terrible layout that GUI triggers transform to, removing all of the BJ and swapped functions that I can, and making sure I fix any memory leaks.

Fundamentally you use item abilities as unit abilities which you give a unit by trigger. Some item abilities have a level up bug allowing permanent stat gain without having to hold the ability. Other item abilities you need to add multiple off in various increments to get the amount you want (eg attack speed?). The simplest way to do this is to create a series of abilities that increase the property in powers of 2, then using simple binary mathematics you can add any quantity supported by the attribute range provided by the number of abilities created.

Here is one approach using tomes.
Here is one which probably no longer works but used adding abilities.
Here is another one which uses abilities and likely no longer works.

I am sure there are more recent ones but the JASS resources are really a mess so I cannot find it.
 
Level 12
Joined
May 22, 2015
Messages
1,051
I haven't implemented anything new for this, yet, but I had an idea.

Basically, I was thinking I could have just 7 auras for damage (7 for armour, etc) and I could add or remove the ones I need to get the damage (etc) amounts I need. Basically, they're just have set values of 2^x:

Damage aura 1: 1 damage
Damage aura 2: 2 damage
Damage aura 3: 4 damage
Damage aura 4: 8 damage
Damage aura 5: 16 damage
Damage aura 6: 32 damage
Damage aura 7: 64 damage

Instead of having one giant aura with 100 levels, I would use these 7 auras and a string or array that holds a binary number. The binary number tells me which auras to turn on and which ones to turn off.

Ex:
Let's say I want to add 37 damage
37 in binary is: 0100101
I'd go through the auras and make sure the right auras are on and the rest are off:
7 - off
6 - on
5 - off
4 - off
3 - on
2 - off
1 - on

Looking back at the aura values, that gives me 32 + 4 + 1 = 37 damage total.

I would have the exact same system in place for the rest of the auras I use. This would cut down from 100 levels of auras to 7. One issue would be 7 buffs per aura type. It'll be a bit ugly and slightly annoying, but I think it should work. Does anyone see a problem with this?

Alternatively, I could have 7 damage abilities (the item version) and add them accordingly (though it wouldn't work on units already on the map). This would remove the buff issue, though. Is it costly to add several abilities to units all the time?
 
Level 21
Joined
Mar 27, 2012
Messages
3,232
You don't need an array. You can calculate it by moving down the list of available abilities.
Position the abilities so that Array[n] = 2^n

Then when setting the bonus you start from highest n and go down, adding an ability and reducing the remaining bonus by that amount if 2^n is equal or higher than the remaining bonus.
 
Level 19
Joined
Aug 8, 2007
Messages
2,765
What you described is exactly how most Bonus systems work, except they usually use item abilities instead of auras so its per-unit, but if your looking to do the entire map at once than it shouldn't be an issue.

e/ nevermind auras dont stack they never have what am i thinking

as i said, do exactly what you described except with item abilities and do it per-unit.

the issue with this is the lag when you apply the auras. If you have a low # of mobs (below 200) than there shouldn't be an issue, else be wary of lag spikes & threadcrashing. A way to fix this would be to group the entire map into 100 block sections than do a block every 0.33 seconds for x seconds
 
Level 12
Joined
May 22, 2015
Messages
1,051
What you described is exactly how most Bonus systems work, except they usually use item abilities instead of auras so its per-unit, but if your looking to do the entire map at once than it shouldn't be an issue.

e/ nevermind auras dont stack they never have what am i thinking

They do with different buffs, don't they? I didn't realise this is how others do it haha. I guess that's what DrSuperGood was alluding to in one of his posts above.

EDIT:
"The simplest way to do this is to create a series of abilities that increase the property in powers of 2, then using simple binary mathematics you can add any quantity supported by the attribute range provided by the number of abilities created."
Definitely exactly what he was talking about hahaha. Does this work with auras (with a different buff per aura) or can I use the item abilities and add them to each unit as they spawn? There are quite a few units spawning, so this would happen quite often. I don't know the performance cost of adding 4 or 5 abilities to every unit that spawns.

One thing I have done for some certain hero abilities is use a dummy unit as a requirement for an ability. Basically, the ability's dependency is 'dummy unit X' and I spawn / kill the dummy unit when the hero activates / deactivates an ability. It is sort of like a stance change from neutral to berserk mode. Would it be better to have the abilities on the units already and then spawn / kill the appropriate dummy units as the damage level changes? That would be 21 abilities lol, so it might be extreme to have them all.

EDIT2:
The number of enemies is capped at 80, but they spawn constantly and at a rather rapid pace (gets faster later in the game). There are some units that go outside the unit cap (bosses and their summoned units), but most of them don't make very many. I only really need the buffs on the main, basic enemies and the bosses, so that wouldn't be very hard to do at the time that they spawn.
 
Level 19
Joined
Aug 8, 2007
Messages
2,765
Abilities based on different auras stack but even if you switch the buff auras still don't stack, atleast from what I remember.

If you have only 80 units and spawn them frequently than adding the abilities to each shouldnt be an issue
 
Level 12
Joined
May 22, 2015
Messages
1,051
Thanks everyone! I think I'll go with the item abilities since several buffs per aura will look ugly when you select an enemy unit and the buffs themselves are extra object editor things that I can skip loading. I can also remove the dummy aura unit entirely this way.
 
Apparently, the second approach said by DrSuperGood works, but it was Graveyarded due to Lua not working on newer Windows (something like that, I used XP before and haven't touched Vista nor 7 or higher).
If you can get the Lua to work, then it will be much more easier. Upgrades is the best and simplest approach actually.
 
Level 12
Joined
May 22, 2015
Messages
1,051
So you're saying 100 upgrades will be better than 7 abilities? It's definitely more simple, but I can manage the binary and all that. I want the solution that will be better for map loading time, mostly. The damage levels won't change enough for it to be a problem to figure out what to do based on binary. The only problem would be adding several abilities per spawned unit.
 
Level 19
Joined
Aug 8, 2007
Messages
2,765
I have a 64-bit windows and lua does work. You might need to run editor as admin for it to work, but I don't know, as I do that anyway(for UMSWE).

LUA isn't and has never been necessary for making these abilities.
 
Level 21
Joined
Mar 27, 2012
Messages
3,232
Lua not working is untrue. As I said, the most likely reason why this false information has spread is that people aren't used to having to run things as admin. Never had this problem of lua not working on any OS(have used WinXP and Win7).
 
Status
Not open for further replies.
Top