Tutorial Reducing Load Times

Steel

Software Engineer
Reaction score
109
I've decided to post a bunch of information about reducing the load time of a map. I wanted to make a list for people to reference for their own usage. This will be broken down into different sections.

The first and easiest way to improve the load time of your map...

External Programs
Widgetizer
PitzerMike said:
The Widgetizer converts the object data files in Warcraft maps to SLK tables and TXT files. Additionally the WTS strings of the map are internalized. This will result in a remarkable decrease of loading time (up to 80 percent).
Vex's Optimizer
Vexorian said:
Optimize maps, make them smaller and faster, even unopenable in World Editor if you want them to.

The Widgetizer does more for the load time than the Optimizer. The Optimizer reduces the size of your map rather drastically. Each of these are widely used and provide a very simple way to enhance your map.

(Note: These tools have many options and I highly recommend checking the ReadMe files that are included with them. I will post more details about the options on these programs as a quick reference.

Internal Editing
Now this is the more complex and difficult portion of this tutorial. I've spent endless amounts of time attempting to reduce the load time of my own map and I'd like to share my knowledge of the subject.

1) Abilities - Custom abilities can increase the load time dramatically depending on what you've done with the data in them. If you have an ability with multiple levels, it is essentially have 10 different abilities. If you have 10 abilities with 100 levels each, your map will take quite long time to load. This goes the same for all abilities, item abilities, or whatever else.

How to fix: Well, there really isn't a way to fix this unless you as the map maker can come to a compromise about your abilities.

Random Note: If you use the abilities already in the map and modify them, instead of creating new custom abilities, this will actually reduce the load time. Modified Customized Ability is better than using a new Custom ability. The problem there is you cannot organize them so it can be rather annoying. There is only 1 of each ability, so you cannot use the Channel ability to create many different abilities so you could run out abilities to use.

Random Note II: The last 90-100% of the load bar is custom abilities

2) Other Object Editor Data - You have other sections of the Object Editor that we need to take a look at. You have the units, items, doodads, destructibles, doodads, buffs and upgrades. All these sections can be looked at in the same way as abilities, but most of them cannot harm the load time that badly aside from 1 section. Units, if you have many many custom units, this will increase the load time quite a bit. Especially if these custom units are preplaced on your map and doubly so if they have custom abilities even still if they have multiple custom abilities and further if those have many levels.

Items, Destructibles, Doodads, Buffs and Upgrades do not really impair the load time that much. Although if you were to have 1,000 custom Items, this will be slightly noticeable.

3) Preplaced Heroes - If you have heroes placed around on your map, they will increase the load time of your map. The Hero needs to have their models loaded as with everything, but they have more data with them. The main data that is housed inside a hero is their abilities. Abilities as I've listed above can cause a long load time, doubly so if you have a high multi-level ability on a preplaced hero.

How to fix: Execute a trigger after .01 seconds have elapsed on the map, and create the unit's where you need them. When you create a hero unit on the map, there is a large amount of lag associated with it. So after the map starts up, you can have some simple text on the screen that gives information to help mask this lag. Display the text and then immediately after that create the units. The players should be reading the text and the text will linger there while your map hiccups from lag to create the hero(es).

I do not recommend creating many heroes in a single go. Create 1 hero, then wait .5 seconds, create another. You can do this however you like, but go around and test it yourself until you find how you want it to work.

4) Preplace Units - Much like the heros the more preplaced units you have can increase the load time. Now, mind you not nearly as much. 50 Preplaced units isn't nearly as bad as ONE Preplaced Hero with 11 abilities (Spellbook, 11 abilities of 1 level each). So this might not be much of a problem. This portion isn't that critical, but if you have over 100 preplaced units then I'd recommend attempting to fix this.

