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

my creation works better in classic and i dont know why

Status
Not open for further replies.
Level 4
Joined
Apr 29, 2020
Messages
59
Long read ahead... sry :(

so I have been working on an epic sized map to create a special kind of RPG. over 1200 triggers later and im almost done... but i have just realized a huge problem and i dont know what to do. The entire time i have been creating this, i have been testing it in classic mode because i want it to be 100% compatible (in models and trigger functions) with classic as i am creating this for a friend of mine who only has classic. While testing in reforged the other day i realized one of the biggest functionalities of my game is choppy in execution, but only in reforged. Ill try to explain as best i can what im trying to do.

So i have it set up so when you kill an enemy unit of a specific owner and of a specific type that 6 of those same types of units will spawn throughout the immediate area. I have accomplished this by dividing said immediate area into 6 regions and having 1 of the specific unit type spawn in a random location in each of the 6 regions. i have had to use some script magic to make sure units dont spawn in walls and stuff (typically my condition involves terrain height and terrain type as well as "walkability on or off" but because the terrain is so diverse and rugged there is no consistent condition script for each region, theyre all kinda tailored to the specific regions.) Im using "if then else" action scripts to accomplish this task. At first i thought it was because i gave my script a total of 4 attempts to place a unit before i tell it to do nothing (if the point the unit is supposed to spawn on meets the right conditions, it replaces the point to another random point in the region and rechecks conditions. if the conditions arent met it will place the unit.... kinda backwards from what youd logically expect but i dont think that is the issue). Turns out if i give my script only one chance, i still get the choppiness. You can experience it every time you kill a unit, there is a short choppiness that occurs. It does not seem consistent among my 3 areas (6 regions each), it seems to happen most with orc units...

Is this choppiness the result of trying to simultaneously place 6 units at once every time an enemy dies? It doesnt seem to be the case because when i took away the script for all regions but one (meaning only 1 unit gets potentially placed) i still get the choppiness.... I have run out of ideas at this point. all i know is i do not have this problem in classic, only reforged.... There is a LOT going on in my game. all kinds of moving parts, a bunch of things happening in the background and scripts are constantly running so i am aware there might be something not directly related to the scripts in question that may be causing the issue. could it be im just overwhelming the system with too much stuff? If that is the case, why do i only experience the choppiness when i kill units? will try to show you the exact script im using.

Lastly, im a total newb and this is my first real project and im learning on my own so im aware there are probably dozens upon dozens of things im doing wrong. if you happen to see something blatantly wrong with my script that may be unrelated, please let me know. i want to do this right.

Thanks for reading and i hope i may be able to learn something from yall. This community has been nothing but awesome to me ever since i discovered it and i have a lot to be thanking yall for already :)

EDIT: It should be noted i have kill-triggers in place to stop the unit count from getting out of control. as soon as unit count for a given enemy player reaches a certain point (500) all scripts relating to placing enemy units turns itself off. once the number of units drops below 400, the triggers turn back on
Also, the image posted is for 1 unit placement. each of these triggers contains 6 of these segments of script so you are only viewing 1/6th of the trigger you're looking at... Im sorry i do not know how to post the script normally for yall
 

Attachments

  • for hive.png
    for hive.png
    132.6 KB · Views: 40
Last edited:

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,570
How to post your trigger

1) You're definitely creating A LOT of memory leaks. Looking at the trigger in your picture I see 1 guaranteed Point leak and in the worst case scenario 4 Point leaks in total. These leaks will accumulate as the game goes on and as the trigger runs again and again.

See Things That Leak for more information about Memory Leaks.

2) The issue is probably due to the unit creation since Reforged has a harder time handling this. Also, you're doing a lot of calculations there whenever a unit dies. This trigger could definitely be optimized.

3) I've also heard to never use "Do nothing", but it could be bs and completely irrelevant. Do keep in mind that it serves no purpose besides visual clarity.

I'd have to see the map and run through all of the triggers to get a better idea about other problems, etc...
 
Last edited:
Level 4
Joined
Apr 29, 2020
Messages
59
How to post your trigger

1) You're definitely creating A LOT of memory leaks. Looking at the trigger in your picture I see 1 guaranteed Point leak and in the worst case scenario 4 Point leaks in total. These leaks will accumulate as the game goes on as the trigger runs again and again.

