View Single Post
Old 03-23-14, 09:30 PM   #3014
TheDarkWraith
Black Magic
 
Join Date: Jun 2007
Posts: 11,962
Downloads: 147
Uploads: 5


Default

Let's talk about our crew's ability to see visual targets. I've been looking over the game code for this and figured out how the game determines when our crew 'sees' a visual contact.

As you may or may not know the crew's ability to see is because of the AI_Visual sensor attached to the submarine. If we look at the data\Cfg\Sensors.cfg file we see no parameter for minimum signal strength as is found in \data\Cfg\Sim.cfg. The game does some lengthy computations using all the values in data\Cfg\Sensors.cfg's Visual parameters to come up with a derived minimum signal strength. The last thing the game does is check to see if it's nighttime.

Nighttime is an on/off thing - it's either nighttime or it's not. This does not model real life! The game has a hard coded value of 0.283 as the value for determining it's nighttime. If the current light amount value is < 0.283 then it's nighttime otherwise it's daytime.

The game has a memory address that stores the current light amount value. This value is in the range 0.0-1.0 with 1.0 being all available light is available (very bright daylight). Now here's where things get interesting. I've made some single missions where visually it's nighttime but the game thinks it's still daytime. The current light amount value was 0.385 with 0.283 being the value that the game uses for nighttime.

If it is nighttime then the game takes the derived minimum signal strength and multiplies it by 3. Then the signal strength of the visual sensor is compared to the minimum signal strength. If greater than then the contact is spotted.

You can now see why the crew is able to spot contacts at far away distances at supposedly nighttime.

I'm deriving a fix for this. What I have come up with so far is defining a value that defines start of nighttime. I have this value currently at 0.5. When the game checks to see if it's nighttime for the visual sensor and it reports back that it is daytime (but visually it appears to be nighttime) I have some new code doing the following:
- if game reports back it's daytime:
-- compare game's nighttime value (0.283) to start of nighttime value (0.5) - I do this comparison because it's possible someone may screw up and assign the start of nighttime value <= 0.283 since it's a variable in the patch file
-- if greater than or equal then jump to end of function
-- if less than then subtract game's nighttime value (0.283) from start of nighttime (0.5) - result is 0.217
-- take current light value (say it's 0.385) and subtract game's nighttime value (0.283) - result is 0.102
-- divide 0.102 by 0.217 - result is 0.47
-- subtract 0.47 from 1.0 - result is 0.53
-- multiply 0.53 by game's nighttime multiplier for player's crew (3.0) - result is 1.59
-- multiply 1.59 by derived minimum signal strength (let's say it's 0.1) - result is 0.159 - this is the new minimum signal strength

What this does is instead of making nighttime either an on/off state it makes it a progressive one. This is how it is in real life - as it gets darker out your ability to see objects diminishes.

I might have to change the nighttime multiplier also. This will be another variable in the patch file if I do. I'm thinking it's going to have to be raised to either 3.5 or 4 from it's current value of 3.



I'm also making another patch that will let the searchlights turn on at dusk. Currently the searchlights only turn on if the game says it's nighttime out (< 0.283 for light value). I'm going to raise this value to 0.40 which should have the searchlights turning on at start of dusk.
TheDarkWraith is offline   Reply With Quote