This shows you the differences between two versions of the page.
modding:developerinfo:models [2018/11/30 10:50] tom |
modding:developerinfo:models [2019/03/19 10:18] |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | ===== 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. | ||
- | |||
- | <code lua> | ||
- | function data() | ||
- | return { | ||
- | |||
- | -- optional: 'boundingInfo' and 'collider' | ||
- | |||
- | lods = { | ||
- | |||
- | }, | ||
- | metadata = { | ||
- | |||
- | }, | ||
- | } | ||
- | end | ||
- | </code> | ||
- | |||
- | ==== Reference ==== | ||
- | |||
- | === LODs === | ||
- | |||
- | A LOD consists of following table entries: | ||
- | |||
- | * ''children'' | ||
- | * ''matConfigs'' | ||
- | * ''animations'' | ||
- | * ''events'' | ||
- | * ''visibleFrom'' and ''visibleTo'' | ||
- | * ''static'' | ||
- | |||
- | * [[:modding:developerinfo:models:events_animations|Events and Animations]] | ||
- | * [[:modding:developerinfo:models:meshes|Meshes]] | ||
- | * [[:modding:developerinfo:models:materials|Materials]] | ||
- | |||
- | === 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'' | ||
- | == description == | ||
- | |||
- | Explain translation | ||
- | |||
- | <code lua> | ||
- | description = { | ||
- | name = _("Train Class B22RN"), | ||
- | description = _("Description displayed for example in the depot menu") | ||
- | }, | ||
- | </code> | ||
- | |||
- | == availability == | ||
- | |||
- | yearFrom and/or yearTo can be left out or set to zero to define an indefinite start respectively end year. | ||
- | |||
- | <code lua> | ||
- | availability = { | ||
- | yearFrom = 1925, | ||
- | yearTo = 1985 | ||
- | }, | ||
- | </code> | ||
- | |||
- | == cost == | ||
- | |||
- | To activate automatic price calculation, set the price to -1. When price is left out, it defaults to 0. | ||
- | |||
- | <code lua> | ||
- | cost = { | ||
- | price = 10000 | ||
- | }, | ||
- | </code> | ||
- | |||
- | == maintenance == | ||
- | |||
- | To activate automatic maintenance calculation, set the running cost to -1. When runningCost or lifespan is left out, it defaults to 0. | ||
- | |||
- | <code lua> | ||
- | maintenance = { | ||
- | runningCosts = -1, | ||
- | lifespan = 40 -- [years] | ||
- | }, | ||
- | </code> | ||
- | |||
- | == particleSystem == | ||
- | |||
- | == soundConfig == | ||
- | |||
- | The ''soundConfig'' is used in constructions to define the ''soundSet'' as well as the ''effects''. | ||
- | |||
- | <code lua> | ||
- | soundConfig = { | ||
- | soundSet = { name = "chemical_plant" }, | ||
- | effects = { | ||
- | select = { | ||
- | -- list of wav file to be played when the player clicks on the construction | ||
- | } | ||
- | } | ||
- | }, | ||
- | </code> | ||
- | |||
- | Read more about soundSets [[:modding:developerinfo:soundsets|here]]. | ||
- | |||
- | === 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 [[modding:developerinfo:models:reversibleVehicles|Reversible vehicles]] for more information. | ||
- | |||
- | == transportVehicle == | ||
- | |||
- | This part of the meta-data is used to set the carrier and all cargo/passenger related parameters: | ||
- | |||
- | <code lua> | ||
- | 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 | ||
- | }, | ||
- | </code> | ||
- | |||
- | 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 == | ||
- | |||
- | <code lua> | ||
- | 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 | ||
- | }, | ||
- | </code> | ||
- | |||
- | <code lua> | ||
- | 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 | ||
- | }, | ||
- | </code> | ||
- | |||
- | <code lua> | ||
- | 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 | ||
- | }, | ||
- | </code> | ||
- | |||
- | <code lua> | ||
- | 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) | ||
- | }, | ||
- | </code> | ||
- | |||
- | == car == | ||
- | |||
- | NPC controlled cars a defined by adding the (empty) ''car'' list to the metadata: | ||
- | |||
- | <code lua> | ||
- | car = { } | ||
- | </code> | ||
- | |||
- | === Buildings === | ||
- | |||
- | * ''transportNetworkProvider'' | ||
- | * ''vehicleDepot'' | ||
- | * ''streetTerminal'' | ||
- | * ''autoGroundTex'' | ||
- | **Misc.** | ||
- | |||
- | * ''person'' | ||
- | * ''tree'' | ||
- | * ''rock'' | ||
- | * ''signal'' | ||
- | |||