How to fix(Must have New Gen JASS Pack): Have a trigger create all your units at .01 elapsed time. This might sound daunting because if you have 100 units, it will not be fun creating all those triggers for each unit. So here we go, an example. Create a new map and place 10 footmen anywhere on the map. Now go to the Custom Script on your map and on the first line, create a single character like, \. This will cause your map to throw back an error when you go to save it. This is what we wanted. When the error comes up there will be a screen highlighting the character you put into the map. The window actually houses your entire map's script (All the triggers you wrote and the ones the game creates for various other reasons). Now, copy all of the text and paste it into Notepad, or whatever you like. The paste may lag your computer for a few seconds if you have a great deal of data. If your preplaced units are from Player1-10, look for the triggers entitled CreateUnitsForPlayer# (CTRL-F for Find) , these will have a bunch of triggers in them that create the units. If you placed your 10 footmen on your map for player 1, you will see CreateUnitsForPlayer0 (Remember 0 in reference to JASS is Player 1, arrays start on 0, thus this is the beginning/first player), you will see a bunch of...
set u = CreateUnit(p, 'hfoo', x, y facing)

Copy that whole trigger and paste the code in your map's custom script section. Important!! Change the NAME of the trigger to something else! Now, you can call the trigger at the .01 starting point.

5) Triggers - Triggers do increase the load time of your map, but not even close to the amount of the other listed. My map has about 35,000 lines of code and I hardly notice a difference in the load time if I completely remove all of the triggers. So you don't have to worry about this.



I'll be adding more information to this as well as several demo maps showcasing this in examples.

Breakdown:
-Many Custom Abilities with Multiple Levels are the worst of the worst
-Preplaced heroes (with abilities) are just as bad
-Preplaced units (Over 100) are bad, but not nearly as noticeable as the previous 2
-Triggers should never be a real problem.
 

Larcenist

REP: Respect, Envy, Prosperity?
Reaction score
211
Custom abilities can increase the load time dramatically depending on what you've done with the data in them. If you have an ability with multiple levels...

That is going to take it's toll on my maps for sure...

Very useful tutorial, make sure to add more info.
 

UndeadDragon

Super Moderator
Reaction score
447
Good tut, very useful.
 

Evoroth

New Member
Reaction score
11
You have released me from a shadow of disknowledge about mapmaking. It will be very useful.
 

Zedzy

ℑΣÐℑΨ
Reaction score
41
Thank you :). I was always wondering why map map loaded so slowly.

I just have a quick question first, how would 1 custom ability with a lot of levels be = to many custom abilities with 1 level? Some of the data is used for all the ability levels, like the model, icon, etc.
 

Oninuva

You can change this now in User CP.
Reaction score
221
What I would like to know is if Widgetizer and Vex's Opt can be used together?
 

Arkan

Nobody rides for free
Reaction score
92
They can, use the widgetizer first, then the optimizer. Filesize will be a bit bigger compared to only using optimizer, but it will load faster.
 

Kenoriga

Ultra Cool Member
Reaction score
34
Random Note: If you use the abilities already in the map and modify them, instead of creating new custom abilities, this will actually reduce the load time. Modified Customized Ability is better than using a new Custom ability. The problem there is you cannot organize them so it can be rather annoying. There is only 1 of each ability, so you cannot use the Channel ability to create many different abilities so you could run out abilities to use.
I believe the increase in load time is not much, since I read somewhere that the only thing that adds to the size of the map is the new ability ID.

The difference in size between a default edited Footman and that same Footman as custom unit is the new unit ID (like h001...).
?
 

GoGo-Boy

You can change this now in User CP
Reaction score
40
Perhaps in "Map Size" and not "Loading Time"?
Because if you create units with abilities that weren't used before and have many levels it most likely WILL lag.
 

Steel

Software Engineer
Reaction score
109
I believe the increase in load time is not much, since I read somewhere that the only thing that adds to the size of the map is the new ability ID.

?

Yes the load time between the two is the same, but if you have a regular footman and a custom unit, both of these have to be loaded individually.
 

~GaLs~

† Ғσſ ŧħə ѕαĸε Φƒ ~Ğ䣚~ †
Reaction score
180
Basicly, widget and the optimizer can actually do most of the job for decreasing map size and loading time. (Up to around 70-80%)

DotA is a great example of the 2 software. It is filled with alot, alot of object data(custom) but it is so unbelievable that it only takes like 5 sec to load it on my computer of 256mb ram.

Correct me if I am wrong. :p
 

Steel

Software Engineer
Reaction score
109
Basicly, widget and the optimizer can actually do most of the job for decreasing map size and loading time. (Up to around 70-80%)

DotA is a great example of the 2 software. It is filled with alot, alot of object data(custom) but it is so unbelievable that it only takes like 5 sec to load it on my computer of 256mb ram.

