blackbutterfly
Emperor
It's not so much a "bug" that's an error. Rather it's code that isn't actually working as it's supposed to. A bug in the traditional sense.
I will just outline the problem. A corrected solution is in Scrambled Australia.
Firaxis tried to produce an Australia that has more desert in the centre, but if you look at the maps it generates that isn't the case. The reason is the logic is flawed.
Desert is generated using a fractal/tectonic algorithm:
http://modiki.civfanatics.com/index.php?title=Fractal.GetHeight_(Civ5_API)
Assuming the API is the same as Civ V, getHeight() gives you the value of the z-axis. i.e. the height of the plain, hill or mountain. Basically this API is being used incorrectly:
iDesertTop = deserts:GetHeight(125); -- over 100 due to adjustment for proximity to center of continent
Just reading the API docs will tell you that the above is wrong. It takes a % parameter.
desertVal = deserts:GetHeight(iX, iY) - iDistanceFromCenter + 25;
This value (which determines if the tile is desert or not) is being varied by the distance from the centre but it's meaningless cos all you are varying is the z-axis value.
Instead you can vary the desert top or bottom:
iDesertTop = deserts:GetHeight(100); -- const
iDesertBottom = deserts:GetHeight(iDistanceFromCenter/iW * 100); -- iW = width
I will just outline the problem. A corrected solution is in Scrambled Australia.
Firaxis tried to produce an Australia that has more desert in the centre, but if you look at the maps it generates that isn't the case. The reason is the logic is flawed.
Desert is generated using a fractal/tectonic algorithm:
http://modiki.civfanatics.com/index.php?title=Fractal.GetHeight_(Civ5_API)
Assuming the API is the same as Civ V, getHeight() gives you the value of the z-axis. i.e. the height of the plain, hill or mountain. Basically this API is being used incorrectly:
iDesertTop = deserts:GetHeight(125); -- over 100 due to adjustment for proximity to center of continent
Just reading the API docs will tell you that the above is wrong. It takes a % parameter.
desertVal = deserts:GetHeight(iX, iY) - iDistanceFromCenter + 25;
This value (which determines if the tile is desert or not) is being varied by the distance from the centre but it's meaningless cos all you are varying is the z-axis value.
Instead you can vary the desert top or bottom:
iDesertTop = deserts:GetHeight(100); -- const
iDesertBottom = deserts:GetHeight(iDistanceFromCenter/iW * 100); -- iW = width
Last edited: