Grass - TomHulme/306-Swarm-Robotics-Project GitHub Wiki
Overview
The grass node belongs to a field node, and there is a grass object created to control the growth of each grass. It subscribes to the soil quality coming from the field node robot, along with the sunlight value, and uses these in a formula to control grass growth.
Growth
Grass growth is monitored on a scale of 0-100%. Depending on how much the grass has grown, it will rotate on the left side of the grass. The grass growth is deducted as such:
netGrowth = growth - decay
Where growth and decay are % growth and % decay per second.
Field Affecting Grass
Growth is caused by: sunlight conditions and soil quality. Decay is caused by: sheep eating.
growth(%/s) = soilQuality * (sunlight+50)%
Which means that growth is the soil quality multiplied by a % sunlight modifier. The soilQuality can range from Arid (1), Normal (2) and Fertile (4). If sunlight was 100%, for example, this value would be multiplied by 150%, which means that more sunlight provides a growth bonus. Rain does not affect grass growth directly, but it does affect soil quality, which affects grass growth.