Vehicle Tuning

A resource to handle all runtime-editable CHandlingData, and more.

Info

Vehicle Tuning gives you access to all CHandlingData values that are editable during runtime, all "Stance" values (camber, offset, and all CHandlingData suspension values, such as suspension height and steering angle) for each individual vehicle. All changes are saved to a database for any given vehicle, allowing restoration upon server restart and garage enter/exit.

An engine tuning component is built-in with support with addons as listed below. A default engine can be applied to all vehicles, though it is not a great idea to enable this option.

Most of the parameters listed here (under #Parameters) are valid, any any that you choose can be added or removed from the tuner panel as you desire.

Addons

This resource also has a large engine overhaul system. To use this feature, you need to use the ti_mechEngineer resource, where you will build a complete engine before transferring it into a vehicle. Once the engine has been transferred into a vehicle, a number of other features become available through this resource, namely:

  • Vehicle engine damage (damage model considers things like component material composition, weight/size, quality, power output, current RPM, fuel ratio vs compression ratio & ignition timing, etc).

  • Damage HUD (toggle-able by hotkey), allowing players to see the active damage-over-time effect on their vehicle in a non-intrusive UI.

  • Boost controller UI, giving quick access to engine aspiration boost control.

  • Engine tuning UI, giving full access to edit all engine tuning variables.

While the standard CHandlingData values are things most people experienced with GTA vehicles should be familiar with, the engine tuning component adds an entirely new side of modifying GTA vehicles. With heavy inspiration drawn from the game "Automation", the complex principles of building an engine have been somewhat boiled down to a simulate-able level, while still maintaining the great variation of engine characteristics that can be experienced with different tunes and builds.

Along with the additional addon of ti_mechEngineer, you can also use ti_fuel to further the variation and tunability of each engine, where each different fuel type has a varied knock rating (lower knock rating would allow higher compression ratio before damage), and a different power rating (directly effects peak power output of a vehicle).

Setup

Config

All of the config vars found below are stored within the config.lua file.

config = {    
    -- Use inertia model on engines for turbo boost?
    -- NOTE: This gives a significant performance boost to
    --       supercharged engines at lower RPMs.
    --       Smaller engines will struggle to spin a large turbo.
    useInertia = true,
    
    -- Damage/stress HUD.
    -- Set to false if unwanted.
    showHudCommand = "showTuningHUD",
    showHudHotkey = "J",

    -- Aspiration boost controller UI.
    -- Set to false if unwanted.
    showBoostCommand = "showBoostUI",
    showBoostHotkey = "K",

    -- Tuning UI.
    -- Set to false if unwanted.
    showUiCommand = "showTuningUI",
    showUiHotkey = "U",

    -- jobName = minRank
    -- which jobs should have access to the tuning UI
    tuningJobs = {
        mechanic = 0,
        police = 0,
    },

    aspirationBoost = 5.0,      -- end multiplier for all aspiration boost.
    absoluteMax = 100.0,        -- any torque multiplier approaching this value will have immediate repercussions regarding damage.

    useDefaultEngine = false,   -- should all vehicles use the default engine below?

    engineDefaults = {
        -- Set to false or nil if you don't want an engine sound overwrite.
        sound = "BTYPE2",

        -- The engine build is defined on creation by ti_mechEngineer.
        build = {
            -- Block & Heads Config
            -- These components are not effected by stress, and have no chance of breaking.
            -- They define the "layout" for other components.
            block = {
                layout      = "inline",     -- inline, flat, v90, v60
                cylinders   = 8,            -- 2-12
                bore        = 1.00,         -- 0-1
                stroke      = 1.00,         -- 0-1
                quality     = 1.00,         -- 0-1
            },

            heads = {
                layout      = "dohc",       -- dohc, sohc, pushrod
                valves      = 4,            -- 2,3,4,5
                vvl         = true,         -- true,false
                quality     = 1.0,          -- 0-1
            },

            -- Fuel Component Quality
            -- Effects knocking/detonation
            fuelDelivery = {
                quality     = 1.0,          -- 0-1
            },

            -- Interal Materials & Quality
            -- These components are effected by stress, and can break under certain circumstances.
            valves  = {
                material    = "titanium",   -- check `data/params.lua Materials` for more information
                quality     = 1.0,          -- 0-1
            },

            pistons = {
                material    = "titanium",   -- check `data/params.lua Materials` for more information
                quality     = 1.0,          -- 0-1
            },

            conrods = {
                material    = "titanium",   -- check `data/params.lua Materials` for more information
                quality     = 1.0,          -- 0-1
            },

            crankshaft = {
                material    = "titanium",   -- check `data/params.lua Materials` for more information
                quality     = 1.0,          -- 0-1
            },

            -- Aspiration is not effected by stress, but has the largest effect on torque curve variations.
            aspiration = {
                typeof    = "turbocharger", -- turbocharger, supercharger
                system    = "single",       -- turbocharger: single, twin; supercharger: positiveDisplacement, centrifugal
                size      = 1.0,            -- 0-1
                quality   = 1.0,            -- 0-1
            }
        },

        -- The engine tune is every tunable variable within the UI.
        tune = {
            heads = {
                airflow    = 1.0,           -- 0-1
                compRatio  = 0.6,           -- 0-1     
                camProfile = 0.5,           -- 0-1     
                vvlProfile = 1.0            -- 0-1   
            },

            aspiration = {
                turboSize1  = 1.0,          -- 0-1      
                turboBoost1 = 1.0,          -- 0-1   

                turboSize2  = 1.0,          -- 0-1
                turboBoost2 = 1.0,          -- 0-1

                superchargerSize = 1.0,     -- 0-1
                superchargerBoost = 1.0     -- 0-1
            },

            fuel = {
                afRatio = 0.4,              -- 0-1
                timing  = 0.4,              -- 0-1
                limiter = 0.5               -- 0-1
            }
        }
    }
}

Tuning Parameters

All tuning parameters can be found in the data/params.lua file.

All CHandlingData parameters are configured here.

For more information on tuning parameters, check out the documentation.

Material Configuration

All engine material configuration can be found in the data/materials.lua file.

All material configurations for components/engines built with ti_mechEngineer are stored here.

For more information on material configuration, check out the documentation.

Labels

All labels and translations can be found within the labels.lua file.

en = {
    db_vehicle_not_found = "Error attempting to find vehicle in database.",
    db_props_model_err = "The vehicle model does not match the database model.",
    ...
}

Usage

  • Some basic options are found within the config.lua file (as listed above).

  • All translations are handled in the labels.lua file.

  • To add/remove tuning parameters, check out the documentation.

  • To add/remove material configurations, check out the documentation.

More Info

For more specific information on any aspect of this system, join us on our discord.

Conflicting Resources

  • Any resource that modifies CHandlingData fields or uses the SetVehicleCheatPowerIncrease native.

Dependencies

Last updated