Games/ETS2/Modding guides/1.35

From SCS Modding Wiki
Jump to navigation Jump to search

Introduction

The following page contains modding guidelines for the new update of the game.

To better understand changes in units it is recommended to check Units documentation page.

Recommendations

  • When basing your model on the original ones, add to your mod also ALL original /automat/ files used by it. The names of the files are generated as CityHash64 hash of theirs content so whenever we change the parameters of the material in any way, a different file will be used to store them and the original file might cease to exist if there is no other model utilizing the original parameters.
  • When modifying original models, always include ALL components of the model (pmg+pmd) instead of just those you changed. Otherwise you risk crash if we change the model.
  • As always when adding new objects to files which support multi-file approach (e.g. road_look.sii) it is HIGHLY RECOMMENDED to use suffix or prefix in the name to avoid conflicts with new objects we are adding in patches. Otherwise you might have to use the batch renaming functionality (see Batch renaming) to fix the conflicts when new patch appears.

How to convert map

  • Load map
  • Do rebuild (F8)
  • Save map
  • Select correct looks for models where the selection of the looks changed
  • If the save generated error messages of type "Sign template item 123 does not exist in template 'ABC'"
    • Find the template in the content browser
    • Right click on it and select "Edit"
    • In the "Sign Editor" dialog choose File > Clean up overrides

Changes & New Features

Curve items

Curve model definition

Every single definition in the curve_model.sii file must be in the following format:

       ----------  Internal Data Type
      |
      |          ------  Data Type Identification
      |         |
      |         |    ----- User Name
      |         |   |                    
      v         v   v
curve_model : curve.2 {
     category: "Walls"                                          # Category
     name: "Warehouse wall"                                     # Curve model name
     model_desc: "/model/warehouse/tiled_wall.pmd"              # Model Path
     dynamic_lod_desc[]: "/model/warehouse/tiled_wall_lod1.pmd" # LOD1 Model Path
     dynamic_lod_dist[]: 50                                     # LOD1 switch distance in meters
     dynamic_lod_desc[]: "/model/warehouse/tiled_wall_lod2.pmd" # LOD2 Model Path
     dynamic_lod_dist[]: 100                                    # LOD2 switch distance in meters

     variation[]: "var_name1 | center1:2 | center2:5"           # Part variation definition
     variation[]: "var_name2 | center1, center2:5"       
     start_part[]: "strt1|strt1a"                               # Start parts list per variation
     start_part[]: "strt2|strt2b"
     end_part[]: "end1"                                         # End parts list per variation
     end_part[]: "end2|end3|end4"
     smooth_surface: false                                      # Smooth surface
     color_variant[]: "red: 255, 0, 0"                          # Color variants
     color_variant[]: "blue: 0, 0, 255"
     vegetation[]: "tree_a : vegetmodel.cityalley.smalltree02a | 5:8 | -2:2 | 0.5:1.5 | 0:360" 
     vegetation[]: "tree_b : vegetmodel.cityalley.smalltree02b | 5:8 | -2:2 | 0.5:1.5 | 0:360"

     fixed_step: 20                                             # Use given fixed step between parts
     fixed_inner_start[]: strt1                                 # Use given start part for "inner" curve (definition per variation)
     fixed_inner_start[]: strt2

     fixed_inner_end[]: end1                                    # Use given end part for "inner" curve (definition per variation)
     fixed_inner_end[]: end2
}
  • Internal Data Type, Data Type Identification - must stay intact and are obligatory.
  • User Name - must be UNIQUE for every single railing in the game (even across all dlcs, mods etc.). This name is token and can have up to 12 characters from the following set:_0123456789abcdefghijklmnopqrstuvwxyz. The best practice is to add some suffix to the name identifying the dlc or mod to avoid name conflicts.
  • Category - Category name used for navigation simplification in building item properties dialog. String value.
  • Name - Building scheme name. String value.
  • Model Path - Path to the model file (*.pmd).
  • Maximum Dynamic LOD count is 3
  • LOD Model Path - Path to the model file used for the low poly LOD (*.pmd).
  • Variation - Center part variation definition
    • Variation name (token) | part_name [,part_name ...] : weight [ | part_name [,part_name ...] : weight]
  • Start part - Array of all valid parts which can be used as the start
  • End part - Array of all valid parts which can be used as the end
  • Smooth surface - Perform smooth interpolation of the geometry normals. Default value: false
  • Color variants - User defined vertex color multiplication factor used during buildings item geometry generation (optional)
  • Vegetation - Instanced vegetation definition has following format:
    • Instance name (token) : vegetation model unit name | min_width : max_width | min_offset : max_offset | min_scale : max_scale | min_rot : max_rot

