• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Question regarding heroes and leaks.

Status
Not open for further replies.
Level 7
Joined
Sep 11, 2013
Messages
220
I am using version 1.31, I understand that creating units make a permanent leak, so I have some questions that hopefully have an answer. I am making a large open world RPG so this might be crucial to the game.

1. Instead of using units for npc mobs, I created heroes and made them look like units, this way I prevent unit data leaks by not creating new units when respawning the npc mobs but just using "revive hero" to the mobs, right?

2. Is there a maximum to how many heroes can be placed on the map?
3. Do heroes make the map lag? Let's say I have total of 200+ heroes on the map.
4. I want to make it so that when an npc mob respawns, it has a random hero type, does it create another hero (leak) if I add chaos to the respawning mob or does it clean and replace the data of the previous one? That way I can change its type.
 
Level 7
Joined
Sep 11, 2013
Messages
220
Is this worth? I mean idk if hero’s do not leak... but there are high rpgs too and idk if there is such a big problem with unit leaks... that you using hero’s for them... but maybe ask someone that are very well known for Anwser this special questions
@Dr Super Good
Yup as I plan to make a long game type of rpg that requires the default save & load since you will be grinding for equipment, skill tree, massive amount of quests, not to mention that I will give each creature type unique movements like attack patterns, spells, etc. So as much as possible I want to remove anything that could be troublesome in the long game, and again I plan to make it a last for as long as i can, possible more than 40+ save and loads. But if I see that it isn't possible then maybe I will have to settle with a less massive rpg.
 
Level 7
Joined
Sep 11, 2013
Messages
220
Question will reincarnation not work the same?
Just set the time to idk 60 seconds then you remove the visual gravestone ankh and can detect even with unit event from bribe when a unit is reincanate...
Edit: nvm they unit will not count as dead...
Oh no no, resurrecting the mobs isn't my concern, it's more on I want to give a mob the chaos ability to change it to a different type of mob when they respawn, but I'm not sure if that creates a permanent leak like when creating a new unit. So my question is more on will a unit created through something like "Morph" create a permanent leak? or does it use the same created permanent data of the original unit into the morphed one. :)
 
Level 13
Joined
Feb 5, 2018
Messages
551
IIRC, Warcraft 3 has some garbage collection. 100% sure it has garbage collection for heroes.

Since it has garbage collection for heroes, I assume it has garbage collection for units too.

Althought even if there is no garbage collection for units, IIRC the size for each unit using memory was around 0.05kb.
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,255
I understand that creating units make a permanent leak
In older versions it certainly did. However for it to be a concern you needed to mill through tens of thousands of units. Most RPGs never approach anywhere near that amount even after the player has been grinding for a good part of a day and spamming abilities that create dummy units. It also had no direct performance implications assuming the player had sufficient RAM (which all modern systems have), but did start to run the risk of hitting some engine limitation which could cause instability. As such this leak can be ignored, and if it does cause problems then usually something as simple as recycling dummy units used by abilities is enough.
1. Instead of using units for npc mobs, I created heroes and made them look like units, this way I prevent unit data leaks by not creating new units when respawning the npc mobs but just using "revive hero" to the mobs, right?
This can work but be aware of the limitations of revive. Each player can only have 6 or so (not too sure of the exact number) reviveable dead heroes at any time, otherwise heroes start to be permanently removed (no longer can be revived) when additional normally reviveable heroes dies. This is based on the number of hero cards that the player can see on the left of the screen.
2. Is there a maximum to how many heroes can be placed on the map?
For all practical purposes there is no limit. There technically will be a limit but that is likely shared with other parts of the engine and is so big it should never be encountered.
3. Do heroes make the map lag? Let's say I have total of 200+ heroes on the map.
As far as I am aware heroes are not any more demanding than normal units. As such where you used normal units you could use heroes instead and there should be as good as no difference in performance.
4. I want to make it so that when an npc mob respawns, it has a random hero type, does it create another hero (leak) if I add chaos to the respawning mob or does it clean and replace the data of the previous one? That way I can change its type.
Chaos is not recommended as it reapplies all stat modifiers and is highly prone to causing crashes. Instead use the reverse bear form trick to change the base type of a unit. This works because bear form, and other such morph abilities, revert the unit to the base form unit type when the ability is removed, even if they never activated the ability and were never that unit type before.
Question will reincarnation not work the same?
Prevents kill credit.
that requires the default save & load
Be aware that the built in save/load is quite buggy. If possible it is recommended to start maps clean and restore state from game cache or file I/O based save and load systems.
 
Last edited:
Level 7
Joined
Sep 11, 2013
Messages
220
Wait so creating units do not leak anymore in 1.31? :D I really plan this game to be a long term rpg game so I'm not sure how many units might be used. But if it doesn't leak when creating units anymore then there is no need for me to use the chaos/morph trick :D. Also if it ever leaks, I didn't know it was only 0.05kb. So thanks everyone I think I will just use units instead of heroes for npc mobs. SOLVED :)
 
Level 9
Joined
Mar 26, 2017
Messages
376
Chaos is not recommended as it reapplies all stat modifiers and is highly prone to causing crashes. Instead use the reverse bear form trick to change the base type of a unit. This works because bear form, and other such morph abilities, revert the unit to the base form unit type when the ability is removed, even if they never activated the ability and were never that unit type before.

I didn't know bear form was preferred over chaos. Thanks, I'll edit it in my map.

And Dr Super Good, do you know if the same thing goes for Berserker Upgrade?
 
Status
Not open for further replies.
Top