Jeckel
Great Reverend
I've always thought the Civ4 game world is to static. This Tile is always Snow, this one always has Ice. What if Tiles had a Temperature, Humidity, Wind Currents, ect. Then Ice Features could melt away when the temp rises or appear when the temp falls. Forests could have a higher chance of catching on fire when they are dry.
Now add in things like Tornado, Hurricanes, and Thunderstorms.. and now it gets interesting.
New Game Mechanic: Air Temperature
When a map is created each Tile is given a Random Temperature. This is done durning the Terrain Generation phase of Map creation, and just after the Plot's TerrainType is set.
Two new tags in the TerrainInfo XML file allow you to control the lowest and highest Temperatures for each Terrain. A Tile's Air Temperature can be slightly higher or lower then these values, but not by much.
This alone creates a very chaotic Initial Temperature Scheme, so I have added 4 new functions to CvPlot. One each to normalize the Temperature Scheme of Land Plots, Lakes Plots, Coast Plots, and Ocean Plots.
I have used slightly different methods in each of the functions, but the basic idea is a follows.
All Land Plots are Normalized first. I go through each Plot and check the Temperature of its 8 adjacent Plots. Only other Land Plots are checked. I get an average of all 9 Plots (the Plot we are checking and the 8 adjacent) Temperatures and apply that. The Lowest and Highest Temperatures of the Plot's Terrain Type are respected and there is some random rolls in there so things don't get to static.
Next Lake Plots are Normalized. I go through all plots and grab those that are isLake() == true. For the moment, I have the Normalize Coast code shoved in here, but I am laying out a better way of giving Lakes their proper Temperature.
Next we Normalize Coast Plots. Coast Plots are any Water Plot that is adjacent to a Land Plot and isn't a Lake. I , again, average the Temperature of the Plot and its 8 adjacent Plots. I then take the lowest Temperature of the 9 checked Plots, add that to the Average Temperature, and divide that new value by 2. This function still needs a little bit of work.
Lastly Normalize the Ocean Plots. Ocean Plots are all Water Plots that aren't Coast. This one is pretty simple. Instead of checking the 8 adjacent Plots, I get an average of all Land and Coast Plots (but NOT Lake Plots) and add a small random factor to it. This is then set as the Oceans Air Temperature.
I run these four functions in that order at the end of Map Creation. They are run in the CvMapGenerator::afterGeneration() function and are called before the call to the Python Map Script afterGeneration() method.
So these seem to generate a resonably realistic Temperature Scheme. There are still a few things that need tweeking, for example I think the Oceans need a some kind of Temperature change as you get father from land, but it is definetly good enough for the moment.
New Game Mechanic: Wind Direction
Air Temperature is great and all, but it isn't much more then a framework to build on. The first thing I have hung on it is Wind Direction. The concept and a few of the new functions are taken from Dom Pedro II's Conqueror's Delight Mod, Naval Mod Compent, so props to him.
At the end of Map Creation, in the CvMapGenerator::afterGeneration() function just before the Python Map Script afterGeneration() method is call and just after the Normalize Temperature functions are called, each Plot will have an Initial Wind Direction set on it.
The Initial Wind Direction is a little more complex then the Normalize Temperature ones. For each Plot on the Map I get the 8 adjacent Plots. Each of those adjacent Plots is given a Weight. For each Plot surrounding those adjacent Plots, the adjacent Plot's Weight is raise. Tiles with a Temperature higher then the origional Plot's Temperature add the most, equal Temperatures add some, and lower Temperatures almost nothing.
Again, not perfect yet, but definetly close. I am almost done laying out some Normalize Wind Direction code that will pull the whole thing together.
New Game Mechanic: Weather Systems
Weather Systems is the title for things like Tornados, Thunder Storms, Hurricanes, ect. I am currently going with the idea of Weather Systems being Units. So far I have Tornados and Thunder Storms added in.
They don't really do much yet, but I did manage to get them moving around on the Wind Currents. I planning things like damage to Units in the same Tile, increased/decreased Food from Tiles, increased/decreased Happiness/Health in Cities, and maybe some other stuff.
New Game Screen: Weather Patterns
I've added a new Screen, 'SHIFT + W', that allows you to see a Map of the World with a Colored Overlays showing Air Temperatures, Wind Directions, and Weather Systems. This screen also has some options to modify the new Systems when World Builder is active.
Not much coding wise this week, RL is pretty busy, but I'm laying thing out on paper in my free time. Besides some tweeks to what is already done, my next coding goal is to add in Moisture and the in game spawning of Weather Systems.
Now add in things like Tornado, Hurricanes, and Thunderstorms.. and now it gets interesting.
What is Done
New Game Mechanic: Air Temperature
When a map is created each Tile is given a Random Temperature. This is done durning the Terrain Generation phase of Map creation, and just after the Plot's TerrainType is set.
Two new tags in the TerrainInfo XML file allow you to control the lowest and highest Temperatures for each Terrain. A Tile's Air Temperature can be slightly higher or lower then these values, but not by much.
This alone creates a very chaotic Initial Temperature Scheme, so I have added 4 new functions to CvPlot. One each to normalize the Temperature Scheme of Land Plots, Lakes Plots, Coast Plots, and Ocean Plots.
I have used slightly different methods in each of the functions, but the basic idea is a follows.
All Land Plots are Normalized first. I go through each Plot and check the Temperature of its 8 adjacent Plots. Only other Land Plots are checked. I get an average of all 9 Plots (the Plot we are checking and the 8 adjacent) Temperatures and apply that. The Lowest and Highest Temperatures of the Plot's Terrain Type are respected and there is some random rolls in there so things don't get to static.
Next Lake Plots are Normalized. I go through all plots and grab those that are isLake() == true. For the moment, I have the Normalize Coast code shoved in here, but I am laying out a better way of giving Lakes their proper Temperature.
Next we Normalize Coast Plots. Coast Plots are any Water Plot that is adjacent to a Land Plot and isn't a Lake. I , again, average the Temperature of the Plot and its 8 adjacent Plots. I then take the lowest Temperature of the 9 checked Plots, add that to the Average Temperature, and divide that new value by 2. This function still needs a little bit of work.
Lastly Normalize the Ocean Plots. Ocean Plots are all Water Plots that aren't Coast. This one is pretty simple. Instead of checking the 8 adjacent Plots, I get an average of all Land and Coast Plots (but NOT Lake Plots) and add a small random factor to it. This is then set as the Oceans Air Temperature.
I run these four functions in that order at the end of Map Creation. They are run in the CvMapGenerator::afterGeneration() function and are called before the call to the Python Map Script afterGeneration() method.
So these seem to generate a resonably realistic Temperature Scheme. There are still a few things that need tweeking, for example I think the Oceans need a some kind of Temperature change as you get father from land, but it is definetly good enough for the moment.
New Game Mechanic: Wind Direction
Air Temperature is great and all, but it isn't much more then a framework to build on. The first thing I have hung on it is Wind Direction. The concept and a few of the new functions are taken from Dom Pedro II's Conqueror's Delight Mod, Naval Mod Compent, so props to him.
At the end of Map Creation, in the CvMapGenerator::afterGeneration() function just before the Python Map Script afterGeneration() method is call and just after the Normalize Temperature functions are called, each Plot will have an Initial Wind Direction set on it.
The Initial Wind Direction is a little more complex then the Normalize Temperature ones. For each Plot on the Map I get the 8 adjacent Plots. Each of those adjacent Plots is given a Weight. For each Plot surrounding those adjacent Plots, the adjacent Plot's Weight is raise. Tiles with a Temperature higher then the origional Plot's Temperature add the most, equal Temperatures add some, and lower Temperatures almost nothing.
Again, not perfect yet, but definetly close. I am almost done laying out some Normalize Wind Direction code that will pull the whole thing together.
New Game Mechanic: Weather Systems
Weather Systems is the title for things like Tornados, Thunder Storms, Hurricanes, ect. I am currently going with the idea of Weather Systems being Units. So far I have Tornados and Thunder Storms added in.
They don't really do much yet, but I did manage to get them moving around on the Wind Currents. I planning things like damage to Units in the same Tile, increased/decreased Food from Tiles, increased/decreased Happiness/Health in Cities, and maybe some other stuff.
New Game Screen: Weather Patterns
I've added a new Screen, 'SHIFT + W', that allows you to see a Map of the World with a Colored Overlays showing Air Temperatures, Wind Directions, and Weather Systems. This screen also has some options to modify the new Systems when World Builder is active.
What I'm Working On
Not much coding wise this week, RL is pretty busy, but I'm laying thing out on paper in my free time. Besides some tweeks to what is already done, my next coding goal is to add in Moisture and the in game spawning of Weather Systems.