Correct me if I am wrong. :p

Looking at the map in World Editor, absolutely nothing is preplaced. All units and buildings are created at .01 elapsed seconds. Also, all rects / regions are also created at .01 elapsed seconds.

Also, DoTA uses a lot of the default unit's in the Object Editor and modifies them instead of creating numerous custom units.
 

~GaLs~

† Ғσſ ŧħə ѕαĸε Φƒ ~Ğ䣚~ †
Reaction score
180
>>All units and buildings are created at .01 elapsed seconds.
I do agree with this.

>>Also, DoTA uses a lot of the default unit's in the Object Editor and modifies them instead of creating numerous custom units.
The custom one's is far more than the default one.
 

AceHart

Your Friendly Neighborhood Admin
Reaction score
1,495
> Random Note: If you use the abilities already in the map and modify them, instead of creating new custom abilities, this will actually reduce the load time.

Agreed. This is very random.


> Looking at the map in World Editor, absolutely nothing is preplaced.

This should also have "random note" in front of it, so people don't accidentally start to believe it.



No one notices the difference between a loading screen that takes 20.7 seconds as opposed to only 20.3 seconds.
On the other end, every single player in the game notices 0.5 seconds lag once the game has already started though.


There's also no difference between creating 50 Footmen automatically, and creating 50 Footmen "by hand".
The model, unit, abilities, ..., only ever need to be loaded exactly once.
Both ways.
If it doesn't lag when you do that when the game has already started, then no one can possibly notice anything if it happens in the loading screen.
And, please, don't try to tell me that it takes several seconds to create 50 Footmen either....
 

Steel

Software Engineer
Reaction score
109
> Random Note: If you use the abilities already in the map and modify them, instead of creating new custom abilities, this will actually reduce the load time.

Agreed. This is very random.

> Looking at the map in World Editor, absolutely nothing is preplaced.

This should also have "random note" in front of it, so people don't accidentally start to believe it.
This is referring to the map DoTA, I have an unprotected version of the map I'm looking at.


No one notices the difference between a loading screen that takes 20.7 seconds as opposed to only 20.3 seconds.
On the other end, every single player in the game notices 0.5 seconds lag once the game has already started though.
Yes this is true, but it very heavily depends on your computer. .3 seconds of lag on a computer with 3.4ghz and 2 gigs of ram doesn't translate the same as a computer with lower specifications. So reducing any amount of load time that you possibly can will increase performance of most systems. Think of it like Linux. Linux runs exceptionally quick on my laptop (Core 2 Duo with 2 gigs of RAM) BUT Linux can run on a computer from about 1986 because of the way it is designed. People with computers that are 5 years old are still playing Wc3, so you can't simply load up as much data as you want without expecting ramifications.

There's also no difference between creating 50 Footmen automatically, and creating 50 Footmen "by hand".
The model, unit, abilities, ..., only ever need to be loaded exactly once.
Both ways.
If it doesn't lag when you do that when the game has already started, then no one can possibly notice anything if it happens in the loading screen.
And, please, don't try to tell me that it takes several seconds to create 50 Footmen either....
The times between these are minimal in difference yes, but your computer still needs to record the locations of those units. Go create a map, create a map with 50 preplaced units, load up WC3 and go look at your MemUsage for WC3 during the load time. Then, go to your map again and trigger the units to be created at .01. The MemUsage during the load time will remain lower than the previous attempt. Yes, the FINAL result of MemUsage will be about the same, but reducing the load (load meaning data being processed) during the map's loading time is much better for the users. As I said you can mask the little lag hiccups when you create unit's in your map by placing text on the screen for a user to read. It will appear that your map is just pausing for you to read the text, but in actuality you are loading the person's computer with data.

As a programming AceHart, I do not create data unless I know the user is going to be using it. For example, I will never make a
local group g = CreateGroup()
unless I know I'm going to use g right away.
JASS:
function foo takes integer i returns boolean
local group g  = CreateGroup()//Shouldn't create group here
local unit u
if i>1 then
//1 call DestroyGroup(g)
//2 set g = null
return false//This condition would cause out group g to leak
endif         //So we have to add in //1 and //2

//3 set g = CreateGroup()
//This should be executed here since a terminating condition is passed.