Automatic wire generation

The curve model can contain locators for automatic wire generation. These locators have the following naming convention:

Locator name: w_X_Y_Z where:

  • w_ - prefix
  • X - wire type
    • f - flat wire without any drop distance
    • t - LOW wire drop, with flat wire thickness (thin wire)
    • l - LOW wire drop
    • m - MEDIUM wire drop
    • h - HIGH wire drop
  • Y - wire line index 0 based
  • Z - unique suffix suffix can be any character

Examples:

w_h_0_a, w_h_0_b, w_f_1_0

Mover/walker unification and improvement

Approach to movers and similar object has been completely reworked. Walker item is now obsolete and it is possible that it will be removed in the future. For the similar functionality use mover item with mover model group. Mover item now supports all important properties from the walker item.

Moverover mover_model_u property model_anim_alt is also now obsolete and it will be removed in the next update. It means that pedestrian hookups using this property won't work correctly. Recommended approach is to replace them by new mover hookups with mover model group models.

Voice navigation

Data format for voice navigation feature is described at Documentation/Engine/Units/sound_data_voice_navigation.

Dynamic LODs

Instead of single static LOD (attributes lod_desc and lod_dist) there is now array of LODs (arrays dynamic_lod_desc[] and dynamic_lod_dist[]). Logic is the same: descriptor defines path to LOD model, dist defines distance from where it should be used. For now old LODs definition are loaded and converted, but this support might be removed in future updates, eventually.

Affected units are prefab_model, model_def and curve_model. Also sign_model newly has LOD array.

Timezone sub-areas

Data for time zone sub-areas has been introduced silently in 1.34 update (look for Malheur county, Oregon in ATS or Kaliningrad area, Russia in ETS).

One set of data is in city_data units and data is used for static city-based zone usage (eg. delivery times in game economy):

  • time_zone (integer, default is undefined value, represented by week of time, 10080) - time zone of given city in minutes
  • time_zone_name (string, default empty) - name of eventual time zone

If city time zone is undefined (or 10080) then there is used time zone of country the city belongs to.

Second set of additional data consists of three synchronized arrays (same length expected) stored in country_data units and is used for spatial detection of time zone on map:

  • secondary_time_zone_area (float4 array) - elements of rectangle areas in editor coordinates
  • secondary_time_zone (integer array) - time delta of given area in minutes
  • secondary_time_zone_name (string array) - name of time zone in given area

If point is in given country (decided by map logic by road/prefabs & borders) then all existing rectangle elements are checked for different time zone than country has. First matching area element defines the proper time zone. If no area is found, country time zone is used instead.

Economy data

New attributes in economy_data unit that handle emergency refueling:

  • refuel_fuel - amount of fuel delivered on single emergency refuel (default 50.0, in litres), service is disabled if driver has more fuel
  • refuel_price_base - base flat price of the service (default 150.0)
  • refuel_price_factor - base fuel cost multiplier compared to regular diesel price in given country (default 3.0)
  • refuel_time_base - base time of emergency refueling delay (default 1800.0, in seconds)

Traffic data

Parked vehicles/trailers

Parked vehicle/trailer attribute allowed_trailer is now also interpreted as a trailer chain definition.

Note: Attribute allowed_trailer_count is now obsolete, since the trailer count is determined from trailer chain automatically.

Spawn density rules

Trailer chain support has been added also to spawn density traffic rules (traffic_rules_spawn.sui). All items beyond the first one in the str_params attribute are now interpreted as allowed trailer chains. This can be useful for specifying areas in map where custom trailers (custom cargo) are spawned.

