|
|
Line 1: |
Line 1: |
|
|
This developers article has been moved to http://globulation2.devjavu.com/ |
|
Every tick, the function Map::growRessources() is called, which iterates over the board growing resources. The algorithm is: |
|
|
|
|
|
|
|
Please go there to find in. Thank you. |
|
Along the X axis of the map, examine every 4th row, starting at a random row between 0 and 3. For each examined row, start at a random square between 0 and 15, then move right by a random number between 0 and 31 squares until you reach the end of the row. |
|
|
|
|
|
|
⚫ |
|
|
If there is no resource there, do nothing. |
|
|
|
|
|
Else, look at a square rand(15) - rand(15) squares to the right, and rand(15) - rand(15) down. In other words, binomially distributed around the current square. We'll refer to that as point 1. Also, look at the square twice as far away in the same direction (point 2). Also, look at the square the same distance in the other direction (point -1). |
|
|
:* If there is alga on the current tile, do nothing unless there is water at point 1 and sand at point 2. |
|
|
:* If there is wood or wheat on the current tile, do nothing unless there is water at point 1 and NOT sand at point -1. |
|
|
:* Else, carry on no matter what |
|
|
|
|
|
If the current size of the resource is less than or equal to rand(7), the resource grows by one square. Else, if the resource is capable of extending, it attempts to extend into a random square next to the current one (and does nothing if it fails) |
|
|
|
|
⚫ |
[[Category: Developer Resources]] |
|
Revision as of 07:25, 8 April 2007