Underground Areas Configuration

From Bohemia Interactive Community
Jump to navigation Jump to search

Configuration Objects

The .json snippets used here contain comments which are not compatible with the .json format and are meant only as a guide, copy-pasting them into a .json file may yield unexpected results. For example of a functional .json file, please refer to: https://github.com/BohemiaInteractive/DayZ-Central-Economy/blob/master/dayzOffline.enoch/cfgundergroundtriggers.json

There are 2 types of objects that can be configured for the undergrounds inside the cfgundergroundtriggers.json file.

  1. Triggers
  2. Breadcrumbs

Triggers detect player presence and based on their type manage the eye accommodation level of the player but also perform some other duties, like triggering playback of the underground ambient sound.

Eye accommodation in DayZ means how much the player can see without non-environmental light sources(Flashlight, Chemlight etc.), i.e. it allows us to simulate darkness. (Eye accommodation 0 means complete darkness, while 1 is the default value for normal visibility)

Since we need to change the eye accommodation gradually when the player enters/leaves the undergrounds, we can configure breadcrumbs, which are just points with radius that influence the eye accommodation level at a specific position in the world within transitional triggers.

Triggers

Triggers on the example of the Dambog underground

There are 3 types of triggers:

  1. Outer - used mainly to switch certain lights that normally work only during night-time (such as chemlight) to work during day-time as well
  2. Transitional - handle gradual eye accommodation change, as well as underground ambient sound volume fade in/out
  3. Inner - designate deep underground area and are responsible mainly for setting constant eye accommodation level

Lets look at each trigger type configuration:

Outer

{
   "Position": [ 749.738708, 533.460144, 1228.527954],    //world position of the trigger entity in the world
   "Orientation": [ 0, 0, 0 ],                            //rotation as Yaw, Pitch, Roll
   "Size": [ 15, 5.6, 10.8 ],                         //size in X, Y, Z coordinates
   "EyeAccommodation": 1,                             //how much eye accommodation the player has when inside this trigger
   "Breadcrumbs": [],                                 //breadcrumbs array
   "InterpolationSpeed": 1                                //how quickly we change the eye accommodation from previous value to target value in time
}

Any trigger without breadcrumbs will automatically become Outer type, when the EyeAccommodation is set to 1.

Here the "Breadcrumbs" array is empty, and "InterpolationSpeed" i set to 1, therefore, it's an Outer trigger type.

These should be placed just outside of the underground entrance (where no eye accommodation changes are necessary) adjacent to the transitional trigger.

Transitional

{  
   "Position": [ 735.0, 533.7, 1229.1 ],                  //world position of the trigger entity in the world
   "Orientation": [ 0, 0, 0 ],                                //rotation as Yaw, Pitch, Roll
   "Size": [ 15, 5.6, 10.8 ],                             //size in X, Y, Z coordinates
   "EyeAccommodation": 0,                                 //how much eye accommodation the player has when inside this trigger
   "Breadcrumbs":                                         //breadcrumbs array
    [
        {
            "Position": [ 741.294556, 531.522729, 1227.548218 ],        //world position of the breadcrumb in the world
            "EyeAccommodation": 1,                                      //eye accommodation weight of the breadcrumb
            "UseRaycast": 0,                                            //should we cast a ray from player to this breadcrumb (if set to 1, this breadcrumb will influence the accommodation only if the trace is successful)
            "Radius": -1                                                //how far in meters is this breadcrumb able to influence player eye accommodation, when set to -1, a default value will be used
        },
        {
            "Position": [ 739.904,531.6,1230.51 ],
            "EyeAccommodation": 0.7,
            "UseRaycast": 1,
            "Radius": -1
        }
    ]
}

Any trigger with breadcrumbs will automatically become Transitional type.

Transitional triggers allow for gradual change in eye accommodation through the breadcrumbs configuration. These triggers should be placed in between the Outer and Inner triggers.

Inner

{  
   "Position": [ 701.8, 535.1, 1184.5 ],              //world position of the trigger entity in the world
   "Orientation": [ 0, 0, 0 ],                            //rotation as Yaw, Pitch, Roll
   "Size": [ 55.6, 8.6, 104.6 ],                      //size in X, Y, Z coordinates
   "EyeAccommodation": 0,                             //how much eye accommodation the player has when inside this trigger
   "Breadcrumbs": [],                                 //breadcrumbs array
   "InterpolationSpeed": 1                                //how quickly we change the eye accommodation from previous value to target value in time
}

Any trigger without breadcrumbs will automatically become Inner type, unless the EyeAccommodation is set to 1.

For deep underground after the player has completed the transition from outside to inside. Eye accommodation is constant, based on the "EyeAccommodation" value.

Breadcrumbs

The transitional trigger needs to also define breadcrumbs which handle the eye accommodation gradual change.

When the player moves through the transitional trigger as they traverse to/from the undergrounds, breadcrumbs should be positioned along their path in order to affect the player's level of eye accommodation,

Each breadcrumb that can reach the player (player is within its radius) is affecting the player's eye accommodation level. However how much each does depends on how many breadcrumbs it's competing against and its distance to the player. Breadcrumbs closer to the player have a higher weight and contribute more to the overall eye accommodation.

Typically, you want to position at least 1 breadcrumb inside the transitional trigger near the entrance to the underground(close to the Outer trigger) and set its "EyeAccommodation" value to 1. Next, another one somewhere close to the middle with "EyeAccommodation" set to 0.5, and lastly one near the Inner trigger, with the "EyeAccommodation" set to 0. It depends on the transitional area layout, how many breadcrumbs should be used and their specific configuration.

Lets take a look at a breadcrumb configuration:

{
    "Position": [ 741.294556, 531.522729, 1227.548218 ],        //world position of the breadcrumb in the world
    "EyeAccommodation": 1,                                      //eye accommodation weight of the breadcrumb
    "UseRaycast": 0,                                            //should we cast a ray from player to this breadcrumb (if set to 1, this breadcrumb will influence the accommodation only if the trace is successful)
    "Radius": -1                                                //how far in meters is this breadcrumb able to influence player eye accommodation, when set to -1, a default value will be used
}

Ideally, when configuring the world position for Breadcrumbs that use ray-cast, make sure they are raised slightly off the floor( a few cm in Y axis should suffice) in the upwards direction.