Example:

traffic_rule_data : traffic_rule.s_train_c2
{
	name: "Spawn density - cargo train (plane)"

	rule: "density"

	str_params[]: "train_cargo"
	str_params[]: "train_car.trplane_car 1 | train_car.trplane_care 1 | train_car.trplane_car 1 | train_car.trplane_care 1 | train_car.trplane_car 1 | train_car.trplane_care 1"

	num_params[]: 0.0	# 00:00
	num_params[]: 0.015	# frequency
	num_params[]: 1		# count limit
}

Trailer chains

Supported trailers are now defined at one place: in traffic_vehicle by defining the whole trailer chain (previously it was combination of per vehicle/trailer type + per vehicle/trailer) Related attributes in traffic_trailer, traffic_vehicle_type and traffic_trailer_type are now obsolete. Partial backward compatibility is provided (more complex trailer configurations may not be created correctly using old attributes)

Note: Support for wildcards has been removed to avoid the unnecessary complexity.

TIP: If you have used (now obsolete) attribute allowed_tractor, the similar functionality can be achieved by setting spawn_ratio: 0.0 for trailers which have been using it. This way, they won't be chosen for any vehicle unless explicitly set in trailer_chains.

Each trailer chain element can be specified either by trailer type name (a random trailer model of that type will be spawned) or directly by traffic trailer unit name. Optionally, for each element, the minimum and maximum count of occurrence can be specified. Elements and counts are separated by '|'.

Examples:

trailer_chains[]: "semi_trailer" - the vehicle will have one trailer of type semi_trailer

trailer_chains[]: "traffic_trailer.first | traffic_trailer.middle 2-4 | traffic_trailer.last" - trailer chain with specific elements, 'traffic_trailer.middle' can occur 2-4 times.

Trailer type and storage renaming

Some trailer types and corresponding storages have been renamed by using a more universal special suffix to better match their usage. They contain trailers which are always selected explicitly, never randomly across the whole storage:

  • traffic_storage_train_car_pass.siitraffic_storage_train_car_special.sii
  • traffic_storage_trailer_parked.siitraffic_storage_trailer_special.sii

Vehicles data

Cabin suspension

The cabin is newly connected to the chassis by 4 springs as in real trucks (previously, only one spring was used to simulate the cabin behavior). The spring locations can be seen as yellow crosses when g_colbox is active.

The data members in physics.sii cabin_pitch_force_scaling_factor, cabin_pitch_damping_factor, cabin_roll_force_scaling_factor and cabin_roll_damping_factor are now obsolete.

There are new data members in physics.sii:

  • cabin_suspension_travel (float, default 0.05, in meters) - specifies the length of the cabin springs when at rest position with cabin weight on them
  • cabin_suspension_damping_factor (float, default 1.0) - relative strength multiplier of the cabin suspension damper
  • cabin_sway_bar_factor (float, default 1.0) - relative strength multiplier of the cabin suspension sway bar (which counters relative roll of the cabin)
  • cabin_cog_height_offset (float, default 0.5, in meters) - specifies the height difference between the cabin locator and the COG of the cabin (the COG is higher than the locator)

Note: In addition, the working point of the cabin suspension may be altered with the g_cabin_suspension_stiffness cvar. Its default value (1.0) corresponds to working point at 0.65 (the spring compresses to 65 percent of its length when we put the cabin weight on it). Lower values of the cvar means lower working point, and thus softer springs (g_cabin_suspension_stiffness 0.0 puts the working point at 0.5).

Cargo model randomized

