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
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.
The first and easiest way to improve the load time of your map...
External Programs
Widgetizer
Vex's OptimizerPitzerMike 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).
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.