Configuring entity interaction with wind

Object wind sensitivity

Wind sensibility parameter

The wind_sensibility parameter defines the sensitivity level of scene entities to wind. It is specified in configuration files using the following syntax:

Syntax:

{wind_sensibility X}

Parameter values (Х):

  • 0 — wind disabled (default);

  • 1 — low sensitivity (e.g., for trees);

  • 3 — high sensitivity (e.g., for grass).

Configuring wind_sensibility parameter

The wind_sensibility parameter is defined in the following configuration files:

  • properties/tree.inc — for trees;

  • properties/bush.inc — for bushes;

  • properties/grass.inc — for grass;

  • or in the entity's .def file.

Example: Configuring wind_sensibility for bush entities
{wind_sensibility 2}

Adding the no_wind property to the props block of an entity's .def file turns off the entity's ability to react to wind

Controlling an entity's ability to interact with wind through scripts

The depend_on_wind command is a script function that enables or disables an entity's ability to interact with wind. It is used in script files located in the scene\set\interaction_entity folder, which define entity interactions with other scene objects during gameplay.

Syntax:

{depend_on_wind [0|1]}

Parameter values:

  • 0: disables the entity's ability to interact with wind;

  • 1: enables the entity's ability to interact with wind.

The depend_on_wind command dynamically manages the wind interaction state of an entity based on gameplay conditions. For instance, if an entity transitions to a state where it should no longer respond to wind (e.g., after being destroyed or burned), the {depend_on_wind 0} command can be invoked to disable wind interaction.

Below is an example script demonstrating how to manage an entity's sensitivity to wind during gameplay.

Example: Entity's interaction with wind based on its state
{on "update_wind"
    {if flag "bare"
        {depend_on_wind 0}
    else fallen
        {depend_on_wind 0}
    else
        {depend_on_wind 1}
    }
}

Explanation:

  • on "update_wind": Event triggered to update the entity's wind sensitivity.

  • Conditions:

    • if the bare flag is active, wind response is disabled (depend_on_wind 0);

    • if the entity is in a fallen state, wind response is also disabled;

    • otherwise, the entity responds to wind (depend_on_wind 1).

Configuring wind parameters

The wind parameters are configured in the main/scene/set/wind.set file.

Wind parameter descriptions:

global_wind_speed

Animation speed of wind gust textures, measured in units per frame.

tree_bend_offset

Base angle of tree bending towards the wind direction, excluding gusts, measured in degrees.

tree_bend_range

Maximum angle range of tree bending during gusts, measured in degrees.

grass_bend_gust_start

Minimum wind gust threshold for grass animation, value range [-1..1].

grass_bend_gust_end

Maximum wind gust threshold for grass animation, value range [-1..1] (must be greater than grass_bend_gust_start).

grass_bend_angle_offset

Base angle of grass bending towards the wind direction, excluding gusts, measured in degrees.

grass_bend_angle_range

Grass bending angle range during gusts, measured in degrees. Avoid values that visually bury grass under the ground.

grass_bend_angle_power

Amplitude of grass oscillations during gusts, measured in degrees.

grass_bend_angle_freq

Frequency of grass oscillations during gusts, measured in arbitrary units.

grass_large_scale_power

Intensity of large-scale grass wave oscillations without gusts, value range [0..1].

grass_large_scale_gust_power

Intensity of large-scale grass wave oscillations during maximum gusts, value range [0..1].

grass_large_scale_freq

Frequency of large-scale grass wave oscillations, measured in arbitrary units.

grass_small_scale_power

Intensity of small-scale grass wave oscillations without gusts, value range [0..1].

grass_small_scale_gust_power

Intensity of small-scale grass wave oscillations during maximum gusts, value range [0..1].

grass_small_scale_freq

Frequency of small-scale grass wave oscillations, measured in arbitrary units.

Step-by-step setup of wind parameters

Each wind parameter is tied to a value table, configured according to the Beaufort scale, which maps real-world wind conditions to in-game effects:

  • 0: no wind (calm);

  • 10: storm-level wind strength.

  1. Set the global_wind_speed parameter

  2. Configure tree wind parameters: tree_bend_offset, tree_bend_range

  3. Configure grass parameters:

    • grass_bend_gust_start, grass_bend_gust_end;

    • grass_bend_angle_offset, grass_bend_angle_range;

    • grass_bend_angle_freq, grass_bend_angle_power;

    • grass_large_scale_*, grass_small_scale_*.

Below is an example of configuring the grass_small_scale_power parameter using a value table based on the Beaufort scale. This parameter adjusts the intensity of small-scale grass wave oscillations in response to varying wind conditions.

Configure other parameters similarly to ensure consistent wind responses.

Example: Configuring wind parameters
{grass_small_scale_power
    0  0.004 ; value for calm wind
    1  0.010
    2  0.014
    3  0.020
    4  0.026
    5  0.032
    6  0.040
    7  0.050
    8  0.060
    10 0.100 ; value for hurricane
}

Description:

  • Key: represents the Beaufort scale level (0 for calm, 10 for hurricane).

  • Value: adjusts the intensity of small-scale oscillations in grass, measured in arbitrary units.

  • Usage: these values define how grass reacts to different wind strengths, creating a realistic animation effect.

Console commands

For diagnosing and controlling wind effects during gameplay, the following console commands are available:

  • Reload wind settings from the wind.set file:

ed_reloadWind
  • Display entities' wind sensitivity on screen:

v_entityWind [0 | 1]

Last updated