Optimisation (part 1)Renders:
I will often refers to 'Renders
' in this topic, it is because that is the statgraph value i use most to guess
timate optimisation in a specific area.
How to proceed:
- in Editor, look at the desired area, double tap 'Backspace' key to return in normal CoH view and zoom
- turn on StatGraph. (in menu 'Advanced')
- We will take care of the 'render()' value:
Something to know about CoH map making, is that this value can be used to see critical area very quickly. In this example, the value here is 183. For a 3vs3 map this value is very very good, so this specific area will not cause lags.
Try as much as you can to stay lower than the following limits if you want to be sure to avoid critical areas for CoH engine, especialy if the area will see some battle. Stay bellow those limits as much as you can, especialy for area that will see a lot of combats.
- 1vs1 : 550-600 renders() max per view (use regular Coh view angle as reference)
- 2vs2 : 450 renders() max
- 3vs3 : 350 renders() max
- 4vs4 : 250 renders() max
Unfortunatly, in a lot of area in this map, we go far beyond the limits in renders(). One of my tasks here will be to make everything possible to lower renders in combat areas to descent values. Layout and map design is very good so i don't plan to touch those 2 aspects, especialy since there is already a lot of people that worked on this map.So when we see in some 3v3 or 4v4 maps, with certain combat area showing 800+ renders, you can easily understand why CoH engine just give up and will tell you to GTFO with your 15 fps max in battle, despite your warmachine PC. This also apply for certain Solo maps conversion to MP: those maps were originaly designed with a different render() limit in mind!Objects Barely visible: (and more)
The 1st thing i noticed and that was confirmed in editor, is the amount objects that were sometime barely visible. I started to remove the multiples hidden (or nearly) sandbags or debris for examples, to reduce the number of objects per screen, to save some renders. by doing that arround the church, we went from 600+ renders to a more acceptable 350 renders.
- Rumbles. In the urban area of the map, lets say that 1/3 of small debris objects are not visible or so few that we can remove em and sometimes move a little bit the one next to it to occupy the same visual space. There is also some Debris Mounts splats in coh library that can be used to fil some holes in critical area.
- Trenches. There is a ton of additionnal sandbags objects used to look good, it does look great, but the problem is that trench walls (like every wall in the game) are already extremely costy for renders(). having a lot of long walls in the same area is not good in CoH engine. Trenches make no exception, so we have to remove as much additionnal objects as we can without affecting gameplay or overall trench design..
- Sandbags. A lot of them where completly invisible under other sandbags, removed those without mercy. For those barely visible and stacked with other sandbags, I removed the most hiddens, and modified position of the remaining sandbags objects to fill the holes and look the same as before, as much as possible. So far i did that on.. lets say half of the total trenches. We should go over all of it.
- Trees. As you probably know, maps full of tree in CoH or BK = laggy map. So i will do my best to reduce tree number in dense pine forests, to look as close as possible but idealy i want to loose 1/3 or 1/4 tree on those pine forests.. So the job here will be to select which pine to remove without affecting the visual. So far i only removed a couple of trees, i will do that in last.
- Bushes. Usualy this is not really causing lags in Coh maps, but near Axis spawn there is a huge double line of bushes that is too close to the trenches. Because trenches are so hard to optimise, i had to reduce drasticly the number of bushes there too, taking care of removing those that were less important. for visual and gameplay.
Splats are some textures item that you can drop on the ground, it will overlap ground textures Tiles
. it doesnt lag, and sometimes it looks nearly the same as if you used an object (that cost renders). For example, there is some dirt and mud splats that are very often used, but also some impacts and craters, and there is a ton of splats to help you to gain FPS and have a fancy map. In La Chaudiere case, i will only use some Rumble splats to fil certain holes where i was forces to remove rumble models to save some renders. Water Sources:
2nd thing that got my attention was the water sources.
Once in editor i counted 40+ sources in the map, including those in OoB (most of em where in OoB). But still, this is way too high. Something to know about water sources in CoH engine, is that they multiply calculation of objects arround the water source(s) displayed on screen, because of the reflection of course. So when you place any water source in combat area, you will have to keep the amount of surrounding objects as low as possible, because each of them will be calculated twice, even those who are not reflected. (it is again multiplyed if multiple water sources are present in the same screen area).
So when you place like 3 water sources in the bottom of a trench, with a lot of trench walls and sandbags arround, you basicaly create a nightmare for the engine.
For water sources in OoB, it is way less impacting, as there won't be any playable units reflected and players will most likely never look there during battle. However 40+ was too high, so for example in OoB, I regrouped each 4-5 mini ponds into a bigger pond. Same amount of water, looks a little bit different but it's 5 times cheaper.
For trenches, i had to take drastic mesures as it's in a combat area: deletion of all trenche's water sources, as this kind of trenches by themselves are already one of the biggest source of lags in maps (i detailled above why).
Fortunatly, we can use a trick to simulate water in a trench
, a ditch texture that fit very nicely to this purpose.. Once manipulated and once the 'flooded' terrain flattered, we can apply a spline texture that looks similar to the water source, but for no engine cost at all.
Here is some examples of texture replacement:
So, for now, I removed/converted to texture all in-map water sources except for the lake.. And reduce OoB water sources to its minimum.
Let's compare to an other map where the issue also forced me to remove water: Why do you think i had to remove the 5 water sources that I used in earlier betas of Berlin 1945
? It was reflecting all surrounding buildings and was makin the map lag!
So now you know exactly why the Spree is dry in the original Berlin 1945 map that will be in the next map pack.Tiles:
The Tiles tool in Editor looks very easy to use, but there is some tips to know to help engine in case of a big map (for all 3v3 or 4v4 idealy you want to follow this rule to the letter)
In TILE tool, hit both 'Layer Count
' and 'Chunks
The following screenshot, took after the 1st step of tile optimisation, show some red and green numbers in a grid.
- Grid is showing you 'Chunks' of the map,
- Numbers displays how many different tiles are used on each chunk.
The color is there for a reason: red is bad
!In La Chaudiere case
, i applied 2 steps
of Tile optimisation.
Originaly it had 8 different Tiles textures, and numbers where nearly all red, with some area with high values (certain parts had all 8 tiles on it). This is bad for optimisation ofc.
So far, on La Chaudiere,
- To make my job easier (and faster) i choosed to delete 2 Tiles sets on the 8 total: but i choosed very carefuly.
1st thing to take care of was to know which 2 sets where the less important to the map, and the less used. there was 2 different grass sets, and the map design could be very much using only one, so i know that one of those 2 grass sets had to say goodbye. At the left of each Tiles set, there is a Tickbox that will display which area use this Tileset, by overlapping the color next to the tickbox (grey by default). Change this color to something flashy, tick the box, and you can now see how much this texture is used.
Thats how i choosed the less used grass texture. Fortunatly the default tile was the other kind of Grass: when you delete a tilee, the area where this tile was painted will be filled by default tile (the very first you have in you map when its blank).
So when i removed the less used grass tile, all areas that where painted with it were automaticaly painted with the other grass. handy.
I noticed after that there was 2 sets of Dirt tiles: but one was used only on a tiny part of the map. All other tiles where too important or covered too much area to be removed.
As my default tile is grass, i dont want that muddy Dirt tile to be replace by some grass. So i Ticked the tickbox and selected flashy color for display. I took a couple of muddy splats and placed em over all areas where this Muddy Tile was used. Splats will look nearly identical, and its only on a small area of the map anyway.
- Cool we have now deleted 2 tiles on 8, but we still have crazy amount of Tiles used on each chunks squares. Thats is the 2nd Step of Tile optimisation:
By seelcting a certain Tile set, then clicking the 'eraser' icon button, and then left click on a chunk, we remove the selected Tile set from all the chunk square.
So play with tiles set tickbox to see where some tiles are not visible (or nearly), and erase this tile from this chunk. Sometimes a single pixel painted with 1% of the Tile set per an chunk area, is enough to count one more tile per chunk, despite its absolutly not visible that this tile is painted there. but coh engine doesnt care, he considers that you will have to load all those tile sets to display that specific area. Thats is how and why reducing tiles per chunk is important.
i will stick to the 6 tiles i kept, I reduced a lot of tiles per chunk, but i have to continue to reduce tiles per chunk to have no area above 4. Green (3) is the best, but for some area its not possible to have only 3 tiles per chunk.Ground (heighmap):
haha, uncovered.. yet
. But as its quite a huge part, i will later write here a description of various methods and tricks i use for ground optimisation.Thats it for now, stay tunned for more optimisation blabla!