See Things That Leak for more information about Memory Leaks.

2) The issue is probably due to the unit creation since Reforged has a harder time handling this. Also, you're doing a lot of calculations there whenever a unit dies. This trigger could definitely be optimized.

3) I've also heard to never use "Do nothing", but it could be bs and completely irrelevant. Do keep in mind that it serves no purpose besides visual clarity.

I'd have to see the map and run through all of the triggers to get a better idea.

oh man.... so ya, ive heard about memory leaks and, to be completely honest, have spent very little effort in coming to understand them and how to deal with them. I really have no more excuses at this point, i mean i've spent probably close to 500 hours on this since the beginning of April so i may as well start doing that right... Please correct me if im wrong, i need to destroy the point after it has been placed and conditions checked, right? ... I would love to try to optimize this trigger but i have no idea how to go about doing it. As for "do nothing", its kind of weird because you get the same result when you dont use it so i actually could see it just being unnecessary.

If you are serious about looking through my triggers i would absolutely LOVE to share the map with you. However, there is a bunch of stuff, and you may find you're just going to get overwhelmed trying to figure it all out. One of the biggest problems with my triggers is that my understanding of how to make effective triggers has evolved over the course of this project and while i have fixed a lot of my band-aid fixes to be written out properly, you're going to find a lot of wonky stuff that may not make much sense. (For example: I didnt realize the "turn off this trigger" action could be placed as the first action of a trigger for a very long time into development, so i have a bunch of extra kill triggers that are essentially a bit of a waste. I have fixed a lot of them, but there are still a bunch that i decided werent worth the time to track down and fix.) If you are seriously interested i will DM you the map. BTW if you are interested, what i have complete is actually pretty fun imo :) im looking to set up another test run once i have finished all my side quests (currently working on side quest #34 out of 45). This thing really is nearing completion i just need to finish tying up the loose ends and figure out this reforged issue.... and, now that it really has come to this, fix memory leaks. I guarantee you everything that could have a potential memory leak will have one, because i have not really addressed this issue yet. I do not know exactly how this affects the game. I have had one random crash recently that was about 2 hours into a test run that i thought might be attributed to memory leaks, but again, i really dont know as much as i should about them at this point.

Thank you for your input :) just gimme the word and ill dm you the map
 
Level 4
Joined
Apr 29, 2020
Messages
59
How to post your trigger

1) You're definitely creating A LOT of memory leaks. Looking at the trigger in your picture I see 1 guaranteed Point leak and in the worst case scenario 4 Point leaks in total. These leaks will accumulate as the game goes on as the trigger runs again and again.

See Things That Leak for more information about Memory Leaks.

2) The issue is probably due to the unit creation since Reforged has a harder time handling this. Also, you're doing a lot of calculations there whenever a unit dies. This trigger could definitely be optimized.

3) I've also heard to never use "Do nothing", but it could be bs and completely irrelevant. Do keep in mind that it serves no purpose besides visual clarity.

I'd have to see the map and run through all of the triggers to get a better idea.
oh, thx for showing me how to post trigger :) I was trying copy paste. didnt think to copy as text
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,570
No problem, and I suppose I could take a peak through the map, you can PM me it using the Pastebin feature on the site. Create a Pastebin, attach the map to it, then PM me the link to the Pastebin.

And if I were you I would worry about optimizing that death trigger first and seeing if that fixes the choppiness before going Leak-fixing crazy. Everyone recommends cleaning up memory leaks as it's good practice but at the same time I really don't know if it'll make all that big of a difference. I wouldn't want you to spend hours and hours fixing these leaks just to find that the performance gain was unnoticeable.
 
Level 4
Joined
Apr 29, 2020
Messages
59
No problem, and I suppose I could take a peak through the map, you can PM me it using the Pastebin feature on the site. Create a Pastebin, attach the map to it, then PM me the link to the Pastebin.

And if I were you I would worry about optimizing that death trigger first and seeing if that fixes the choppiness before going Leak-fixing crazy. Everyone recommends cleaning up memory leaks as it's good practice but at the same time I really don't know if it'll make all that big of a difference. I wouldn't want you to spend hours and hours fixing these leaks just to find that the performance gain was unnoticeable.

awesome! thx so much :) and thank you for the advice. you should find the pastebin in your pms.
 
Status
Not open for further replies.
Top