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

[Solved] How to test the "weight" of your map

Status
Not open for further replies.
Level 8
Joined
Oct 2, 2013
Messages
288
What I mean by "weight" is CPU, Memory and other things that I'm frankly not 100% sharp on.

My understanding so far is that leaks will increase the memory of your map and CPU is affected by how much is going in the map at the current moment. But I'm ready to be wrong about these things.

My current method is to have Task Manager open on my second screen and watch the numbers. For instance I can ask a trigger to spam like crazy just to confirm if it's leaking or causing a lot of stress. But I'm not sure if this is the right way to do it... In fact I'm not even 100% sure what numbers to look at.

I would really appreciate some enlightenment on the subject.
What is the best way to test your map in this matter and what should I be most aware of?

Thank you so much for looking into this :)
 

Dr Super Good

Spell Reviewer
Level 63
Joined
Jan 18, 2005
Messages
27,190
My understanding so far is that leaks will increase the memory of your map and CPU is affected by how much is going in the map at the current moment. But I'm ready to be wrong about these things.
Leaking objects leaks both memory and complexity. The result is that some operations weigh more.
My current method is to have Task Manager open on my second screen and watch the numbers. For instance I can ask a trigger to spam like crazy just to confirm if it's leaking or causing a lot of stress. But I'm not sure if this is the right way to do it... In fact I'm not even 100% sure what numbers to look at.
Be aware that Warcraft III has only 1 heavy thread so on modern multi-core processors it can use at most 1/N of the total CPU power where N is the number of threads which can be 1 or 2 times the number of cores.
What is the best way to test your map in this matter and what should I be most aware of?
Frame rate is usually a good indicator, especially if your hardware is low end or very old. Solid 50 or 60 FPS means good performance. Less than that or if there is stutter means there is an issue.

With Lua you can use the local CPU timer to get more accurate measurements of execution time.
 
Level 8
Joined
Oct 2, 2013
Messages
288
This is very informative. Thank you as always Dr Super Good.

My hardware is pretty solid and I sit on about 150-200 fps normally according to in-game /fps. But even so I want to be assured that my maps can work on lesser computers as well. Which is why I want to pay a lot of attention to solid triggering and test the amount of preassure they apply.

I have noticed that some maps have recently started using longer initializations where the game doesn't actually start until 5 seconds in. From what I understand this is to avoid desync on Bnet because of a high load of initialization settings. I imagine this could also happen using heavy transitions through-out a map. But perhaps that's an entirely different issue when we talk about internet connection rather than raw computer preassure.

Either way it's nice to have some solid guidelines when looking out for these things.
 

Dr Super Good

Spell Reviewer
Level 63
Joined
Jan 18, 2005
Messages
27,190
I have noticed that some maps have recently started using longer initializations where the game doesn't actually start until 5 seconds in. From what I understand this is to avoid desync on Bnet because of a high load of initialization settings. I imagine this could also happen using heavy transitions through-out a map. But perhaps that's an entirely different issue when we talk about internet connection rather than raw computer preassure.
With Lua coroutines one can stagger the execution of an initialization trigger over 5 or more seconds. This would prevent significant frame drops or the notorious "waiting for player" at map start issue.
My hardware is pretty solid and I sit on about 150-200 fps normally according to in-game /fps. But even so I want to be assured that my maps can work on lesser computers as well. Which is why I want to pay a lot of attention to solid triggering and test the amount of preassure they apply.
If one sets a solid target of 120 FPS or 180 FPS that should encompass most players even with older hardware. Sure they might not get 180 FPS but they should get at least 30 or more consistently which is more than playable.
 
Level 8
Joined
Oct 2, 2013
Messages
288
With Lua coroutines one can stagger the execution of an initialization trigger over 5 or more seconds. This would prevent significant frame drops or the notorious "waiting for player" at map start issue.

Would it also be an option to load triggers in time intervals? Say every 0.5 second I load a few things and after a couple of seconds I have completed my initialization. Or is it safer to do that after a good amount of Elapsed Time at the start?

By the way, thank you for responding to Freeman's thread on the US Forums, that was me ^_^
I was thrilled to see that your help is everywhere!
 

Dr Super Good

Spell Reviewer
Level 63
Joined
Jan 18, 2005
Messages
27,190
Would it also be an option to load triggers in time intervals? Say every 0.5 second I load a few things and after a couple of seconds I have completed my initialization. Or is it safer to do that after a good amount of Elapsed Time at the start?
Well there technically is not an issue with running a lot of code at map initialization. The main problem with it is that it causes clients to freeze which results in the "waiting for player" lag screen.

