View Single Post
Old 02-25-13, 06:35 PM   #2
gap
Navy Seal
 
Join Date: Jan 2011
Location: CJ8937
Posts: 8,214
Downloads: 793
Uploads: 10
Default

Hi there,
in this post I will try to explain as clear as I can with my modest english what any SH5 player wanting to use Dynamic Environment should know before enabling it. It is important that you read these explainations carefully, in order to be aware of what you can expect from the mod and to report any issue or malfunctioning. In the first part I will try to explain how SH5 climate/weather settings do work. Skilled modders or experienced players who know better than me this part of the game can jump directly to the second paragraph where I describe the weather system introduced in Dynamic Environment and the process followed for achieving it.

I apologize in advance if in some parts this text will result tedious, obscure, or incomplete, and indeed I wellcome any constructive criticism about our mod and my explainations on it.

here we go:

HOW IT WORKS
All the editable files for SH5 wether generation are located in this path: <Silent Hunter 5/data/Env>. This folder contains several files. The ones whose function I'm going to explain belong to 4 categories:

1) ClimateZones.tga file, representing the global map in Mercator projection. In stock game the map looks like this:



As you can see, sea is represented there by different shades of red. During weather generation, the game engine is compairing our current position with the corresponding red value on the map, and reading it according to 3 different color indices. Incidentally, CTD's caused by some environmental mods were due to colors in the wrong format accidentally introduced in the map, or to colors in correct format but not listed in these indices.

2) ClimateZones.cfg: together with the .tga map, it is the core part of the weather genereting system in SH5. the firts part of the file contains the above mentioned indices, matching any of the red values found on the .tga map with 3 sets of parameters, namely (from their headers):
- Climate Zones settings
- Climate Weather Types settings
- Climate Environment Colors settings

Example from stock SH5:

Code:
[Climate Zones]
DefaultClimateZone=0
Color00=PolarClimateNorthern
Color40=TemperateClimateNorthern
Color80=TropicalClimateNorthern
Color120=TropicalClimateSouthern
Color160=TemperateClimateSouthern
Color200=PolarClimateSouthern

[Climate Weather Types]
Color00=Weather_Polar.cfg
Color40=Weather_Temperate.cfg
Color80=Weather_Tropical.cfg
Color120=Weather_Tropical.cfg
Color160=Weather_Temperate.cfg
Color200=Weather_Polar.cfg

[Climate Environment Colors]
Color00=EnvColors_Polar.cfg
Color40=EnvColors_Temperate.cfg
Color80=EnvColors_Tropical.cfg
Color120=EnvColors_Tropical.cfg
Color160=EnvColors_Temperate.cfg
Color200=EnvColors_Polar.cfg
Climate Zones settings are contained in the second half of the same file. They define seasons for any given area, with their starting and ending dates (numeric format: month/day of the month). These dates are compared with the current in game date, for generating weather conditions based on the resulting season. AFAIK we can have a maximum of 4 seasons (the obvious minumum should be one season). There's no limit to their durations as far as they cover the whole year.
Here is an example taken from stock game ClimateZones.cfg file, belonging to northern temperate area settings:

Code:
[TemperateClimateNorthern]
[TemperateClimateNorthern.Season0]
SeasonName=winter
StartDate=1201
EndDate=0231

[TemperateClimateNorthern.Season1]
SeasonName=spring
StartDate=0301
EndDate=0531

[TemperateClimateNorthern.Season2]
SeasonName=summer
StartDate=0601
EndDate=0831

[TemperateClimateNorthern.Season3]
SeasonName=autumn
StartDate=0901
EndDate=1131
It features 4 seasons equally distributed, but we could remove any season at our wish and/or modify seasons extent over the period of one year.

Another example from stock settings, related to southern polar area:

Code:
[PolarClimateSouthern]
[PolarClimateSouthern.Season0] ; one season for polar zones
SeasonName=winter
StartDate=0101
EndDate=1231
It features just one season (winter) extending for the whole year. Again, we can change this season with any other, or even add other seasons as far as we ensure that their cumulative durations do cover the extent of one year.

