CleverRaven / Cataclysm-DDA

Cataclysm - Dark Days Ahead. A turn-based survival game set in a post-apocalyptic world.
http://cataclysmdda.org
Other
10.66k stars 4.18k forks source link

Weak light sources shouldn't ruin stealth #63087

Closed SentientBowtie closed 1 year ago

SentientBowtie commented 1 year ago

Is your feature request related to a problem? Please describe.

Having an active light source on your person makes you visible to enemies as if your tile were brightly lit, i.e. by daylight, even during the night or in an enclosed space with no lighting. This is a reasonable mechanic on its own, but the threshold at which this effect occurs is incredibly low, and several small light sources trigger it even when that doesn't make a lot of sense: Lit cigarettes, cigars, and joints, and active lightstrips, all of which provide a mere LIGHT_4, will render you just as visible in the darkness as an active flashlight or mining helmet.

Solution you would like.

Increase the threshold at which the haslight effect is applied to the player (in src/lightmap.cpp) from 4 to another number.

The simplest way to solve the issue would be raising it to 6, as that neatly excludes every problem object without altering anything else.

In the interest of furthering realism, I would alternatively suggest raising it to at least 11 in order to exclude everything of LIGHT_10 or less, for the following reasons.

Lit Up could currently be rationalized as enemies noticing bespoke sources of light and being drawn to them, which then allows them to notice the player when they get close. However, this applies to any Hostile! creature that would be able to see the player in bright lighting, even when it doesn't make sense for them to be attracted to light simply because it's there. Notable examples include nocturnal predators such as wolves and tigers, as well as creatures which die when exposed to sunlight like the dark wyrm. Additionally, enemies will ignore active light sources unless they are being carried by the player; turning on a cell phone's flashlight and dropping it in the grass only matters for single turn the player is holding it, and as soon as any nearby zombies forget the player exists, they won't bother to investigate the light.

I have instead come up with another justification for the effect that I feel is more easily applicable to how it works mechanically: being Lit Up makes the player more easily detectable because their light source is illuminating them in such a way that their silhouette is mostly visible and identifiable against the surrounding darkness. Zombies see something bipedal that isn't part of the blob, triffids see something not part of the grove, the great mantis identifies small prey, and so on.

Setting the haslight threshold to 11 would exclude everything in the game with LIGHT_10 or less, objects which all provide small, low-intensity illumination (represented ingame as a single tile of bright light). It would be difficult for an enemy looking at the player from afar to identify them as a target if only a small part of their body is being illuminated. And in real life, people will hold weak light sources out in front of them to better see their surroundings, leaving their body in darkness - which leads back to the problem of everything being a moth when it really shouldn't be.

The next category up from there, LIGHT_15, is when objects start providing multiple tiles of full brightness; lit molotov cocktails, active electric lanterns, and so on. A light source strong enough to illuminate the area immediately around the player is probably going to be strong enough to illuminate their body basically no matter how they point it, so I think it's perfectly reasonable for this to be the point that things start ruining night runs.

Describe alternatives you have considered.

Not changing this, because it's an intentional balance decision for reasons I probably don't understand. Or I could become a code wizard and create a dynamic haslight effect that expands enemies' vision radius in darkness based on the intensity of any lights the player is holding or something which would also make me happy

Additional context

No response

andrei8l commented 1 year ago

effect_haslight is informative and doesn't affect monster vision

You probably want to change the logic here instead:

https://github.com/CleverRaven/Cataclysm-DDA/blob/05524dfcf19121b39c7878eb6bb5072a43a9593e/src/creature.cpp#L439-L447

SentientBowtie commented 1 year ago

Right, thanks. I was focusing much more on the status than the actual mechanic when I wrote that.

anoobindisguise commented 1 year ago

Another tangential issue is that any amount of light automatically negates all of your night vision; this is probably overzealous, as being in light doesn't necessarily make it hard to see into the dark - for example my cat can see me while standing in bright light, while I am in darkness. etc

kevingranade commented 1 year ago

This is intentional, an incredibly dim light source will give your positionnaway and illuminate you.

oosyrag commented 1 year ago

In that case, would it be reasonable for monsters to be attracted to and investigate any lit tile (that is brighter than natural light level)?