Free and Open Source real time strategy game with a new take on micro-management

Difference between revisions of "Terrain"

From Globulation2

Jump to: navigation, search
m (ProgVal moved page Terain to Terrain over redirect: revert vandalism)
 
(5 intermediate revisions by 4 users not shown)
Line 1: Line 1:
The following is written after a day spent looking at Map.h - it shouldn't be considered as definitive.
This developers article has been moved to http://globulation2.devjavu.com/


Squares of terrain are defined by three basic properties - the undertile, the main tile, and the main tile's subtype.
Please go there to find in. Thank you.


The undertile is the primary property, which the other two values are based on. The undertile is set manually (e.g. in the editor) to either water, sand, or grass. Since water and grass aren't allowed next to each other, sand is inserted in-between.
[[Category:NewWiki]]

The main tile is generated from the undertile, through a somewhat mysterious process in Map::lookup(). The map tile used for a given square is based on the undertile of the current square, and the undertiles of the squares immediately below, right, and below-right of it. I suspect this process might be to do with handling edges correctly - for example, grass at the edge of an ocean (and at the corner of a pool) appears to be a special type of main tile. However, that is just speculation - I'm not even sure that the main tile will be of the same type as the undertile (e.g. the undertile could be water, the main tile sand).

The main tile's subtype is a random number between 0 and 7, or sometimes 0 and 15. It doesn't convey any meaning, it just controls which exact image is displayed for the tile.

[[Category:en]]
[[Category:Developer Resources]]

Latest revision as of 20:54, 15 August 2017

The following is written after a day spent looking at Map.h - it shouldn't be considered as definitive.

Squares of terrain are defined by three basic properties - the undertile, the main tile, and the main tile's subtype.

The undertile is the primary property, which the other two values are based on. The undertile is set manually (e.g. in the editor) to either water, sand, or grass. Since water and grass aren't allowed next to each other, sand is inserted in-between.

The main tile is generated from the undertile, through a somewhat mysterious process in Map::lookup(). The map tile used for a given square is based on the undertile of the current square, and the undertiles of the squares immediately below, right, and below-right of it. I suspect this process might be to do with handling edges correctly - for example, grass at the edge of an ocean (and at the corner of a pool) appears to be a special type of main tile. However, that is just speculation - I'm not even sure that the main tile will be of the same type as the undertile (e.g. the undertile could be water, the main tile sand).

The main tile's subtype is a random number between 0 and 7, or sometimes 0 and 15. It doesn't convey any meaning, it just controls which exact image is displayed for the tile.

Misc