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

String leaks with damage numbers

Status
Not open for further replies.
Level 8
Joined
Apr 30, 2009
Messages
338
In my map I want the option to turn on damage numbers for certain spells that have variable damage. I know it's said that strings leak when you do this, but what about if I had a string variable for each integer from 0-9, and connected them to make each damage number, using modulo? Would that leak?

Example of a spell that does 456 damage the string would be:

udg_S_integer_4 + udg_S_integer_5 + udg_S_integer_6
 
Nah, you're creating a new string with concatenation. But seriously, strings don't leak much. You'd have to make LOADS (I'm talking maybe millions) before you noticed any lag.

EDIT: Actually, I just had an idea: say your number has 3 digits, use 3 separate texttags (Floating Texts). If you do it right, your players wouldn't notice the difference and it certainly wouldn't cause any string leaks.

EDIT: Wait, the same string can't leak twice. So lots of numbers won't leak much anyway. If you had a damage string for "200", then another unit dealt 200 damage too, it'd only leak once.
 
Last edited:
Level 8
Joined
Apr 30, 2009
Messages
338
Oh ok that's cool then, I thought they all leaked when created.

So then my map can have a toggle for:

1- no damage numbers
2- ultimates only
3- all abilities

And I think the hardest-hitting spell is less than 2000 right now, and there's healing spells... so there would be less than 4000 possible strings which is 16kb, is that a lot?
 
Level 8
Joined
Apr 30, 2009
Messages
338
Do the hardcoded floating texts from bounty and criticals count towards the limit?
 
Level 11
Joined
Apr 29, 2007
Messages
826
Ok, so in an RPG are you ever going to have more than 25 tags showing at once? There're only 12 heroes maximum. And most won't even do 4-digit damage. But whatever, you don't need it anyway due to the string table being awesome.

What if you also want to show up the damage done to you show up? And maybe some other constant ones? You'll end up with 100 pretty fast.

Do the hardcoded floating texts from bounty and criticals count towards the limit?

They don't.
 

Dr Super Good

Spell Reviewer
Level 63
Joined
Jan 18, 2005
Messages
27,191
String leaks are not really a problem, unless speed is involved and only if generating new strings. Yes strings can end up hideously slow, but it makes no difference if you use one every few seconds. It is if you use 100s a second when it will be noticable.
 
Status
Not open for further replies.
Top