Modding

Modding Changes 1.17.0

Recommendations

  • Some new models utilizing the "sc" suffix or prefix are still work in progress and it is likely that they might change significantly in some next patch. For this reason it is recommended that you avoid using them in your mods at this time.
  • When basing you 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 SHA1 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 compoments 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.

Misc useful commands

  • Running the game with -unlimitedlog command line parameter will disable the standard 1MB limit on size of game log file. This might be useful during update if you want to focus on some bugs first.
  • Running the game with -validate command line parameter or executing validate command on the console will run special game mode which will load all defined models, prefabs, vehicles and other objects to detect missing textures and similar errors. By examining the game log you can determine what the game was trying to do when error appeared. Note that there is still lot of things which might be wrong which are not checked in this mode.
  • Running the game with -error_overlay command line parameter will show overlay with number of error and warning messages printed to the log once at least one such message is printed.

How to convert map

  • If you have added tollgate semaphores for the Scandinavia region, you might need to remove them as they are now defined by the (tr_sem_mdl.ab_toll.s, tr_sem_mdl.ab_toll.dk, tr_sem_mdl.ab_toll.n)
  • Convert the sign templates to the new format. Either manually or using the provided script.
  • We added ferries to some Scandinavian cities, if your mods adds them as well from its fery.<mod_id>.sii, you need to remove the conflicting add.
  • Update particle generators to the new format.
  • Save map
  • Do rebuild (F8)
  • Save map

Changes

Rendering changes

We changed the rendering to improve framerate consistency while moving or looking around. As result of this change the game is significantly more sensitive to amount of draw calls generated by individual models (e.g. number of parts and materials). Additionally there is a fixed size buffer which is used to store the world geometry. If the size of this buffer is exceeded, additional draws became slower. The size is set by default to 128MB however it can be extended using r_segment_buffer_size cvar provided that your GPU & driver allows that.

Wheel changes

The wheel accessory was split into two separate accessories: tires and rims.

Ferry changes

The connection between ferries can now be defined in separate files inside /def/ferry/connection/ for bigger flexibility. Each file defines connection from source ferry to target ferry. The unit within the file must be named conn.<source_ferry>.<target_ferry> and is highly recommended that the respective file is named <source_ferry>_<target_ferry>.sii

The previous mechanism of defining the connections as arrays inside the ferry definition still works. If some connection is defined using both mechanisms, the values from the new mechanism will win.

Ferry visualization on map

The connection between two ferries is drawn on the map. If a new ferry connection is defined, a straight line is drawn automatically between source and target ferry.

For artistic purposes it is possible to define curved lines between source and target, by defining addditional curve points. To add curve points it is necessary to define connection_positions[n] (int, 0, int) and connection_directions[n] (float, 0.0, float) fields in conn.<source_ferry>.<target_ferry> (connection definition file), where connection_positions contains points positions without height and connection_directions contains points vectors for yaw.

City pin scaling

City pins are scalable on world, job and garage maps. For enable this feature is necessary to define city_pin_scale_factor field in city definition file.

city_pin_scale_factor[n] float sets size of city pin and city name on UI map for each zoom level. Recomended values are (0;2>, the default is 1.0 also, when city_pin_scale_factor is not defined. Default pin size is 24px on map.

Truck data changes

  • Changed way of handling dashboard display bars. Instead of control group (ID+5) there is text element now. Aside of defining size it also keep bars functionality data. Format "H~~0~~1" means horizontal bar with values from 0 to 1. All former vertical bars IDs are unused now.
  • Added some other display elements to dashboard - non-modal damage warning picture (1190), low fuel warning picture (1200), navigation distance (1210).
  • Added indicator_cruise_control animation to interior data.
  • Added wiper_delay[] array to interior data, that could define additional interposition of wiper stick and their function (delay between two loops).
  • Added rpm_limit value to engine data. Engine will ignore throttle when rpm are higher than the limit.
  • Removed motor_brake from engine data, added engine_brake instead as relative brake strength value.
  • Added engine_brake_downshift (with default 1) to engine data. It forces automatic transmissions to downshift when engine brake is activated.

Road looks

  • backward compatibility for attributes 'ai_lane_count' and 'one_way' has been removed
    • if they are used, the game won't crash, only their values will be ignored
  • attribute 'no_wrong_way' has been replaced by attribute 'allow_wrong_way'
    • although the attribude is backward compatible in this patch, it can be removed in any of the future patches without notice
    • allow_wrong_way is an array of road variant names (as tokens), where driving in a wrong way lane is allowed (i.e. no wrong way offense is reported)
    • to allow wrong-way driving for all variants, use an array containing 1 empty token:
      • allow_wrong_way[]: ""

Particle generator changes

  • The particle generators now explicitly specify model path and model look in the particle_gen unit instead of using the model_templateunit to support asynchronous loading. You need to update your definitions.

Changes in sign templates

There is new format of sign templates that has better modding support.

Old format:

					SiiNunit
					{
					sign_templates : sign_templs {
					 template_paths: 2
					 template_paths[0]: "/def/sign/template/sign_templ.2hw_exit_hw.sii"
					 template_paths[1]: "/def/sign/template/sign_templ.3hw_noexit_h.sii"
					}
					}
				

New format:

					SiiNunit
					{
					sign_template_def : sign_templ.2hw_exit_hw {
					 path: "/def/sign/template/sign_templ.2hw_exit_hw.sii"
					}
					sign_template_def : sign_templ.3hw_noexit_h {
					 path: "/def/sign/template/sign_templ.3hw_noexit_h.sii"
					}
					}
				

Now you can create files templates.mod_xxx.sii in your mods with custom sign templates.

The name which was previously part of /def/sign/template/sign_templ..sii* is now name of the template definition unit in /def/sign/templates.sii. You can convert it manually or use a following php script to convert them.

Change in accessory hiding flags

The optional flags controlling visibility of accessories in various views did change to improve future extensibility. This calculator should be used instead the one from 1.14 modding info.

Note that while the values in this build are compatible with the ones generated by the previous calculator and will only log error, this might change in future version of the game so you should update them to the new values to prevent possible issues in the future. A following perl script can be used to correct the files.

Hide following views

Main View
Reflection Cube
Close Mirror
Far Mirror
Side Mirror
Front Mirror
Shadows
Rain reflection
hide_in: 0x0