modding:developerinfo:models

Models

Models are stored in the .mdl format in the res\models\model\ folder.

Overview

The format consists of geometric information for different levels of detail (LODs) and meta-data. For each LOD, there are a separate hierarchy of meshes (optionally organized in groups), animations, events, and a material configuration.

The meta-data holds all relevant information, to give the model the desired properties within the game.

function data()
return {
 
  -- optional: 'boundingInfo' and 'collider'
 
  lods = {
 
  },
  metadata = {
 
  },
}
end

Reference

LODs

A LOD consists of following table entries:

  • children
  • matConfigs
  • animations
  • events
  • visibleFrom and visibleTo
  • static

Metadata

There is large set of meta-data keys to describe all the different types of models in the game. Below you can find an overview. For more details it's best to look at the .mdl files. There you can find out how the keys are used, and which keys can be used together.

General

General meta-data can be applied to any type of model. Depending on the resource type, they might be mandatory, but can often be left empty to default to zero.

  • description
  • availability
  • cost
  • maintenance
  • particleSystem
  • soundConfig
  • cameraConfig
description

Explain translation

    description = {
    name = _("Train Class B22RN"),
    description = _("Description displayed for example in the depot menu")
    },
availability

yearFrom and/or yearTo can be left out or set to zero to define an indefinite start respectively end year.

    availability = {
        yearFrom = 1925,
        yearTo = 1985
    },
cost

To activate automatic price calculation, set the price to -1. When price is left out, it defaults to 0.

    cost = {
        price = 10000
    },
maintenance

To activate automatic maintenance calculation, set the running cost to -1. When runningCost or lifespan is left out, it defaults to 0.

    maintenance = {
        runningCosts = -1,
        lifespan = 40          -- [years]
    },
particleSystem
soundConfig

The soundConfig is used in constructions to define the soundSet as well as the effects.

      soundConfig = {
      soundSet = { name = "chemical_plant" },
          effects = {
              select =  {
                    -- list of wav file to be played when the player clicks on the construction
              }
          }
      },

Read more about soundSets here.

cameraConfig

The cameraConfig allows for setting multiple custom camera positions, which can be cycled when the onboard camera is active.

    cameraConfig = {
        positions = {
            {
                group = 0,
                transf = transf.rotYCntTransl(math.rad(25), vec3.new(0, 0, 0), vec3.new(-15, 0, 9)),
                fov = 90
            }
        }
     }

Vehicles

Any vehicle in the game is a transportVehicle and either a waterVehicle, roadVehicle, railVehicle, or airVehicle. I cannot be more than one at a time.

  • transportVehicle
  • waterVehicle
  • roadVehicle
  • railVehicle
  • airVehicle
  • car

Reversible rail vehicles need additional configuration. Please refer to Reversible vehicles for more information.

transportVehicle

This part of the meta-data is used to set the carrier and all cargo/passenger related parameters:

transportVehicle = {
     carrier = "RAIL", -- or "ROAD", "WATER", "AIR"
     capacities = {
        -- capcities and positions of cargo
     },
     loadSpeed = 2,           -- specifies how fast passengers or cargo items are loaded/unloaded
     seats = {
        -- optional position of driver and passenger seats
     },
     reversible = true        -- optional, if vehicle is reversible - for RAIL vehicles only
},

Depending on the carrier, a vehicle is either a railVehicle, roadVehicle, waterVehicle, or airVehicle. These are used to define parameters like speed, power, axles, wheels, and so on.

railVehicle, roadVehicle, airVehicle, waterVehicle
railVehicle= {
    configs = {
       -- axles configuration
       -- fakeBogies configuration
       -- lights configuration
    },
    soundSet = {
       -- soundSet configuration
    },
    engines = {
       -- engines configuration
    },
    topSpeed = 100,          -- [km/h] maximum speed the vehicle can reach
    weight = 107,            -- [t (metric)] empty weight of the vehicle
},
roadVehicle = {
    configs = {
       -- axles configuration
       -- fakeBogies configuration
       -- wheels configuration
       },
    soundSet = {
       -- soundSet configuration
    },
    power = 60,               -- [kw] maximum power the engine can produce
    tractiveEffort = 10,      -- [kN] maximum tractive force the vehicle can develop
    topSpeed = 50,            -- [km/h] maximum speed the vehicle can reach
    weight = 1.6,             -- [t (metric)] empty weight of the vehicle
},
airVehicle = {
    configs = {
       -- axles configuration
       -- wheels configuration
       -- elevator configuration
       -- aileronLeft configuration
       -- aileronRight configuration
       -- flaps configuration
       -- rudder configuration
    },
    soundSet = {
       -- soundSet configuration
    },
    topSpeed = 230.0,                -- [km/h]
    maxPayload = 0,                  -- [kg] (currently not in use)
    maxTakeOffWeight = 78000.0,      -- [kg] (currently not in use)
    maxThrust = 236000.0,            -- [N] maximum total thrust the engines can generate
    idleThrust = 11800.0,            -- [N] thrust generated by the engines in idle state
    timeToFullThrust = 3,            -- [s] time the engines need from idle state to generate full thrust
    wingArea = 122.6,                -- [m^2] wing area, which correlates linearly with the lift force
    weight = 44000.0,                -- [kg] empty weight of the aircraft
},
waterVehicle = {
    configs = {
       -- paddles configuration
       -- rudder configuration
       -- flags configuration
       -- pendulumParts configuration
    },
    soundSet = {
       -- soundSet configuration
    },
    weight = 135000.0,              -- [kg] empty weight of the ship
    availPower = 294000.0,          -- [W] maximum power the engines can produce
    maxRpm = 55,                    -- [rpm] used to animate movable parts of the engines
    area = 5,                       -- [m^2] cross sectional area, which linearly correlates with the drag force
    topSpeed = 7.5,                 -- [km/h] top speed (movement speed is clamped to this value)
},
car

NPC controlled cars a defined by adding the (empty) car list to the metadata:

car = { }

Buildings

  • transportNetworkProvider
  • vehicleDepot
  • streetTerminal
  • autoGroundTex

Misc.

  • person
  • tree
  • rock
  • signal
modding/developerinfo/models.txt · Last modified: 2018/11/30 11:47 by tom

Page Tools