Author Topic: How does visibility through fire work?  (Read 469 times)

Offline Ethereal

  • Commander
  • *****
  • Posts: 703
    • View Profile
How does visibility through fire work?
« on: February 18, 2025, 07:32:51 pm »
Thank you for the update.

I've been wanting to ask for a long time - what did you do with visibility through fire? And how can I restore the original visibility through fire?

Offline Meridian

  • Global Moderator
  • Commander
  • ***
  • Posts: 9415
    • View Profile
Re: How does visibility through fire work?
« Reply #1 on: February 18, 2025, 07:36:33 pm »
I've been wanting to ask for a long time - what did you do with visibility through fire? And how can I restore the original visibility through fire?

I didn't do anything with visibility through fire.
Maybe Yankes did?

What is different than before?

Offline Ethereal

  • Commander
  • *****
  • Posts: 703
    • View Profile
Re: How does visibility through fire work?
« Reply #2 on: February 18, 2025, 08:03:08 pm »
I didn't do anything with visibility through fire.
Maybe Yankes did?

What is different than before?

Since version 7.5 (or slightly earlier), visibility through fire is the same as through smoke, but no parameters regulate the distance of visibility through fire.

Offline Yankes

  • Global Moderator
  • Commander
  • ***
  • Posts: 3436
  • Posts: 421
    • View Profile
Re: How does visibility through fire work?
« Reply #3 on: February 18, 2025, 08:14:09 pm »
Yes, there was change where NV work in "infrared" and if it work this way, it should be blinded by fire.
If current behavior is not preferred, its possible to make global script that will override default calculation.

Probably on forums should be somewhere example of this, if not I could prepare example script code that do this.

Offline Delian

  • Commander
  • *****
  • Posts: 658
    • View Profile
Re: How does visibility through fire work?
« Reply #4 on: February 19, 2025, 11:48:11 am »
If burning tiles are between you and an enemy, then:
1. At day, it should not reduce visibility. That's logical.
2. At night, but enemy is standing on a daylight tile (because fire is light source), it should also not reduce visibility.
3. At night, but enemy is standing on a dark tile, it should reduce visibility. Because blinding light. But this case should be rare.

Is this the current behavior?
« Last Edit: February 19, 2025, 01:11:55 pm by Delian »

Offline Meridian

  • Global Moderator
  • Commander
  • ***
  • Posts: 9415
    • View Profile
Re: How does visibility through fire work?
« Reply #5 on: February 19, 2025, 01:09:57 pm »
Extracted into a separate thread.

Offline Yankes

  • Global Moderator
  • Commander
  • ***
  • Posts: 3436
  • Posts: 421
    • View Profile
Re: How does visibility through fire work?
« Reply #6 on: February 21, 2025, 10:49:49 pm »
We have three parameters: DayVisibility, NightVisibility, and HeatVision.
Depending on the combination of these parameters you will get different effects.

Let's consider an alien that has the same vision range for day and night (i.e. DayVisibility = NightVisibility).
Then `100` of `heatVision` will effectively replace smoke with fire for the visibility calculations.
This means smoke will mean nothing to this alien, but fire will block their vision.

When DayVisibility and NightVisibility are different we can have an interesting case, where fire blocks and improves visibility at the same time.
If the target is close behind some fire, then the fire will reduce visibility like smoke, but it will switch to DayVisibility range, because the target is lit.
Targets far behind the fire will still use NightVisibility range and that will cause them to not be visible, because of the fire between.


Here is a script that recreates the current engine to 99% :

Code: [Select]
    visibilityUnit:
      - offset: 0.01
        code: |
          var int newVisibility;
          var int heatVision;
         
          observer_unit.getHeatVision heatVision;
          limit heatVision 0 100;
         
          set newVisibility distance_max; # max visibility distance based on current light level of target tile and camouflages
          sub newVisibility distance; # distance to target
         
          begin;
            var int temp;
            var int proportion 100;
            sub proportion heatVision;
           
            set temp smoke_density_near_observer; # special adjustment to reduce effect of smoke on close observer in dark places
            div temp -2;
            add temp smoke_density;
           
            mul proportion distance_target_max; # adjustment to scale effectives bases to max possbile visiblity range
            muldiv temp proportion 6000;
           
            add newVisibility temp;
          end;
         
          begin;
            var int temp;
            var int proportion 0;
            add proportion heatVision;
           
            set temp fire_density_near_observer; # special adjustment to reduce effect of fire on close observer in dark places
            div temp -2;
            add temp fire_density;
           
            mul proportion distance_target_max; # adjustment to scale effectives bases to max possbile visiblity range
            muldiv temp proportion 6000;
           
            add newVisibility temp;
          end;
         
          set current_visibility newVisibility;
         
          return current_visibility visibility_mode;

if some part of this logic is not preferred you can comment it out.
« Last Edit: February 22, 2025, 01:48:54 pm by Yankes »