Manipulating the terrain in order to decrease the scenario filesize
From AgeofWiki
| Table of contents |
1.0 - Welcome
How many times have you designed a mad crazy map for use over ESO
, with amazingly lush terrain features, only to be frustrated at every turn when people don't want to download it because it's 1000KB too big? There are four reasons why your map's filesize is too large. This guide will help you with one of them.
Disclaimer: A lot of the understandings I have about how the AoM engine works comes from simple observation. I am neither a programmer nor a game designer. Others, such as CheeZy_Monkey, have helped me to understand a lot of the principles given below. Lastly, some of the terminology might seem quaint to some of you scripter/programmer types. Please forgive me.
2.0 - "Why is my map's filesize so big?!?!"
Like I said, there are 4 things that affect your map's/scenario's filesize. One of them, simply put, is entirely your fault - you put too many bloody objects on the map, beit units, buildings, trees, rocks, waves, whatever. Another might be unavoidable, depending on the needs of your map or scenario; that being triggers. Yes, each trigger you make increases filesize of your scenario, but we won't bother with that. Triggers are essential to how a map or scenario is played out. There are a few things you can do to cut down on the number of triggers, like combining effects and such, but filesize saving is minimal.
The final two things that affect filesize are related. One being MAP SIZE and the other (and what we will deal with in this guide) is TERRAIN FEATURES. Lemme 'splain how they are related, then I will get on with dealing with the issue.
2.1 - Vertices, Tiles, and Filesize, Oh My
First, to understand how terrain features such as mountains and hills are presented we have to understand the basics of your map's size or dimensions.
The size of a map is determined by N number of tiles x N number of tiles. A "tile" is really just the space between where Grid Lines meet, which we'll call Vertices(singular: Vertex). The graphic below illustrates this:
2.1.1 - "So, how does all this have to do with my map's filesize?"
Well, because the way the terrain on your map is presented to you in 3D form is by assigning coordinates to each of the vertices created by the intersection of all those nice grid lines criss crossing your map. So, in essence the larger the dimensions of a map (measured in tiles), the larger the number of grid lines, the larger the number of vertices, the larger the number of coordinates that must be stored in the scenario file (scx). One could also look at that progression in reverse as well - it's all related.
2.2.2 - How the above has to do with "Terrain Features" and this guide
The coordinates of each vertex has an X, or width, variable, a Y, or depth, variable, and also a Z, or height, variable. Right? Knowing this is key to understanding how mountains, hills, valleys, and oceans affect your map's filesize. We must also basically understand how AOM, the game itself, tries to save filesize and exploit it with that knowledge.
What AOM's engine does to save filesize (and perhaps simplify the code? <It would complicate it if anything. --Pete 22:34, 25 Jan 2005 (GMT)Pete>) is whenever an N amount of vertices are A.) adjacent to each other, and B.) the same height, the Z coordinate (height, remember?) can be assumed for all the adjacent vertices. In essence, the AOM engine can drop 1 of the 3 coordinate numbers for each of the vertices, thus saving filesize. It's a form of filesize compression. It's an extremely easy concept and will soon open doors for you to manage your map or scenario's filesize to make everyone happier who plays your gorgeously designed map over ESO (so they don't have to wait 10 minutes for the bloody map to download from you, plus it helps others spread your map around).
Basically, what we will do is exploit to the fullest the way the AOM engine tries to save (compress) file space.
"Taunt 010 - Are you ready?.mp3"
"Taunt 001 - Yes.mp3"
3.0 - Flattening Terrain Made Easy
After you have completed the map design for your scenario, go ahead and turn on the terrain grid (in the "Show" menu at the top) and check out how the vertices of your map terrain are fairing. As you can see below, it probably doesn't look too promising in the filesize department, huh?

Probably not a single darned pair of adjacent vertices is at the same height, requiring your scx file to do things the hard way, taking up more disk space. So, what we'll do is find an area of "relative flatness" like a valley or field of grass or something. It's not completely flat, creating a larger file size, so we'll make it flat.
Choose the "Adjust Elevation" Tool and choose the Brush Size for the job. The Brush Size is really up to you, so experiment a little. You will then raise the elevation of the to-be-flattened area until it hits the elevation ceiling. It should flatten out on its own at that height. Make sure that once you click the mouse button to raise the terrain you don't move the cursor, because it'll do some weird and undesirable things to the terrain height.

Finally, make sure to position the brush exactly over the raised area, then lower the newly flattened terrain down to the proper elevation, corresponding roughly to the elevation of the surrounding terrain...

...and you've taken the first and very easy step to reducing your map's filesize.
4.0 - Hill Country
After mastering the art of flattening prairies or other lower areas, it's time to move on to those beautiful rolling hills (read: additional KBs) you peppered throughout your map.
Choose a hill and, again, the correct Brush Size for the job...

Follow the steps from "3.0 - Flattening Terrain Made Easy"...

And now, you've "flattened" the top of a hill to save filespace...

Still looks pretty natural, eh?
5.0 - When the Going Gets Rough...
Okay, now that you've mastered both points 4.0 and 3.0, you'll start to notice some areas where the differing flattened elevations of terrain stick out like a sore thumb. This usually happens along the edge of a flattened area when it connects to another area of different elevation. This is where the trusty Smooth Tool comes in.
Set the appropriate Brush Size of the [b]Smooth[/b] Tool so that you don't "smooth" too much of the flattened areas. Unfortunately, the more of the flattened area you "smooth" the less "flat" it is, and that's the opposite of what we're trying to do. I usually set the Brush Size to 2x2.
Then what you do is simply smooth the edges of the flattened area into the surrounding terrain. It's that easy, and it makes a beautiful transition between the different heights between the flattened and unflattened areas. It can look extremely natural.
The following two graphics illustrate the entire 5.0 process (albeit, in exaggerated form):

When performed on two terrains that are closer in elevation, the result is seemless. Experiment for yourself to see which |brush settings are best for which situation.
Remember, the important thing is to smooth the edges between slightly different elevations in order to create a natural transition. Too much smoothing negates some of our previous file savings.
6.0 - The Abyss
And now we've come to the final piece of the pie - Ocean. The water is an often neglected area of the map, but can be one of the more important areas when trying to reduce your map's file size.
You've painted your map with some beautiful Aegean Sea water, but look closer to the terrain beneath the gentle undulating sea...

The terrain beneath the layer of water is still rendered the same as if it were above water. That means if we want to fully optimize this sucker we'll have to dive right in and get wet. The upside of it is this is the easiest area of all to flatten, because all you have to do is use the "Elevation Tool" and [b]lower[/b] the terrain beneath the water to its lowest possible point, thus flattening it completely.

Flatten the terrain completely, as close to the shoreline as to where the sand stops.

Applying this guide to maps with a large amount of water is crucial and almost mandatory.
And that's it! :) If you come too close to the shore and the shoreline gets too rough for you, use the same SMOOTH technique applied in section 5.0.
7.0 - In Conclusion...
That wasn't so hard now, was it? Apply this technique to any large multiplayer or single player scenario or map you want whenever you want to reduce the size of your scx file for easier and swifter up/downloading. This technique may also cut down on lag caused by slower video cards, although that hasn't been tested. It has been my experience when applying this technique to my Peloponnesian War scenario (a 930x930 map) that over 200K was shaved off of the file size, from well over 1MB to around 800K.
The original document may be found [1] (http://aom.heavengames.com/cgi-bin/forums/display.cgi?action=ct&f=13,20757,0,10)here.
