Vehicle Configuration – DayZ Category

From Bohemia Interactive Community
Revision as of 09:18, 23 January 2023 by ImpulZ (talk | contribs) (→‎Debugging)
Jump to navigation Jump to search

This page describes all basics of the DayZ vehicle simulation and its configuration.

Legend

The following table describes some shortcuts, symbols and units used inside this page.

symbol meaning
kg kilogram (mass unit)
km kilometer (unit of length)
km/h kilometers per hour (unit of speed)
kW kilowatt (unit of power)
l liter (unit of volume)
m meter (unit of length)
N Newton (unit of force)
Nm Newton-meter (unit of torque)
RPM revolutions per minute

Debugging

You can debug all simulation properties directly in game when using the Diag binary of the game.

The debug is accessible through the diag menu (holding ⊞ Win + Alt keys) where you can navigate using the arrow keys.

To access car simulation window and controls, in the diag menu go to Game -> Vehicles -> Simulation.


Wheels

TBD.

Model

This section explains all the basics inside the model that influence the car simulation.

Geometry LOD

Make sure your car has a Geometry LOD with convex components. Every component's vertex should have weight assigned. From these weights the total mass of vehicle and its center of mass is computed.

Wheel hubs should have their own components as well, to prevent the vehicle from sinking into the ground without wheels.

FireGeometry LOD

Inside the fire geometry LOD there must be a proxy object placed with the correct name of the wheel slot so the simulation can attach a wheel and suspension to that position.

Config

This section explains all parts related to the simulation of the CarScript config class.

Crew

Crew module specifies all available positions inside a car for players. Every position has its own class where the class name is the name of the crew member position (like Driver, CoDriver etc.)

property type description
actionSel string Name of the named selection(s) in view or fire geometry LOD of the model. This selection is used as entry point for user action.
proxyPos string Name of the named proxy selection in view geometry LOD of the model. This proxy is used as position where to put player inside car. This proxy has to have defined bone inside skeleton config of the car.
getInPos string Name of the selection point from which player gets in/out the car.
getInDir string Name of the selection of second point serving as direction from the first one.
isDriver boolean Indicates if this crew position serves for driver. There can be max. one driver position at the time.

Example

class Crew
{
    class Driver
    {
        actionSel = "seat_driver";
 
        proxyPos = "crewDriver";
        getInPos = "pos_driver";
        getInDir = "pos_driver_dir";
 
        isDriver = true;
    };
 
    class CoDriver
    {
        actionSel = "seat_coDriver";
 
        proxyPos = "crewCoDriver";
        getInPos = "pos_coDriver";
        getInDir = "pos_coDriver_dir";
    };
};

SimulationModule

SimulationModule class contains car's controls properties, engine and drivetrain configuration.

drive
Determines drivetrain configuration of the car.

drivetrains

Steering

The steering class determines how the steering wheel behaves when the steering keys are pressed. To make steering on the keyboard less painful, we have introduced so-called steering curves to help players maintain better control of the vehicle.

Every point of the curve determines how fast the steering wheel rotates based on vehicle speed.

Increase speed curve controls the steering when performing classic steering maneuver.

Decrease speed curve controls the steering when performing counter steering maneuver (for example when car wheels are turned left and player starts steering right).

Centering speed curve controls how fast the steering get back to neutral position when no steering input is given.

Example

class Steering
{
    maxSteeringAngle = 35; // maximum angle by which the wheel on the steered axle can turn

    increaseSpeed[] = {
          0,  40, // at   0 km/h, steering speed is 40 degrees per second
         60,  20, // at  60 km/h, steering speed is 20 degrees per second
        100,  10  // at 100 km/h, steering speed is 10 degrees per second
    };
    decreaseSpeed[] = {
          0,  80, // at   0 km/h, counter steering speed is 80 degrees per second
         60,  40, // at  60 km/h, counter steering speed is 40 degrees per second
         90,  20  // at  90 km/h, counter steering speed is 20 degrees per second
    };
    centeringSpeed[] = {
          0,   0, // at   0 km/h, centering speed is  0 degrees per second
         15,  18, // at  15 km/h, centering speed is 18 degrees per second
         60,  30, // at  60 km/h, centering speed is 30 degrees per second
        100,  45  // at 100 km/h, centering speed is 45 degrees per second
    };
};

Throttle

The throttle class determines how the throttle is reacting to the player's input. When using a keyboard it might be difficult to control the car smoothly, so various helpers have been introduced.

