Author Topic: Vision model that makes sense.  (Read 2918 times)

Offline tylor

  • Captain
  • ***
  • Posts: 53
    • View Profile
Vision model that makes sense.
« on: May 14, 2017, 02:01:06 pm »
I was thinking about vision model that woul make more sense. So, here it is.

There is two vision checks - one in normal spectrum, and another in infrared. Infrared one relies on thing's own thermal emission and does not require light.

Algorithm for calculating "obscureness" for normal vision (NV):

1. Start with 100%.
2. Add some number for insufficient light. It can be binary (as it is no), or scale with light levels below good. If target has Night Camo, this penalty is MULTIPLIED by Night Camo value.
3. If target has any (non-night-specific) Camo, add it's value too.
4. For every cell on sight line obscured by smoke and probably other obstacles (fire, windows, doors, bushes etc), add value proportional to number of obstacles and their "obstacleness".
5. Multiply it all by range.
6. If result is more than some threshold, target is invisible.

For Infrared Vision (IR), algorithm is similar, but there is no step 2, and value of Camo at step 3 and obstacleness of things at step 4 can be different. For example, smoke is worse at blocking IR than NV, and fire is better. Some camos can block only one type of vision, or one better than another.

Offline Yankes

  • Global Moderator
  • Commander
  • *****
  • Posts: 3350
    • View Profile
Re: Vision model that makes sense.
« Reply #1 on: May 14, 2017, 03:16:14 pm »
Right now you can made something like that using visibility scripts (info from OXCE log file):
Code: [Select]
[03-04-2017_22-37-41] [DEBUG] Script info for: visibilityUnit
[DEBUG]
[DEBUG] Have global events
[DEBUG]
[DEBUG] Script return values:
[DEBUG] Name: current_visibility                      var       int     
[DEBUG] Name: visibility_mode                         var       BattleUnitVisibility.Tag
[DEBUG]
[DEBUG] Script data:
[DEBUG] Name: current_visibility                      var       int     
[DEBUG] Name: default_visibility                      var       int     
[DEBUG] Name: distance                                          int     
[DEBUG] Name: distance_max                                      int     
[DEBUG] Name: fire_density                                      int     
[DEBUG] Name: observer_unit                           ptr       BattleUnit
[DEBUG] Name: rules                                   ptr       RuleMod 
[DEBUG] Name: smoke_density                                     int     
[DEBUG] Name: target_unit                             ptr       BattleUnit
[DEBUG] Name: visibility_mode                         var       BattleUnitVisibility.Tag
[DEBUG] To see const values and custom operations use 'verboseLogging'

Limitation is that unit can see other unit only in one "visibility model", you need choose witch you want use for given target.