I did not carry tests with overlapping seasons, inverted seasons order (for instance summer => spring => winter) or seasons appearing more that once during one year, though, even if possible, I doubt that this kind of settings would help us to render a more realistic seasonal pattern!

It seems logical to me that the occurrence of rain, clouds and fog is generated by game engine pseudorandomly, on the base of current season (defined by in game date and location and ClimateZones.cfg settings). The probability of these occurrences for any given season could be hardcoded. So, unless I'm very much mistaken, the only way to change their chance in game is to play with the presence/absence and relative duration of different seasons, as defined in the .cfg file discussed in this paragraph.

3) Climate Weather Types settings are contained in a set of .cfg files (one file for any weather type we want in game, 3 in vanilla SH5). They define different weather change intervals (min and max values, in hours) and wind speed ranges (again: min and max values) related to the current season. Due to this reference to seasons, it is important to match weather settings with the corresponding ClimateZones area settings. For instance, if we wanted to create/edit a weather type .cfg file corresponding to a climate zone featuring two seasons, we would ensure that it contains entries for the very same seasons.

For example, stock SH5 settings for temperate weather (shared by both northern and southern temperate climate zones) are:

Code:
[Season 0]
SeasonName=winter
MinWeatherChangeInterval=5	; [minHours, maxHours], interval in which to trigger a random weather change
MaxWeatherChangeInterval=96	; [minHours, maxHours], interval in which to trigger a random weather change
MinWindSpeed=1			;
MaxWindSpeed=15			;

[Season 1]
SeasonName=spring
MinWeatherChangeInterval=5	; [minHours, maxHours], interval in which to trigger a random weather change
MaxWeatherChangeInterval=96	; [minHours, maxHours], interval in which to trigger a random weather change
MinWindSpeed=1			;
MaxWindSpeed=15			;

[Season 2]
SeasonName=summer
MinWeatherChangeInterval=5	; [minHours, maxHours], interval in which to trigger a random weather change
MaxWeatherChangeInterval=96	; [minHours, maxHours], interval in which to trigger a random weather change
MinWindSpeed=1			;
MaxWindSpeed=15			;

[Season 3]
SeasonName=autumn
MinWeatherChangeInterval=5	; [minHours, maxHours], interval in which to trigger a random weather change
MaxWeatherChangeInterval=96	; [minHours, maxHours], interval in which to trigger a random weather change
MinWindSpeed=1			;
MaxWindSpeed=15			;
Stock settings for polar weather (only one season, for northern and southern polar climate zones):

Code:
[Season 0]
SeasonName=winter
MinWeatherChangeInterval=5	; [minHours, maxHours], interval in which to trigger a random weather change
MaxWeatherChangeInterval=96	; [minHours, maxHours], interval in which to trigger a random weather change
MinWindSpeed=1			;
MaxWindSpeed=15			;
4) Climate Environment Colors settings are contained in another set of .cfg files (one file for any weather type we want in game, 3 in vanilla SH5). They contain color parameters (in hex color values) for several environmental items (sea, sky, clouds, sun, etc.). In any of these .cfg files, parameters are divided into 3 different sections, respectively for (more or less) sunny, medium overcast and stormy weather. Any section is divided on its turn into several subsections, for different day/night times. Wether/how these colors are merged for intermediate times/weather conditions, or during the transition from a climatic area in the map to the next one (during oceanic passages) is something out of my knowledge. I invite my industrious ;-) friend stoianm to provide us with some clarification on this topic, as this is his undisputed kingdom!

Well, I guess you got enough basics to understand what follows. Time for sticking to the changes introduced with Dynamic Environment:

WHAT WE DID
In stock game we got 3 weather type/environment color zones (Polar, Temperate and Tropical) and 6 climate zone (the former zones x 2, for both northern and southern emispheres). You can spot these zones at first glance by looking at the .tga map posted above.

The first step was adding some new climate/environment colors zones to the map. For doing so, we didn't stick to latitude as main factor for climate change across the globe. As SH5 is a game about people going through the sea, we took oceanic average temperatures as the main factor representing global climate. We are aware that for this arbitrary assuption we are not going to win the Nobel Prize, but after all climatology is a complex science, and we had to simplificate it a lot in order to put it in our game!

This is one of the many maps about global oceanic temperatures we've found on the net:



and this is how ClimateZones.tga map looked like after our first rework:



Red color shades were replaced with custom colors for easing our work. This is the legend:

Black: polar zone;
Blue: subpolar Zone;
Cyan: cold temperate zone;
Green: warm temperate zone;
Yellow: hot temperate zone;
Red: tropical and equatorial zone.

Each of these areas got its own environment color settings.

Next step was adding intermediate areas within the main zones. We could have done it by introducing new color in the map and defining new climate/weather/environment colors zones in .cfg files, but as there's a limit to the zones that could be defined in the .tga map (0 to 255 are the red channel values in RGB color format) and we wanted to have some free space for adding other features, we decided to represent these "in-between" areas by dithering pixel by pixel color values relative to contiguous yet existing zones:



in this image you cannot spot the dithering, as the image itself is a compressed and resized sample. Side effect of this dithering method is that every time you move on your u-boat into intermediate areas, going from pixel to pixel (in game it is equal to a square with side of 40 km), most probably weather will change, providing an higher dynamism during passages and patrols in those areas.

The next step was implementing the intertropical climatic system into our mod:



the two red and blue bands in this image represent the so called Intertropical Covergency Zones with two alternate (wet/dry) seasons. Wet seasons correspond to hotter months: around July for the red band and January for the blue one. The central area between the bands is the equatorial zone, were precipitations are equally distributed during most of the year. Again: we semplified a lot things.
After adding some shadowing effects to our map for representing ITCZ zones, equatorial zone and for distiguishing northern and southern climates, we obtained this:



Notice that I took the area of Indian Ocean between Horn of Africa, Southern Arabic Peninsula and North Western India out of Northern ITCZ and equatorial bands, because the climate of this region tends to be drier than surrounding areas and it is influenced by winds originating in the southern hemisphere.

Now, according to colors in map*, we can define our ClimateZones settings in ClimateZone.cfg file as follows:

Greyed areas outside ITCZ and equatorial bands:
black: polar northern climate
blue: subpolar northern climate
cyan: cold temperate northern climate
green: warm temperate northern climate
yellow: hot temperate northern climate
red: dry tropical northern climate

Areas within ITCZ bands:
Upper ITCZ band (black shadowed area): wet tropical northern climate
Mild band (grey shadowed area): equatorial climate
Bottom ITCZ band (white shadowed area): wet tropical southern climate

Non greyed areas outside ITCZ and equatorial bands:
red: dry tropical southern climate
yellow: hot temperate southern climate
green: warm temperate southern climate
cyan: cold temperate southern climate
blue: subpolar southern climate
black: polar southern climate

* Intermediate colors (orange, lime green, light blue, etc.) don't need to be defined because -as aforesaid- if you could look at them closely you would see that they were actually obtained by dithering two of the main colors.

Our seasons settings for all of these climate zones are resumed in the following chart:



Notice that:
-polar zones got only one season (winter)
-subpolar zones got 3 seasons (winter [6 months], spring [3] and autum [3])
-dry tropical zones got 4 season with long summer (6 months) and short autumn, winter and spring (each 2 months long)
-wet tropical zones got 2 seasons (each 6 months long), inverted compared to real climate (this is for simulating the rainy season that in these regions is corresponding to the hottest months)
-equatorial climate got only one season (spring, for keeping some chance of rain during the whole year without renouncing to sunny days ).

Another aspect that we wanted to simulate in game was the presence of regions where oceanic waters look murky green, as seen in the movie Das Boot. It is something that was discussed extensively on this forum by both detractors, asserting the inconsistency of using a movie as reference for realism, and advocates who experienced this particular sea color outside the cinema! Well, I think stoianm discussed in this thread the existence of a phenomenon called upwelling and happening close to continental platforms when cold waters from the seafloor, rich in minerals and nutrients, reach the surface feeding algal blooms. While in real sea you most probably will never dive in sea waters as green as a swamp (and as seen in Das Boot...), clorophyll content is a well studied parameter in ocenography and marine biology. Here's a map taken from internet:



the areas in red are the ones with the highest contents in clorophyll, hence the murkiest and greeniest in Neptune's realm. The following map represents our designed murky areas. painted on SH5 ClimatZones.tga map:


upwelling zones are represented as plain brown areas

and here's the map with all the other colors:


upwelling zones are represented as brownish shadowings on top of other colors

Including the upwelling, by now all of the environment color zones featured in Dynamic Environment are represented in the map. Hence we have:

black color (no brown shadowing): polar environment colors - blue sea
black color (brown shadowing): polar environment colors - murky green sea

blue color (no brown shadowing): subpolar environment colors - blue sea
blue color (brown shadowing): subpolar environment colors - murky green sea

cyan color (no brown shadowing): cold temperate environment colors - blue sea
cyan color (brown shadowing): cold temperate environment colors - murky green sea

green color (no brown shadowing): warm temperate environment colors - blue sea
green color (brown shadowing): warm temperate environment colors - murky green sea

yellow color (no brown shadowing): hot temperate environment colors - blue sea
yellow color (brown shadowing): hot temperate environment colors - murky green sea

red color (no brown shadowing): tropical and equatorial environment colors - blue sea
red color (brown shadowing): tropical and equatorial environment colors - murky green sea

Notice that despite upwelling and algal blooms are mostly seasonal phenomenes, it is not possible in SH5 to make environment colors dependent on seasons. Hence, green sea waters will show during the whole year in the designed zones.

Finally, the last, most challenging and probably most important part of my tasks for Dynamic Environment was implementing realistic wind patterns. This feature can influence greatly the game play, because during stormy weather can be very difficult to hunt enemy ships.

Once again, internet helped us. Here's a map showing global average wind speeds, used as base for wind datas fetured in our mod:



and this is its simplified version rendered in ClmateZones.tga:


EDIT: missing picture

Legend (wind spees in m/s):

light blue: 4
green: 5
yellow: 6
ocre: 7
pink: 8.25
red: 10.5
grey-purple: 12.5

merging wind speeds information with the remaining colors we obtained this:



and this is our final .tga map after reconverting the rainbowl-like colors in red color values read by the game engine (and after several hours of hard work, while stoianm on the background was singing some old fashioned italian songs with the purpose to enhance my concentration :$ ):



our final task was to create realistic seasonal wind ranges, as the information provided by the first map was relative to annual average speeds, calculated over a period of severale years.
Information on wind speeds seasonal variation was provided by 3 other maps:


EDIT: missing chart





The first map from top is representing wind speeds standard deviations (the deviation from the averages), whereas the other two maps show average wind speeds respectively for the months of January and July.

As you can see, major deviations from average wind speeds are recorded especially at the southernmost and (in an even bigger measure) northermost latitudes. These deviations are reflected by differences in seasonal averages.

By combining this information we were able to set realistic wind speed ranges for winter and summer seasons, while the ranges for spring and autumn were calculated by equating the annual averages for each zone to the values reported in the legend of our simplified wind speeds map. The resulting equations were solved by taking in consideration the duration of each season, as previously defined in the corresponding climate zone settings, and by assuming arbitrarily that autumn and spring averages must be equal. Believe me, saying it was harder than doing it.

Anyway, for all practical purposes, my suggestion is to save the previous maps somewere on your HD and to study them carefully every time you are planning a new patrol. By doing so, remember to compare the annual average for the designed patrol area with the maps showing seasonal averages. Also, take in mind that:

1. Given average wind speeds are... averages : patroling a calm wind area doesn't mean that you will not encounter occasional windy days, but on average the chance of wind storms will be higher for areas having an higher average wind speed.

2. There are chances of high discrepancy between annual and seasonal averages.

3. In general the highest wind speeds are occurring during winter (around January in northern amisphere and July in souther emisphere)

4. In general, the higher the latitude, the higher the difference between seasonal average wind speeds.

5. In general, the higher the annual average wind speed, the higher the difference between it and the seasonal averages.

That's all! Now we rely on your feed-back in order to know wether we have achieved our purposes or not. Again, any bug report, suggestion, technical advise, etc. is very wellcomed!

Last edited by gap; 01-30-20 at 02:21 PM. Reason: changed image hosting service
gap is offline   Reply With Quote