There are 3 main modes how to control the throttle: Gentle, default, and turbo.

Gentle - when this modifier is used, the max pressure on the gas pedal is limited by gentleThrust value from the config file.

Default - used when the action for acceleration is active without any modifiers. The max pressure on the gas pedal is limited by defaultThrust value from the config file.

Turbo - when this modifier is used, it means that the player is flooring the gas pedal.

Example

class Throttle
{
    reactionTime = 1.0; // how long it takes to get wanted value of thrust (in seconds)

    defaultThrust = 0.85; // thrust value when only the action for acceleration is active
    gentleThrust  = 0.7;  // thrust value when the VehicleSlow keyboard key is pressed together with acceleration

    turboCoef  = 4.0;  // how many times is reaction time faster when full thrust is applied
    gentleCoef = 0.75; // how many times is reaction time slower when gentle thrust is applied
};

Brake

property type description
pressureBySpeed array of pair of floats How much brake pressure is applied with respect to car's speed.
reactionTime float How long (in seconds) it takes to get 100% brake pressure when panic braking is applied.
Panic braking is applied when holding LShift (by default controls) key while braking.
In other words how long it takes to floor the brake pedal.
driverless float in range [0, 1] How much brake the game should apply when no driver is present.

Example

class Brake
{
    pressureBySpeed[] = {
        0, 0.43, // at   0 km/h, apply 43% of brake pressure
       20, 0.35, // at  20 km/h, apply 35% of brake pressure
      100, 0.31  // at 100 km/h, apply 31% of brake pressure
    };

    reactionTime = 0.25;
    driverless   = 0.1;
};

Aerodynamics

The aerodynamic simulation consists of two main factors, frontal aerodynamic drag and downforce.
The frontal drag practically determines maximal forward speed of car. Downforce can be used to increase load on tires thus increasing their grip. This is the reason why racing cars has additional spoilers and wings.

property type description
frontalArea float Frontal area of car in squared meters.
dragCoefficient float Coefficient used to quantify the air resistance of a car. You can read more about this value on here. See list of example values here.
Negative values are forbidden, car simulation does not calculate upwards lift force.
downforceCoefficient float Coefficient of a downwards lift force. Usually this value is in range [0, 3]. More explanation of the topic can be found here.
downforceOffset array of 3 floats Local position offset from car's center of mass indicating where the downforce should be applied.

Example

class Aerodynamics
{
    // drag
    frontalArea     = 2.2;
    dragCoefficient = 0.45;

    // downforce
    downforceCoefficient = 0.8;
    downforceOffset[] = { 0, 0.4, -2.2 };
};

Engine

Power source of the car. DayZ allows users to manually insert its torque curve allowing for simulation of various engines from classic internal combustion engines to electric ones.

Clutch

A clutch is a mechanical part that engages and disengages engine from transmission. When not fully engaged it allows engine and drivetrain to operate in different rotating speeds through slipping.

property type description
maxTorqueTransfer float Maximal torque in Nm that the clutch can transfer before it starts to slip.
uncoupleTime float Time in seconds to disengage clutch.
coupleTime float Time in seconds to engage clutch.

Example

class Clutch
{
  maxTorqueTransfer = 400;

  uncoupleTime = 0.3;
  coupleTime   = 0.3;
};


Gearbox

Connects engine and driveline. Simply put, it is a set of gears that allow the rotational speed of the driveline to be varied while maintaining RPM of the engine within its effective range.

The gearbox has one reverse gear ratio so the car can go backwards and multiple forward gear ratios.

There are two types:
Manual - Player must change all gears manually to prevent overrevving the engine.
Automatic - Player manually changes only the direction of movement by choosing between R (reverse) and D (drive) modes.

Note that the types effectively change the way how a player controls the car, but the automatic gearbox also has more forward gears to allow the car to move at higher speeds.

Example

class Gearbox
{
  // for automatic use GEARBOX_AUTOMATIC constant
  type = GEARBOX_MANUAL;

  // reverse gear ratio
  reverse = 3.51;

  // forward gear ratios
  ratios[] = {
      3.50,
      2.26,
      1.45,
      1.00
  };
};

CentralDifferential

Valid only for AWD and 642 drivetrains. It is the differential connecting gearbox with the rest of the driveline.

Axles

Differential
Suspension
Wheels

This category currently contains no pages or media.