If there are stated more than one model of cargo visualization (see data_path array in cargo_model_match unit, stored in def/cargo/*/ folders of cargoes for owned trailers) for given trailer, the one used is chosen pseudo-randomly from them.

COG data in chassis accessory

Center of gravity (COG) data has been moved from trailer definition to accessory_chassis_data. They are easier to edit, they have less count than trailer definitions and on given chassis cargo is typically loaded in same way.

Value logic itself work as before: cog_cargo_mass_min (float, default 0) and cog_cargo_mass_max (float, default 20000) sets border limits and cog_cargo_offset_min (float3, default (0,0,0)) and cog_cargo_offset_max (float3, default (0,1,0)) set values for interpolation.

In addition, default COG is now in center of model based on some trailer geometry analysis regardless of trailer model scene origin. So the longitudinal offset used as workaround should be discarded.

Trailer chassis adjustment data

In unit trailer_configuration (folders def/trailer_owned/*/configurations/) is new token equivalency (empty by default). Each non-empty value defines closed set of configurations. Any other configuration with same equivalency token value is considered as different variant of same trailer(s). By pure logic they should have same cost and level (but its not cross-checked nor forced by game) and any such switch made via trailer adjuster is free.

Dealer UI for modded trucks

Allows all the modded truck brands to be available on one specific UI screen. You have access to this feature after you activate a mod in the Mod Manager that contains a defined truck brand. When a mod like this is detected, a button on the truck dealer world map that will direct you to the this screen.

To add a new brand on you mod simply create a directory with the name of your brand in /def/vehicle/truck_dealer. In this directory you will put your stock truck offer .sii files. For example, for a brand named X Brand, create a directory named "xbrand" on the mentioned path. Now this directory needs to be populated with valid truck offers, .sii files that contain a vehicle and its accessories. Those accessories and vehicle configurations definitions are stored in a directory in the path /def/vehicle/truck. For more information on this folder's structure and contents, see the dedicated page: Player trucks definitions.

It is important to mention if you are creating a new truck definition, the unit accessory_truck_data should be named using the following convention vehicle.<brand>.<series>. So using the example above, if the X Brand's offers use a new truck definition, the name of the accessory_truck_data in the data.sii should look like this: accessory_truck_data : vehicle.xbrand.t_9000

Note: At the moment, the UK only truck brands defined in /def/vehicle/truck_dealer_uk are not supported by this feature.

Additionally, you can add a brand logo to your own brand dealer on the /material/ui/brand_logo directory. To achieve this, create a .mat, a .tobj and a .tga logo files with the name of your new brand (aka "xbrand" here). Using the provided conversion tools convert these files and add the resulting conversions to the aforementioned directory. The logo size has to be 128x64. If no brand logo is set, in its place there will be an empty material image.

Finally, you can still add modded trucks to the in-game dealers using the same procedure of creating a directory with that said in-game's brand name in the /def/vehicle/truck_dealer path and populating it with new offers. So if a modder wanted to add new offers to DAF for example, they would have to create a directory named "daf" in the truck_dealer path of their mod and add their truck offers there. All modded content to the in-game brands will be available in both the modding and the actual brand dealers.

Trailer braces sound

Default value is now set empty. So there is sound only if data explicitly state it.

Transmission mode names

Unit accessory_transmission_data has two new string attributes - auto_mode_name (default "A") and manual_mode_name (default "M"). Their value is used in dashboard computer display as transmission mode element (id 1310) if truck display contains one.

Wheel collision offsets improved

Previously, the wheel collision representation used a hard-coded offset and width, and thus did not always match precisely the visuals. Most wheels should now have their collisions matched by default.

The only wheels requiring special treatment are those with a nonzero offset of the 'middle' of the tire from zero (this may arise for multiple reasons, e.g. for allowing baked (not tire + rim) wheels to rotate as intended, or for making tires with multiple widths compatible with a single rim/disc accessory).

For such wheels, there is a new parameter in accessory_wheel_data called wheel_shift. This shift should amount to the difference between the zero of the scene and the zero of the tyre for the collisions to be generated correctly.

Note: Another ingredient needed for the collisions to work as intended is ensuring the BB locator is positioned at the outer edge of the tire.

Wipers duration & delay format

In unit accessory_interior_data attribute wiper_delay has been removed. Instead, the new attribute wiper_duration_and_delay (array of float2) has been added. Each element contains animation length (in seconds) and time delay between animation loops (in seconds) of one active state.

If no wiper_duration_and_delay is correctly stated it is defaulted to single element float2(2.0, 0.0), which serves as single active state in such case.