loop
    set u = FirstOfGroup(g)
    exitwhen u==null
    //Some code
    call GroupRemoveUnit(g,u)
endloop
call DestroyGroup(g)
set g = null
return true
endfunction


I could write an example in C++, but I wanted all the users of this forum to read and understand what I'm saying here.

The same applies to WC3, say you have an AOS of 90 heroes like dota. Only 10 heroes are selected in a 5v5. Why would you want to preload the other 80? You wouldn't. The loadtime is dramatically reduced because the mapper finds it more beneficial for a player to lag for a few moments in game instead of at the load time. This is how DoTA functions.

The same principle applies to spells in an AOS, if you have 80 heros and some use certain custom models, there is no reason to preload those custom models if the hero that uses them isn't even selected in the game.

This can apply to a TD or RPG as well, in a TD if you don't get to level 50 or whatever, why preload those units? In an RPG if you don't get to section XYZ of the RPG, why load the units from that area?

It's all a matter of creating the data when you need it, not loading all the data in a single swoop.
 

Chocobo

White-Flower
Reaction score
409
Instead of speaking in the place of a +2 ghz computer, try to speak with a 950 mhz with Windows SP2 installed with 1 anti-virus on protection : a unnoticable lag from high speed computers are noticed easily on low speed computer (for instance one hero created on a melee game generates 1 sec cpu freeze on my computer while others have nothing).


>The times between these are minimal in difference yes, but your computer still needs to record the locations of those units. Go create a map, create a map with 50 preplaced units, load up WC3 and go look at your MemUsage for WC3 during the load time. Then, go to your map again and trigger the units to be created at .01.

You don't have to care about the memory usage during loading time, it's useless since you see nothing.
50 footmen after init = freezes for a short time slow computers


>In an RPG if you don't get to section XYZ of the RPG, why load the units from that area?
To prevent the small freezing (which leads you to die) when you preload the units from that area.


>This can apply to a TD or RPG as well, in a TD if you don't get to level 50 or whatever, why preload those units?
Time is time when you are on a race on a TD. A small freeze when you need to force a tower to attack the unit you want can lead to lose ^^


>Yes, the FINAL result of MemUsage will be about the same, but reducing the load (load meaning data being processed) during the map's loading time is much better for the users.
Prove it. Currently, Administration tools > says the reverse.
Creating units while pre-placed = peak at loading only
Creating units after init = peak after start (and for me, peak for about 1.5 sec)
 

Steel

Software Engineer
Reaction score
109
The times between these are minimal in difference yes, but your computer still needs to record the locations of those units. Go create a map, create a map with 50 preplaced units, load up WC3 and go look at your MemUsage for WC3 during the load time. Then, go to your map again and trigger the units to be created at .01. The MemUsage during the load time will remain lower than the previous attempt. Yes, the FINAL result of MemUsage will be about the same, but reducing the load (load meaning data being processed) during the map's loading time is much better for the users. As I said you can mask the little lag hiccups when you create unit's in your map by placing text on the screen for a user to read. It will appear that your map is just pausing for you to read the text, but in actuality you are loading the person's computer with data.
Already stated how to mask the loading lag. Please re-read this.

Prove it. Currently, Administration tools > says the reverse.
Creating units while pre-placed = peak at loading only
Creating units after init = peak after start (and for me, peak for about 1.5 sec)
You don't quite understand what I'm saying. When you have preplaced units your peak load is on the loading time, then after that point it settles down. When you load things after init, then you peak for a bit and it returns to normal.

From my own map and extensive testing, with preplaced units the map would take about 47 seconds unoptimized in windowed mode to load.
With optimization it would take about 32 seconds to load.
With loading after map init the map took about 36 seconds
With loading after map init and optimization it took about 17 seconds.

This data is compiled while testing my map an average of 15-20 times per map. I have a huge spreadsheet with the data compiled on 3 different machines with multiple scenarios such as: Full Map Load, Full Map Load without Doodads, Full Map Load without Preplaced Units, Full Map Load without any OE abilities, Full Map Load without any OE data, Full Map Load without Imported files...

I've done a lot of research about this and I thought I'd share my knowledge about the subject. After the posts by you and AceHart telling me that I do not know what I'm talking about, I'm discouraged to continue any further information I have. I'll not be updating this post, and feel free to graveyard this now.

Steel, out.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top