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

Leak Check on a Door Opening System

Status
Not open for further replies.
Level 9
Joined
Nov 28, 2008
Messages
704
Hi, I'm making a map where there are basically a lot of doors. Hard coding every single door to open when a unit enters a region would have been utter and brutal torture, not to mnetion the countless errors I might make.

So, in lieu of wasting over 9000 hours of my life, I made a system that makes an array of destruct(i/a)bles, which then creates rectangles 200 size in other direction from the door. Then, I made a periodically firing trigger (every .5 seconds atm, it seems to work fine) which picks every destrct(i/a)ble in this rect array, and closes it. Then it checks in those same rectangles for units, if there are some, it opens.

Simple enough, waste of writing to ask if there are any inherently better methods (I searched for something to check if any units are in radius of a door, but couldnt find - is there something like this?) and was going to ask if

JASS:
call EnumDestructablesInRectAll( DoorsRect[TempDoorCounter], function Trig_Doors_Func002002002

leaks. I cant find ANY sort of variable for a destruct(i/a)ble group, so I'm assuming that unlike ForGroup(), it does not actually make a group of destruct(i/a)bles, and so does not leak.

Does it?

Thanks for anyone who can answer any of these questions.
 
Level 14
Joined
Jul 1, 2008
Messages
1,314
i read one day a leak test about this, and there was a guy, who tested this thing with 10.000 destructables in 1 second or something like this, and he found out, that it only leaks some bytes. There is any group for destructables, you could create your own by using arrays but i think it wouldnt matter.

Well im using a map with many destructable enum events, every 0.1 seconds, and it doesnt leak, so yeah i think its ok.
 
Level 14
Joined
Jul 1, 2008
Messages
1,314
Well im not really sure, because i cant find the thread anymore, maybe you can find something on the hive, i saw someday a leak-information thread.

But as i said, using destructable pick loops is as far as i tested it ok, as i'm using every 0.10 seconds for each player (up to 6) in the map a destructable pick loop, and there is no delay with 2 players after 30 minutes game time...
 
Level 15
Joined
Dec 18, 2007
Messages
1,098
Actually, almost everything in Warcraft leaks, just how much it does. Anyway, as to the point on Destructible Groups, there is no way to destroy the leak. It would be reduce the amount of leaks if you create a Destructible Group and add the Gates to the Group instead of picking it each time. That would reduce the amount of times it leaks.
 
Level 14
Joined
Jul 1, 2008
Messages
1,314
Actually, almost everything in Warcraft leaks, just how much it does. Anyway, as to the point on Destructible Groups, there is no way to destroy the leak. It would be reduce the amount of leaks if you create a Destructible Group and add the Gates to the Group instead of picking it each time. That would reduce the amount of times it leaks.

since when destructable groups do exist?
 
Level 7
Joined
Jul 20, 2008
Messages
377
Actually, almost everything in Warcraft leaks, just how much it does.

False. A leak occurs in two ways in WC3:

  1. You create a handle and do not provide a way to reference the object again. For example, creating an unit group locally and then failing to destroy it at the end of a function.
  2. Failing to null handle variables locally. This was a stupid mistake on Blizzard's part, but apparently, when a variable isn't null, the space in memory it occupies... stays occupied. So WC3 just skips over it when you create a new object.

Units that just stay on the map until you quit the game do NOT count as leaks. Leaks occur when you create an object with no way of clearing its place in memory.

But back to the topic: I'm sorry, but some leaks such as Enums for Destructables are just unavoidable. Fortunately, they don't affect multiplayer that much. It's the same with strings.
 
Level 16
Joined
Jul 21, 2008
Messages
1,121
Alternate way should be making your gate gate building. If you do so be sure to follow these steps:

1. Make 1 gate out of building with pathing PathTextures\Gate1Path.tga. This will be your closed gate.
2. Create second gate (also out of building) with circle of power (large) pathing. This will be your opened gate
3. Create RoboGoblin ability to switch between gates.
4. Change first gate IsBuilding(object editor) to false, place it on map and rotate
5. When all gates are placed set IsBuilding to true

Note: Second gate must have same basic rotation(like horizontal, vertical, etc.) like rotated first gate.

I hope this helps
 
Status
Not open for further replies.
Top