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

Difference between revisions of "Gradients"

From Globulation2

Jump to: navigation, search
m (category:en)
Line 12: Line 12:
Gradients are first defined for individual squares in various functions, then those values are propagated around using the Map::propagateGradient() function. Gradients are reduced by one for every square away from a target item (e.g. a wheat square for the wheat gradient).
Gradients are first defined for individual squares in various functions, then those values are propagated around using the Map::propagateGradient() function. Gradients are reduced by one for every square away from a target item (e.g. a wheat square for the wheat gradient).


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

Revision as of 01:24, 2 October 2009

Glob2 directs globs around by means of gradients. For example, to find the nearest wheat fielda glob moves to the adjacent square with the highest wheat gradient repeatedly until it hits a wheat square. This is referred to as a "hill-climbing" algorithm.

Each cell on the map has a "gradient" defined for each player, for swimming and non-swimming globs, for each of the following actions:

  • Forbidden area
  • Guard area
  • Every type of resource

In other words, there are (TotalCells * TotalPlayers * 2 * (2 + TotalResources) cell gradients defined.

Every building also has a gradient map, used to guide globs to the building.

Gradients are first defined for individual squares in various functions, then those values are propagated around using the Map::propagateGradient() function. Gradients are reduced by one for every square away from a target item (e.g. a wheat square for the wheat gradient).

Misc