As for recommended times. I have personally had no issue with map initialization for most things however maybe what I ran was not intensive enough to cause problems. Otherwise 0 seconds elapsed is also good since it mechanically occurs after map initialization. If you want to stagger code then running it in half, quarter or eighths of a second would be sufficient without making the code too unmaintainable. The finest meaningful granularity would be about every 0.02 seconds, since most Warcraft III systems update at most at that rate. One could break initialization down into sections which run every major interval, or into small pieces which run at minor intervals, something only conveniently possible with Lua coroutines.

Be aware that this is referring to pure trigger initialization and processing. If any object types are created for the first time (did not exist on map before) then extra time should be given for them as they case both asset resource stalls as well as can be computationally intensive to load. Loading many at once can easily cause waiting for player lag screens to show due to difference with player CPU and IO speed. I cannot recommend a rate based on experience but I would suggest trying 0.1 seconds for this and adjusting that value up or down depending on how much performance is impacted.

In any case with Lua coroutines one can yield the executing thread and resume it at a later time. This allows one to write linear code with waits at regular intervals rather than a mess of many triggers or timers with different start times.
 
Last edited:
Level 8
Joined
Oct 2, 2013
Messages
288
This is a perfect detailed explanation. I really appreaciate it.
I'm surprised that Warcraft 3 frames are as short as 0.02, I thought it used to be a bigger number (less fps).

If any object types are created for the first time (did not exist on map before) then extra time should be given for them as they case both asset resource stalls as well as can be computationally intensive to load.

Do object types refer to units, doodads, destructables, pathing blockers, regions and special effects? Essentially anything you can "place"?

What about variables with high array numbers (like 1000), to what extend should I consider to cut down for the sake of lightening my map? I assume this may not be a big deal for a variable type like Integer. But how about Unit arrays or Timer arrays in the thousands? In this particular case they won't actually have a value, it will be filled in as the game progresses.
 
Level 39
Joined
Feb 27, 2007
Messages
4,992
Size is almost always irrelevant for array variables. You can usually leave it at 1 since all it does is assign the chosen default value to the first N indices. The only cases I’m aware of in which it could matter are groups/forces that you add units/players to individually instead of assigning the group variable to a getter function like “units in region matching...”.
 
Level 8
Joined
Oct 2, 2013
Messages
288
Thank you Pyrogasm for this info.

Size is almost always irrelevant for array variables. You can usually leave it at 1 since all it does is assign the chosen default value to the first N indices.
I'm probably misunderstanding you. Are you talking about the default values of the arrays in a variable? Or are you saying that the number of arrays of a variable increase automaticly? Why is there an option to put an array amount?

Sorry if I misunderstood.
 

Dr Super Good

Spell Reviewer
Level 63
Joined
Jan 18, 2005
Messages
27,190
Or are you saying that the number of arrays of a variable increase automaticly?
JASS arrays are dynamic arrays which will increase in size as higher indices are used.
Why is there an option to put an array amount?
Because it allows one to initialize some number of indices of an array to a value. For example if an array is being used to map player slot number to income and one wants all players to start with 100 income then one would set the array to size 24 and default value to 100.
 
Level 8
Joined
Oct 2, 2013
Messages
288
Because it allows one to initialize some number of indices of an array to a value. For example if an array is being used to map player slot number to income and one wants all players to start with 100 income then one would set the array to size 24 and default value to 100.

Apologies. I think I misphrased that. I understand how arrays work and that the number of arrays in a variable is not to be confused with a the default value of an array in a variable.

To me it sounded like Pyrogasm was saying that the number of arrays a valuable had didn't matter if the default value is none/null. This doesn't surprise me for an integer variable, but I was wondering if same goes for Timer or Unit variable with 10000 arrays or if that would be heavy weight even if it had no valid values to begin with. The reason I asked why there is an option to put an array amount was because I thought Pyrogasm was saying that the number of arrays (not default value) would automaticly increase as you filled them in. But then it didn't seem to make sense why you would have the option to set the amount of arrays (not default value) of a variable.
 

Dr Super Good

Spell Reviewer
Level 63
Joined
Jan 18, 2005
Messages
27,190
but I was wondering if same goes for Timer or Unit variable with 10000 arrays or if that would be heavy weight even if it had no valid values to begin with.
It technically also does not matter as long as you assign the appropriate object to them before using the index. This requires custom script due to the short comings of GUI.
The reason I asked why there is an option to put an array amount was because I thought Pyrogasm was saying that the number of arrays (not default value) would automaticly increase as you filled them in. But then it didn't seem to make sense why you would have the option to set the amount of arrays (not default value) of a variable.
The size field is entirely there to initialize a range of an array to a default value. This includes creating objects which would otherwise require custom script to create due to short comings of GUI.
 
Status
Not open for further replies.
Top