Terraining Smoothness: optimizing performance through terrain
Introduction
Greetings everyone! My name is Mozared and if you care about me or my 'credentials', run a search for the name. This is a guide about optimizing performance through terrain, and I want to get into it!
What does this actually mean? Well, simple; it will make sense to most of you that the more stuff you cram into a map, the more intensive it will be to play (and the longer it will take to load). While there are a lot of techniques for optimizing triggers and data edits, this guide focuses solely on the terraining aspect of performance: if you have troubles with your map having a slow loading time, this guide will show you the tips 'n tricks to improve this problem, at least terrain-wise.
As a short notice - I'll be quoting or paraphrasing some bits from this thread here, as it has a lot of things already typed out.
Here's a short list of the things that you can optimize I'm going to be explain further;
Textures
Doodads
Water
Textures
One of the main reasons performance is lost in the texturing stage of the map is due to people using the 'add texture' option. Whenever you use the 'add texture' button, you paint a texture ON the existing texture. Both get put in the map, but texture B won't be seen because A is on top of it. You can test this yourself - open up a new map and paint a circle of texture #1. Click 'add texture' and put #2 on top of it. Continue until #8. Now use the 'remove texture' and start removing #8 back through #1 - you'll notice each layer coming back up independantly. This can severely increase map size and loading time if you use the 'add texture' button. Use the 'replace texture' button whenever possible to prevent this.
Note that this technique no longer holds merit - terrain stacking is gone, kaput, disappaero. You can use the 'add texture' as much as you like and not lose any form of performance. Scroll down to see more details on the matter.
Doodads
In the doodads category, there are two techniques you can use to increase performance - they are often used together for best effect. Note that since there isn't really a way to 'optimize' doodads themselves, these techniques revolve around placing, not around turning a simple option on and off. These techniques are 1) Enlarging doodads and 2) Placing less of them. In some cases, once your terrain is finished, you'll find you can simply remove some doodads and the looks won't really suffer. In most cases though, these techniques are - like mentioned - combined. What this means is that a couple of doodads are enlarged to abnormal proportions (300-500) and are then used to hide the fact that there are barely no other doodads in the area. For example - a forest existing out of a fifty size-100 trees could also exist out of ten size-400 trees and ten size-100 trees. This allows you to fill up the same amount of space while using less doodads.
Also note that in most maps, where the standard Starcraft 2 camera settings are used, you will never see the terrain from specific angles; this fits in nicely with this idea and allows you to leave some areas completely empty because players will simply never get to look at them.
As a last note in the doodads section: rough guidelines for the amount of doodads you can afford are "about 2000 per player" before they'll start to cause serious lag on lower- to mid-end PCs. Blizzard 1v1 maps tend to use between 1400 and 2000 doodads altogether.
Water
Been careful with doodads and textures and still having FPS drops? Your culprit will most likely be the water in your map. There are two settings revolving water that require a lot of CPU power to work: shore waves & reflections.
For the first, it works like this: it can be assumed that water wasn't intentionally meant to be placed in the way of rivers, but only used for large surfaces as seen often in the campaign. Because of this, the shore wave rendering technique used is a bit odd; it would seem that a straight wave is generated for every line of straight shore the water clashes upon. What this means, is that thin, curved rivers will generate an obscene amount of waves due to the fact that they exist out of large amounts of lines of straight shore - more so than a lake with a relatively 'stiff' shoreline. This is why smaller, more detailed rivers can often cause a huge loss of performance. To disable this function entirely (which makes the looks suffer fairly little but increases terrain performance hugely), go to Modules > Data > Data Type: Water > "Insert the name of your water type" > Set 'Beach Shoreline' to 'None'. Note that 'beach shorelines' are different from 'cliff shorelines', which are the shorelines that fall upon cliffs made with the actual cliff tool instead of the elevation tool. These tend to cause less of a performance drop, but could also be disabled at will.
For the latter, reflections, it is roughly the same case. These settings are changeable in the 'edit water' menu, though. Select the water you're using, click 'edit water' and go to the 'reflections' tab. Playing with the 'minimum reflection' and 'reflectivity power' options here should allow you to increase performance and balance out your terrain between looks and performance pretty well.
As an update; if both these settings are lowered but your water is still giving you problems, try the following: Modules > Data > Data Type: Water > Click the name of the water you are using > double click the value behind "Tiling Frequency". Water is effectively a texture smeared out over several tiles. With the default tiling frequency settings, the water texture is limited to really small tiles, meaning that a LOT of small tiles are needed to fill up one lake. If you turn down the values in this option you'll drastically decrease the amount of tiles needed to fill up a lake (by making each tile larger). This will decrease the looks of the water, but with some fine tuning you should be able to turn this option down by quite a decent amount, saving you up to 10-20 FPS in performance if your map is water-heavy.
That said, I've reached the end of this quick guide. There might still be bloat in your triggers and data, but terrainwise you should be set. Hope it helped :)
Damn... I've been using the "Add Texture" tool alot... Its gonna suck to fix that up. Thanks for the tips though, I never knew terrain habits could have anything to do with performance.
This is a fantastic quick tutorial. I have some questions though. If you use the 'map textures' menu to replace every texture with the same one, will the layering be flattened? Or will it still keep the layers...just with the same texture? And if it does keep the layering, what is the best way to get rid of it?
I am trying to optimize a map I have already created, and I just want to make sure I do it correctly.
Im pretty sure it keeps the layering.
I don't know that much about this, so everything I say in this post is purely theoretic...
I think using texture fill will remove the layering, but thats pretty much gonna remove all other textures as well :p I think your best bet would be to use "Uniform Texture" because I think that should erase all layers (But just in case, try and remove the texture afterwards and see if it works)
Is there any performance to be gained by removing actual terrain that isn't visible? Been awhile since I used the editor but I thought I recalled an option to make an area have zero texture at all.
One of the main reasons performance is lost in the texturing stage of the map is due to people using the 'add texture' option. Whenever you use the 'add texture' button, you paint a texture ON the existing texture. Both get put in the map, but texture B won't be seen because A is on top of it. You can test this yourself - open up a new map and paint a circle of texture #1. Click 'add texture' and put #2 on top of it. Continue until #8. Now use the 'remove texture' and start removing #8 back through #1 - you'll notice each layer coming back up independantly. This can severely increase map size and loading time if you use the 'add texture' button. Use the 'replace texture' button whenever possible to prevent this.
From what I have seen, there are actually only 2 layers. The default terrain (the one you choose when originally making the map) and the custom terrain (anything you paint). I actually tried the above and this isn't what happens. To illustrate my point, make a new map with nothing on it and choose your default terrain. Then start stacking terrain up. Start with a Size 16, then 15, then 14 etc so that you can visually see a ring of each terrain that is s'posed to be below the top circle. Finish by painting your default terrain as the topmost circle.
Now in theory, when you go to remove the top circle, each ring will be revealed under it. Instead, when you attempt to remove the top circle, nothing happens. Then as you attempt to remove each of the rings (starting with the smallest), the circle of default terrain merely gets bigger as each texture is reverted to default terrain.
Thus remove terrain doesn't remove terrain in layers, it merely reverts the chose terrain type to the default terrain. That being said, I don't actually see how this step will improve performance.
Maybe remove terrain just removes all layers at once.
However, I did an excessive test before, stacking tons of terrain layers (several hundreds, I guess), and didn't notice any FPS drops or any other impacts on performance. I also tested spawning units, until my FPS dropped significantly. The results were roughly the same for both terrains, fully stacked and just default one.
So my tests support ProzaicMuze's theory. Either stacking terrain layers is not significant, or its not possible.
I ran some more tests myself; first the standard test of stacking up all textures and then using remove texture. Prozaic seems right here, and my guess was that either the 'remove texture' brush had its function changed or stacking textures has been made impossible.
Then I opened up a 32X32 map and filled the whole map with all textures with the 'add texture' brush. Afterwards I did the same with the 'replace texture' brush. My 'add texture' map ended up being roughly 11 kB and my replace texture map ended up at 10 kB. Because I wasn't sure whether that discrepancy was a result of me missing areas while using the 'replace' function, I did the test again on two 200X200 maps. Replace ended up on 134 kB while add ended up on 130 kB. On a map of that size, 4 kB of difference can easily be explained due to human error.
So yes, my conclusion would be that terrain stacking simply got stealth-fixed. It's not a case of the 'remove texture' brush being edited to remove all layers at once but textures still stacking, the whole thing is just gone. Which makes my life a lot easier :D
Well yes, but that seems fairly obvious - I never thought that stacking textures would make a real difference in terms of FPS. Maybe you'd notice a 1 FPS difference if you had an epic-sized map stacked with all 8 textures everywhere, but that's it. The main reason I hauled up the point was because of the size of the map file. If you had stacked all your 8 textures all over the map you were effectively using 8 times as much room for just your textures. On my 200X200 map, which is now roughly 134 kB, that would mean that with terrain stacking still intact, you'd at worst use 8 X 134 kB = 1072 kB of room where you'd only have to use 134. Which means you'd needlessly gain a full MB of room on your map size.
Terraining Smoothness: optimizing performance through terrain
Introduction
Greetings everyone! My name is Mozared and if you care about me or my 'credentials', run a search for the name. This is a guide about optimizing performance through terrain, and I want to get into it!
What does this actually mean? Well, simple; it will make sense to most of you that the more stuff you cram into a map, the more intensive it will be to play (and the longer it will take to load). While there are a lot of techniques for optimizing triggers and data edits, this guide focuses solely on the terraining aspect of performance: if you have troubles with your map having a slow loading time, this guide will show you the tips 'n tricks to improve this problem, at least terrain-wise.
As a short notice - I'll be quoting or paraphrasing some bits from this thread here, as it has a lot of things already typed out.
Here's a short list of the things that you can optimize I'm going to be explain further;
Textures
One of the main reasons performance is lost in the texturing stage of the map is due to people using the 'add texture' option. Whenever you use the 'add texture' button, you paint a texture ON the existing texture. Both get put in the map, but texture B won't be seen because A is on top of it. You can test this yourself - open up a new map and paint a circle of texture #1. Click 'add texture' and put #2 on top of it. Continue until #8. Now use the 'remove texture' and start removing #8 back through #1 - you'll notice each layer coming back up independantly. This can severely increase map size and loading time if you use the 'add texture' button. Use the 'replace texture' button whenever possible to prevent this.Note that this technique no longer holds merit - terrain stacking is gone, kaput, disappaero. You can use the 'add texture' as much as you like and not lose any form of performance. Scroll down to see more details on the matter.
Doodads
In the doodads category, there are two techniques you can use to increase performance - they are often used together for best effect. Note that since there isn't really a way to 'optimize' doodads themselves, these techniques revolve around placing, not around turning a simple option on and off. These techniques are 1) Enlarging doodads and 2) Placing less of them. In some cases, once your terrain is finished, you'll find you can simply remove some doodads and the looks won't really suffer. In most cases though, these techniques are - like mentioned - combined. What this means is that a couple of doodads are enlarged to abnormal proportions (300-500) and are then used to hide the fact that there are barely no other doodads in the area. For example - a forest existing out of a fifty size-100 trees could also exist out of ten size-400 trees and ten size-100 trees. This allows you to fill up the same amount of space while using less doodads.
Also note that in most maps, where the standard Starcraft 2 camera settings are used, you will never see the terrain from specific angles; this fits in nicely with this idea and allows you to leave some areas completely empty because players will simply never get to look at them.
As a last note in the doodads section: rough guidelines for the amount of doodads you can afford are "about 2000 per player" before they'll start to cause serious lag on lower- to mid-end PCs. Blizzard 1v1 maps tend to use between 1400 and 2000 doodads altogether.
Water
Been careful with doodads and textures and still having FPS drops? Your culprit will most likely be the water in your map. There are two settings revolving water that require a lot of CPU power to work: shore waves & reflections.
For the first, it works like this: it can be assumed that water wasn't intentionally meant to be placed in the way of rivers, but only used for large surfaces as seen often in the campaign. Because of this, the shore wave rendering technique used is a bit odd; it would seem that a straight wave is generated for every line of straight shore the water clashes upon. What this means, is that thin, curved rivers will generate an obscene amount of waves due to the fact that they exist out of large amounts of lines of straight shore - more so than a lake with a relatively 'stiff' shoreline. This is why smaller, more detailed rivers can often cause a huge loss of performance. To disable this function entirely (which makes the looks suffer fairly little but increases terrain performance hugely), go to Modules > Data > Data Type: Water > "Insert the name of your water type" > Set 'Beach Shoreline' to 'None'. Note that 'beach shorelines' are different from 'cliff shorelines', which are the shorelines that fall upon cliffs made with the actual cliff tool instead of the elevation tool. These tend to cause less of a performance drop, but could also be disabled at will.
For the latter, reflections, it is roughly the same case. These settings are changeable in the 'edit water' menu, though. Select the water you're using, click 'edit water' and go to the 'reflections' tab. Playing with the 'minimum reflection' and 'reflectivity power' options here should allow you to increase performance and balance out your terrain between looks and performance pretty well.
That said, I've reached the end of this quick guide. There might still be bloat in your triggers and data, but terrainwise you should be set. Hope it helped :)
Damn... I've been using the "Add Texture" tool alot... Its gonna suck to fix that up. Thanks for the tips though, I never knew terrain habits could have anything to do with performance.
little but important hints to know!
This is a fantastic quick tutorial. I have some questions though. If you use the 'map textures' menu to replace every texture with the same one, will the layering be flattened? Or will it still keep the layers...just with the same texture? And if it does keep the layering, what is the best way to get rid of it?
I am trying to optimize a map I have already created, and I just want to make sure I do it correctly.
@rtschutter: Go
Im pretty sure it keeps the layering.
I don't know that much about this, so everything I say in this post is purely theoretic...
I think using texture fill will remove the layering, but thats pretty much gonna remove all other textures as well :p I think your best bet would be to use "Uniform Texture" because I think that should erase all layers (But just in case, try and remove the texture afterwards and see if it works)
Is there any performance to be gained by removing actual terrain that isn't visible? Been awhile since I used the editor but I thought I recalled an option to make an area have zero texture at all.
I know I'm not a terrain expert by any means, but either a recent update changed things or the following is incorrect:
From what I have seen, there are actually only 2 layers. The default terrain (the one you choose when originally making the map) and the custom terrain (anything you paint). I actually tried the above and this isn't what happens. To illustrate my point, make a new map with nothing on it and choose your default terrain. Then start stacking terrain up. Start with a Size 16, then 15, then 14 etc so that you can visually see a ring of each terrain that is s'posed to be below the top circle. Finish by painting your default terrain as the topmost circle.
Now in theory, when you go to remove the top circle, each ring will be revealed under it. Instead, when you attempt to remove the top circle, nothing happens. Then as you attempt to remove each of the rings (starting with the smallest), the circle of default terrain merely gets bigger as each texture is reverted to default terrain.
Thus remove terrain doesn't remove terrain in layers, it merely reverts the chose terrain type to the default terrain. That being said, I don't actually see how this step will improve performance.
@ProzaicMuze: Go
Maybe remove terrain just removes all layers at once.
However, I did an excessive test before, stacking tons of terrain layers (several hundreds, I guess), and didn't notice any FPS drops or any other impacts on performance. I also tested spawning units, until my FPS dropped significantly. The results were roughly the same for both terrains, fully stacked and just default one.
So my tests support ProzaicMuze's theory. Either stacking terrain layers is not significant, or its not possible.
@ProzaicMuze: Go
I ran some more tests myself; first the standard test of stacking up all textures and then using remove texture. Prozaic seems right here, and my guess was that either the 'remove texture' brush had its function changed or stacking textures has been made impossible.
Then I opened up a 32X32 map and filled the whole map with all textures with the 'add texture' brush. Afterwards I did the same with the 'replace texture' brush. My 'add texture' map ended up being roughly 11 kB and my replace texture map ended up at 10 kB. Because I wasn't sure whether that discrepancy was a result of me missing areas while using the 'replace' function, I did the test again on two 200X200 maps. Replace ended up on 134 kB while add ended up on 130 kB. On a map of that size, 4 kB of difference can easily be explained due to human error.
So yes, my conclusion would be that terrain stacking simply got stealth-fixed. It's not a case of the 'remove texture' brush being edited to remove all layers at once but textures still stacking, the whole thing is just gone. Which makes my life a lot easier :D
I'll update the tutorial.
@Kueken531: Go
Well yes, but that seems fairly obvious - I never thought that stacking textures would make a real difference in terms of FPS. Maybe you'd notice a 1 FPS difference if you had an epic-sized map stacked with all 8 textures everywhere, but that's it. The main reason I hauled up the point was because of the size of the map file. If you had stacked all your 8 textures all over the map you were effectively using 8 times as much room for just your textures. On my 200X200 map, which is now roughly 134 kB, that would mean that with terrain stacking still intact, you'd at worst use 8 X 134 kB = 1072 kB of room where you'd only have to use 134. Which means you'd needlessly gain a full MB of room on your map size.
Damn...I re-textured my entire map which took hours.
Giving this a little bump; I added a little bit regarding water tiling that should allow you to get even more performance out of your water.
Good read, Mozared. Any new findings since this guide has been made?