Maps/Editing

Maps in MegaGlest are created with the Map Editor. However, this editor has changed drastically over time, and now has 3 separate versions with each fork, Glest, MegaGlest, and the Glest Advanced Engine, each with its own strengths and weaknesses.

Factors controlled by maps
Maps can control the layout of objects and the like, but how the objects and surfaces look is actually controlled by the tilesets, how the resources look is controlled by the techtree, and the starting units are controlled by the faction. Maps have control over the placement or attributes of:
 * Land height
 * Water
 * Objects (such as trees or rocks)
 * Player starting locations
 * Resources (such as gold or stone)
 * Surface type (such as grass or road)
 * Camera height level (MGM only)

Limitations

 * Square cell based system, and no way to make curved paths or edges.
 * All objects are defined in the tilesets, and while standards exist, some tilesets may still make objects walkable where they generally are not or entirely different types of objects in place of the standard array.

Glest
The original Glest map editor is virtually unused now, as it is the most difficult to use and lacks the features of the MegaGlest and GAE map editors, which can still make backwards compatible maps for Glest.



MegaGlest
The MegaGlest editor expands on the regular editor, adding image based toolbars, the ability to create gradients for height modifications, mirroring, an undo and redo system, support for up to 8 players, hotkeys, and an expanded menu system. This makes it the editor of choice when making maps, as it is far more powerful than the original map editor and can create backwards compatible maps or cutting edge maps for either MegaGlest or GAE.



GAE
GAE's map editor has similar capabilities to the MegaGlest editor, though it does not yet support mirroring, cliffs, or camera distance defaults. Its menus are more compact than the MegaGlest editor, though it has an experimental feature that lets you view the map as it would be seen in-game.

