Home » PLAYER'S HQ 1.13 » JA2 Complete Mods & Sequels » All about modding JA2 » Underground Light Levels
Underground Light Levels[message #347543] Wed, 16 November 2016 08:28 Go to next message
edmortimer is currently offline edmortimer

 
Messages:1533
Registered:January 2015
Location: Home Free
How do underground light levels as defined in the Map Editor affect gameplay regarding CaveVision bonuses? Specifically, at what light levels, as defined in the Map Editor, does the CaveVision tag in Items.XML get activated? Or does it not matter at all, and the CaveVision tag takes its cue from something else (like being in an underground level)?

I am unable to find any information regarding this

Report message to a moderator

Sergeant Major
Re: Underground Light Levels[message #347544 is a reply to message #347543] Wed, 16 November 2016 10:41 Go to previous messageGo to next message
silversurfer

 
Messages:2791
Registered:May 2009
Above ground uses night vision bonus and below ground uses cave vision bonus.


Wildfire Maps Mod 6.07 on SVN: https://ja2svn.mooo.com/source/ja2/branches/Wanne/JA2%201.13%20Wildfire%206.06%20-%20Maps%20MOD

Report message to a moderator

Lieutenant
Re: Underground Light Levels[message #347545 is a reply to message #347544] Wed, 16 November 2016 16:55 Go to previous messageGo to next message
edmortimer is currently offline edmortimer

 
Messages:1533
Registered:January 2015
Location: Home Free
Quote:
Above ground uses night vision bonus and below ground uses cave vision bonus.


So it doesn't matter what the Underground Light Level is set at?

Report message to a moderator

Sergeant Major
Re: Underground Light Levels[message #347546 is a reply to message #347545] Wed, 16 November 2016 18:25 Go to previous messageGo to next message
silversurfer

 
Messages:2791
Registered:May 2009
The light level is used for the calculation of the bonus amount but the important thing is that night vision bonus has no effect in caves and cave vision bonus has no effect above ground. So you could define an item that only has an effect in caves for example by only giving it a cave vision bonus. Call it the "mole goggles". ;-)

Light levels go from 0 to 15 if I remember correctly, 0 being brightest sunlight, 3 normal daylight, 12 normal night and 15 being pitch black.

The cave vision bonus is calculated like this:

Pseudo code
if ( LightLevel > 12 )
{
	bonus = ( bonus * ( 15 - LightLevel ) / 3 )
}
else if ( LightLevel > 3 )
{
	bonus = ( bonus * ( LightLevel - 3 ) / 9 )
}


For example the "NVG II" has a cave vision bonus of 10. If your cave has a light level of 7 the bonus would be:

10 * (7 - 3) / 9 = 4

PS: While looking at the code I found an ancient bug that caused cave vision bonus to never have any effect because the game didn't check the correct value to see if the soldier was underground. The same incorrect value was used for the scouting vision range bonus/decreased tunnel vision which caused it not to work if you were on a roof. Fixed in r8340.

[Updated on: Wed, 16 November 2016 18:28]




Wildfire Maps Mod 6.07 on SVN: https://ja2svn.mooo.com/source/ja2/branches/Wanne/JA2%201.13%20Wildfire%206.06%20-%20Maps%20MOD

Report message to a moderator

Lieutenant
Re: Underground Light Levels[message #347548 is a reply to message #347546] Wed, 16 November 2016 20:58 Go to previous messageGo to next message
edmortimer is currently offline edmortimer

 
Messages:1533
Registered:January 2015
Location: Home Free
Quote:
Light levels go from 0 to 15 if I remember correctly, 0 being brightest sunlight, 3 normal daylight, 12 normal night and 15 being pitch black.


It's the opposite in the Map Editor for underground, but I believe you are correct for above ground.

Thanks for the info. And thanks for fixing that ancient bug!

Report message to a moderator

Sergeant Major
Re: Underground Light Levels[message #347549 is a reply to message #347548] Thu, 17 November 2016 09:51 Go to previous message
silversurfer

 
Messages:2791
Registered:May 2009
edmortimer wrote on Wed, 16 November 2016 19:58

It's the opposite in the Map Editor for underground, but I believe you are correct for above ground.

Ok, I didn't check the map editor code. It seems that someone decided to switch the light level value for display purposes in the map editor (applies to surface and underground). Makes sense because it feels more natural to increase the level by increasing a number. Internally the value that you see in the editor is subtracted from 16 to form the "real" light level.



Wildfire Maps Mod 6.07 on SVN: https://ja2svn.mooo.com/source/ja2/branches/Wanne/JA2%201.13%20Wildfire%206.06%20-%20Maps%20MOD

Report message to a moderator

Lieutenant
Previous Topic: TypeP v1.0
Next Topic: Royal Jelly & Jars
Goto Forum:
  


Current Time: Sat Dec 21 12:06:05 GMT+2 2024

Total time taken to generate the page: 0.00996 seconds