Open main menu

Games/ETS2/Modding guides/1.4.1

< Games‎ | ETS2/Modding guides
Revision as of 12:58, 11 February 2016 by 50keda (talk | contribs) (How to convert a 1.3.1 map to 1.4.1)

Contents

How to convert a 1.3.1 map to 1.4.1

  • During the conversion operation it is a good idea to run the game with -unlimitedlog parameter to ensure that you can see all the error messages
  • If you added a new country, check that the country_id values do not conflict with the countries we added. Otherwise assign them a new identifiers (see #Changes in countries).
  • Update the company.sii to the new format or at least replace the original quarries with single quarry company (see #Changes in quarries and #Changes in files containing lists of objects).
  • Create definitions of company-prefab relations (see #Changes in company definition)
  • Load the map in the editor. If the load fails, examine the log and fix` the errors.
  • Update the country identifiers for border nodes if necessary.
  • Use the Recompute button (F8) to regenerate the map.
  • Save the map.
  • Create overlay textures for the new cities in /material/overlay. (see #Changes in city sign overlays)
  • Convert the road looks to the new format (see #Changes in road.sii)
  • Convert AI frequency definitions to the new format (see #Changes in AI definition)
  • Convert definitions of company inputs/outputs to the new format (see #Changes in company definition)

Changes

Changes in physics.sii

Changed the interpretation of thrust_characteristic_viscosity in physics data. It is now scaled by engine torque. When loading version 0 structure, the value is divided by 1875 to approximate the new value.

Changes in interior accessories

Intensity of dashboard backlight is configurable using panel_intensity_min and panel_intensity_max attributes.

Changes in initial save

The companies and garages are detected automatically and should not be specified in this file.

Changes in files containing lists of objects

In certain cases the game loads list of objects for a single category (e.g. traffic vehicles, cargoes, cities, countries, models, prefabs, signs,...). Previously there was only one file with that list for each category and this caused unnecessary conflicts between mods even in cases, when a mod only wanted to add new objects to the category.

For 1.4 patch we extended the support to allow more than one file for the most important categories where it did make sense. In that case the game will combine lists found in all those files. The additional files must be named in following way: "<base_file>.<idofyourmod>.sii" where <base_name> is name of the base file without the extension (e.g. "city" for "/def/city.sii") and <idofyourmod> is some string which is unlikely to conflict with other mod. Note that care must still be taken to ensure that name of units in those files do not conflict between files by addition of prefixes or suffixes.

Only the following files support this new behaviour.

  • /def/cargo.sii
  • /def/city.sii
  • /def/company.sii
  • /def/country.sii
  • /def/ferry.sii
  • /def/camera/camera_storage.sii
  • /def/camera/cutscene.sii
  • /def/vehicle/addon_hookup_storage.sii
  • /def/vehicle/traffic_storage.sii
  • /def/vehicle/trailer_storage.sii
  • /def/vehicle/trailer_traffic_storage.sii
  • /def/vehicle/truck_traffic_storage.sii
  • /def/world/building_model.sii
  • /def/world/building_scheme.sii
  • /def/world/detail_vegetation_def.sii
  • /def/world/hinge.sii
  • /def/world/model.sii
  • /def/world/mover.sii
  • /def/world/overlay.sii
  • /def/world/prefab.sii
  • /def/world/railing.sii
  • /def/world/sign.sii
  • /def/world/terrain_profile.sii
  • /def/world/trigger_action.sii
  • /def/world/tr_lights.sii
  • /def/world/vegetation.sii
  • /def/world/vegetation_model.sii
  • /def/world/road_look.sii

Changes in road.sii

Previously the road looks were defined in road.sii. This created unnecessary conflicts between mods trying to add different looks.

For 1.4. patch we extracted the definition of the road looks to separate road_look.sii file which supports the addition behavior mentioned above. Note that at this time there is no such support for the material definitions.

To maintain partial backwards compatibility, if the road_look array is found in the road.sii, it is used instead of the content of road_look.sii file. Additional list files are still append.

Changes in countries

As we added more countries, it is possible that, if you used too low country id value, there will be conflict (it is reported in the log). In that case you need to assign a new country id to your country (it is recommended to use value from the list found in comment inside country.sii), load the map, fix country assignments on the border prefabs and Recompute (F8) the map.

Note that as we will be adding more countries in the future dlc, it is recommended that you use value of country_id from the list or at least use a higher values. They do not have to be continuous and values up to 255 are valid.

Additional helper commands were added:

  • g_next_border_node - Cycles between individual border nodes which define the countries
  • mark_country id - Which marks the items belonging to specified country on the ui map. If the map is visible when the command is issued, you need to hide it or change zoom level for the geometry to be regenerated.

Changes in AI definition

Previously the frequency of individual types of AI vehicles in specific country were defined in list stored in the sii file for the corresponding country. Vehicle type which was not part of the list was not generated in that country. This created unnecessary conflicts between mods trying to add ai vehicles and even with the base game itself (e.g. the missing Opalin bus).

For 1.4. patch we extracted the information to separate files named "/def/country/<country_name>/ai/<vehicle_type>.sii" where <country_name> is name of the country this information is for and <vehicle_type> is type of the vehicle. The file specifies frequency (see the game data for more info) with which the specified vehicle will appear (e.g. frequency of 3 will cause the vehicle to be three times more likely that it would be normally). The frequency is represented as floating point number from <0;10> range with precision to 0.1. If the frequency is zero, the vehicle is not generated in that country. If file for specified combination of country and vehicle does not exist, a default frequency of 1 will be used.

To maintain partial backwards compatibility, the game will respect the traffic_cars array, including the original behavior for non-included vehicles, if the new directory for that country does not exist.

Changes in company definition

Previously the types of cargoes generated and consumed by company were defined in lists stored in the sii file for the corresponding company. This created unnecessary conflicts between mods trying to add different cargoes.

For 1.4. patch we extracted the information to separate files stored in "/def/company/<company_name>/in/" and "/def/company/<company_name>/out/". While the exact file names are not important, it is highly recommended that they use the same name as the corresponding cargo (e.g. "digger500.sii" for "cargo.digger500"). Each file specifies name of single cargo (see the game data for more info) to be consumed (in) or generated (out). If the cargo name is empty, corresponding file is ignored. This can be used to disable undesired cargo.

To maintain backwards compatibility, if the company file contains the old in_cargo/out_cargo lists, the game will append them to the list generated from the files.

For the editor to properly support the companies, it is necessary to have for each existing combination of company and city a definition file /def/company/<company_name>/editor/ which specifies combination of name of city and name of the prefab (e.g. 67 for prefab.67) which is used by the company in that city. Name of the file itself is not important. If both names are not set, the file is silently ignored. Note that if more than one file (including in other mods present in mod directory) specifies the the same combination of city and prefab, the editor will silently use one of them seemingly arbitrarily.

If you see "Company assignment failed for item ..." error message, there is no definition file for combination of corresponding prefab and city

Changes in quarries

To simplify handling we combined all quarries to a single company. When loading older saves, the log might contain error messages about missing quarry companies. This is a expected behavior. If your mod changes the /def/company.sii file, it is possible that it will fail to load as the definitions for the old quarry companies are not not part of the base def.scs file.

Changes in /custom directory

The custom included .sii files (e.g. signs.sii, models.sii ...) stored in this directory are obsolete and should be replaced by the list mechanism described above. For backward compatibility they are still supported by 1.4. patch however they might be removed in some future patch.

Changes in map format

We changed the map format to allow simultaneous editing by more than one user. This should also allow simultaneous extension of the map by more than one mod provided that they operate in different parts of the map and sufficient care is taken. The old format of the map can be still loaded by the editor to allow its conversion to the new one.

Sectors

In the new format the map is separated into grid of fixed size sectors. The .mbd file now contains only basic metadata information. All other information is stored as set of files in matching subdirectory (e.g. "/map/europe/" for "/map/europe.mbd"). The resulting map as seen by the game or editor is combination of all sectors found in that subdirectory regardless of which .scs pack they are coming from (the usual file overloading still applies).

Usually only the sectors containing real changes are updated when saving the map. It is however possible, that various inaccuracies during recalculation might cause some other sectors to be changed as well. As long you know, that you did not change that sector in any way, you can ignore the change to its files. Another way is to use the locking functionality of [#edit_mark command] to lock all sectors you do not intend to edit before you start making changes. Locking a sector will prevent it from being modified and sectors, which are locked at time of the save, will be not saved.

UID

The objects are identified using a 64-bit identifier (UID) which must be unique in the entire map. Part of the UID is based on creation time and rest is based on random and sequential components. While a conflict is unlikely to happen by accident, it might happen when huge number of objects is created in the same moment by two editors. If many editors are working simultaneously on the map, you might use the new g_artist_id cvar to set a fixed portion of the UID (0-15) to ensure that such conflict can not happen between them. A more likely reason for the conflict is, when two map sectors contain the same object. For example when the object was moved between sectors and the changes in the source sector were lost for some reason or if the source sector is overloaded by some mod by variant which still contains the object.

When conflict is detected, sector load will fail and the log will contain information about the UID of the object and name of one from the sectors which are part of the conflict. In that case you can temporarily remove the files for the sector, load the map in the editor and use the find functionality to locate the other copy of the problematic object and remove it.

Changes in PMG files

To improve loading performance, we changed the layout of the file to match the layout of the buffers used by the game. The game can still load the older format albeit slower.

The new 0x506d6713 format stores the vertex attributes as interleaved:

  • If model is not animatable (bone_count == 0) the attributes for single vertex are stored together in static pool and the stride is sizeof(all vertex attributes
  • If the model is animatable (bone_count != 0) the attributes for single vertex are divided into static and dynamic part each having its specific stride
    • static : sizeof(colors (u32) + colors2 (u32 if present) + texcoords (float2 * coord_count))
    • dynamic: sizeof(positions (float3) + normals (float3) + tangents (float4 if present))

The offset fields in the header point to corresponding attribute inside the first vertex.

Changes in flares

The model attribute of the flare_traffic_light unit now contains directly path to the model pmd file instead of name of template object. As result it is not possible to specify the variant and look. First variant and look found in the model will be used.

Changes in city sign overlays

To improve extensibility, the city sign overlays are not part of a single model anymore. Each city has its own separate material file in /material/overlay whose name corresponds to name mentioned in /def/world/overlay.sii (see #Changes in files containing lists of objects).

Additions

edit_mark command

We added a edit_mark console command which can be used from editor to highlight set of sectors (in editor) or protect them for accidental modification while editing the map. The changes applied by this command are runtime-only and will be NOT stored by save.

Executing the command without a parameter will list all the variants. Following variants are available:

  • edit_mark set sector_file [hexadecimalcolor]
    Marks all sectors from the file with specified color. A green color is used if no color is provided. Sectors not mentioned in the file have theirs marking unchanged.
  • edit_mark set_all hexadecimalcolor
    Marks all sectors using specified color.
  • edit_mark intersect first_file second_file [hexadecimalcolor]
    Marks all sectors found in both files with specified color. A green color is used if no color is provided. Sectors outside the intersection have theirs marking unchanged.
  • edit_mark clear_all hexadecimalcolor
    Removes marking from all sectors.
  • edit_mark lock [sector_file]
    Locks all sectors from specified file or all sectors if no file is provided
  • edit_mark unlock [sector_file]
    Unlocks all sectors from specified file or all sectors if no file is provided

Some variants of the command take a file defining set of sectors using a FULL path in the file system. Only '/' must be used as directory separator. The sector file has on each line pair of numbers separated by semicolon. The numbers represent coordinates of the sector in the grid. e.g.

-06;+07
-07;-01

mark_country command

Marks roads and prefabs belonging to country with specified country_id on the in-game map. After issuing the command, the UI-map needs to be regenerated by hiding it or by changing the zoom level.

g_next_border_node command

Moves the editor camera to next node marked as border. Repeated uses of this command will cycle over all such nodes. Can be used to fix/check the country assignments if you had to change the country id.