Map Overview
Maps are single files, that define bi-dimensional matrices of cells, each cell has the following attributes:


 * Height. From 0 to 20. Higher values = higher ground. Lower values eventually become water (the exact amount depends on the water value set
 * Surface type. There are 5 surface types, and the map editor numbering system indicates the texture file itself depends on the tileset.
 * Object. A cell can have an object or not, there are 10 types of objects, object models depend on the tileset, but in general terms, objects 1 and 2 are trees, 3 is stone, 4 and 5 are bushes, objects from 6 to 9 can be anything and 10 is an invisible blocking object.
 * Resource. Resources can be placed on cells, and can be gathered by units for use in the game. Objects and resources cannot share the same cell at the same time. Resources depend on the Tech Tree.

Maps also define the start locations for each player, map size, altitude factor, and water level. Maps cannot define the placement of units or buildings.

Map Display
The map display, the main part of the map editor window, reflects the current state of the map. The map is divided into cells, each cell has a state: height, surface type, object type and resource type. The way the map reflects the state of the cells is as follows:

Note: Objects and resources cannot share the same cell.
 * The big, colored X's show the location of each player starting point.
 * Intensity of color reflects height (elevation).
 * The darker the color is, the lower the height of the cell.
 * The lighter the color is, the higher the height of the cell.
 * Color reflects the surface type:
 * Light Green: Surface 1
 * Dark Green: Surface 2
 * Brown: Surface 3
 * Gray: Surface 4
 * Red: Surface 5
 * A small X means that there is a resource on the cell, the color of the 'X' indicates the resource type.
 * A dot means there is an object on the cell, the color of the inverted dot, indicates the object type.

Users may interact with the map as follows:
 * Left clicking over the map or to move the mouse while pressing left button modifies the map.
 * Moving the mouse while pressing the right mouse button scrolls the users viewing location on the map.
 * Moving the mouse while pressing the center button or shift+right mouse button zooms the map view.

Radius
The radius combo box is always available and indicates the number of cells modified when editing the map, a radius of one modifies only one cell, a higher radius modified more cells. Note that radius is the distance to the center, not the distance across (which is diameter). For example, setting a radius of 3 when "painting" the tree object will let you you create a 5x5 block of trees (note that it is not a true square, nor a true circle, but rather a square with rounded edges). This can make it easier to create thick paths, large forests, etc.

Height
When a height radio button is selected, users can alter the map surface height. Lower heights eventually become water, though the exact amount depends on the water level parameter, set in the advanced menu option. In MegaGlest, you can also specify the camera height to make default for the map, handy for maps that are based on taller heights.

Starting Points
Each player requires one starting point, this point is the map location where the initial and units are placed. If there is not enough space at the starting point to place all units and buildings, an error will occur and the game will not load.

Surfaces
When the surface radio button is selected, users can edit map surface type(s). Surface texture types vary between individual tilesets, but the default settings are:
 * Surface 1 - Grass
 * Surface 2 - Secondary Grass
 * Surface 3 - Road
 * Surface 4 - Stone
 * Surface 5 - Custom

Objects
When the object radio button is selected, users can place objects on the map cells. Objects depend on the tileset, but the default settings are:
 * Object 0 - Erase
 * Object 1 - Tree (unwalkable)
 * Object 2 - Dead Tree (unwalkable)
 * Object 3 - Small Stone (unwalkable)
 * Object 4 - Bush (walkable)
 * Object 5 - Water Object (walkable)
 * Object 6 - Big Tree (unwalkable)
 * Object 7 - Hanged/Impaled (unwalkable)
 * Object 8 - Statue (unwalkable)
 * Object 9 - Large rock (unwalkable)
 * Object 10 - Invisible blocking object (unwalkable)

Resources
When the resource radio button is selected, users can place resources on a map cell. Resource types depend on the tech tree selected, but the default settings are: Note: Tech trees can use objects as resources. The difference is that 3d models for objects are defined on the tileset while resource 3d models are defined on the tech tree.
 * Resource 0 - Erase
 * Resource 1 - Gold
 * Resource 2 - Stone
 * Resource 3 - Undefined
 * Resource 4 - Undefined
 * Resource 5 - Undefined

Player and Resource Placement

 * At least 10 tiles (cells) of gold, stone and wood (trees) at the player starting point locations, and at least one smaller 5 tile resource area nearby.
 * Generic maps space players equally apart, with team based maps grouping allied factions together, in consecutive numbering (eg: Player 1 and 2 would be together, not player 1 and 3).
 * Multiplayer maps differ from generic maps and place allies closer together, and those allies may also share gold and stone resource sites.
 * Ensure starting locations are large enough to support the players base, even on larger factions with more buildings. There should generally be enough space to fit at least twelve buildings comfortably with at least 2 tiles between.
 * Ensure AI units do not become stuck between buildings and nodes while harvesting in large groups. Placing unwalkable objects next to resources may lead to unit stacking.

Paths

 * Paths through objects connect all players.
 * Path should be at least five tiles wide. Paths that are narrower become difficult for the pathfinder to navigate.
 * Sidepaths can be used to resource havens, these can be narrower but should still be at least 3 tiles wide.
 * Paths should be as simple as possible, avoiding tricky mazes, as the AIs pathfinder struggles on difficult paths.
 * Avoid dead end paths other than for resource havens, as they tend to confuse the player.
 * Try to have the paths follow the geography and height of the land.

Map Objects

 * Statue and gallows objects should be used infrequently. Both look good at trail intersection points and on isolated islands.
 * Mossy Rocks/Big Rocks need to be surrounded with the pink colored invisible blocking object (object 10). This prevents units from walking "inside" the rock, due to the fact its large size causes it to be larger than the size of a single tile.
 * Bushes add realism to forests and along riverbanks, so should be used often.
 * Small stones look good but use them sparingly and in appropriate locations. They should not be used where players are expected to place buildings, as they interfere with building placement.

Surfaces and Height

 * Surface textures 1 and 2 are used as the primary surface type.
 * Surface textures 3 and 4 are used for roads, trails, as well as ocean and lake shorelines and at player starting locations.
 * Surface texture 5 does not always have a texture available, and is not recommended for use on maps.
 * Avoid completely flat maps. Varying topography makes the maps more realistic, natural, and aesthetic.
 * Try to use a difference surface such as the road or stone surfaces for shorelines to make them more interesting.
 * Use different textures for bordering roads to create a road "shoulder".

AI Pathfinder

 * Avoid choke-holds that could snag units. Ensure edges are smooth if the pathfinder is trying to get on the other side of an unwalkable barrier.
 * Avoid twisting the paths between players, as the pathfinder tends to get stuck in such places.
 * If there is objects in the center preventing passage, ensure the edges of the objects are smooth to prevent the pathfinder from trying to walk through them.