| 11-08-2003, 12:30 PM | #1 |
In what has turned out to be a time sucking "nice touch," I wanted to put down some traffic lights on my map. Something simple that would go from green, yellow and red. Using scaled down Ziggurauts and changing player color would work, but it doesn't look anything like a traffic light, and so I decided to be a little creative and do some simple .mdl editing on the Lorderon Summer lamp post. Two quick glow references later, and voila, green and red lamps. The problem isn't so much with the trigger; that replaces the lamps just fine (attached). The problem is that each iteration of the trigger (i.e., from yellow->red->green and back to yellow), the glow doubles in intensity. The next post has a picture of the 1st, 3rd, and 5th iterations; if I let it go much longer, the lag becomes intense. The heck? I'm hiding and killing the previous doodad; I had presumed that any attached glow to the dead model should die with it. Any thoughts on how to avoid a traffic light related lockup? |
| 11-08-2003, 12:31 PM | #2 |
1st, 3rd and 5th cycle. Note the intensity of the glow. |
| 11-08-2003, 03:31 PM | #3 |
Here i fixed the problem. I made it hide the unit, create the next one, and then remove the old one. ran it for 5 minutes and no lag. Hope this helps. |
| 11-08-2003, 03:42 PM | #4 |
You're my hero, KlownKiller. I had wanted to use Kill destructible, since simply removing units is supposed to cause memory leak, but I guess that's not viable for destructibles (perhaps I can kill and remove it?). Thanks for checking it out! |
| 11-08-2003, 04:15 PM | #5 |
i don't see why you couldn't kill then remove. It may work just the same though. I mean you are still removing it so the lag factor wouldn't change. |
| 11-08-2003, 06:12 PM | #6 |
Removing units, without killing them, actually doesn't get rid of them. Removing and hiding still leaves the units in memory, so you can get some hellishly long end-game memory cleanups from bad TDs that don't kill the units. Technically speaking, killing leaves them around for a while, too; corpses count as units, too. Exploding destroys corpses, however, so when they explode, they're completely out of the game. I'll try killing them and removing them; won't hurt anything, and it might avoid some hellish end map lag. |
| 11-08-2003, 06:17 PM | #7 |
Just make it a unit with the Unknown(Aloc) ability (makes it unselectable, like a doodad) and kill the unit when you want to switch lights. Glow should die too =) |
| 11-08-2003, 06:22 PM | #8 |
I'm not sure how aloc would help, but killing the unit, at least without also removing it (as KlownKiller did when he tweaked my demo map) DOESN'T work. Simply killing it alone causes the perma-glow like in my 2nd post. |
| 11-08-2003, 07:03 PM | #9 |
Dont take the killing/hiding/removing stuff too seriously. Warcraft 3 is going to leak *whatever you do*. I myself couldn't find any evidence of a difference in memory usage. If you want some stuff straight from the doggies mouth (so to speak) this is what happens to the old replaced unit when using the "replace unit" action. Code:
// Remove or kill the original unit. It is sometimes unsafe to remove
// hidden units, so kill the original unit if it was previously hidden.
if wasHidden then
call KillUnit(oldUnit)
call RemoveUnit(oldUnit)
else
call RemoveUnit(oldUnit)
endifMaking the assumption that blizzard programmers know what they are doing (and they have gone to lengths to reduce memory leaks in their own code/maps) it seems that usually simply removing units is fine, unless they are hidden, then they should be killed and removed. |
| 11-08-2003, 08:18 PM | #10 |
EZ: Move the light to some isolated place in a caorner of the map, then kill it there. Simple as cake! |
