Modding

Modding guides for 1.11.0

Recomendations

  • The following prefab and node templates have incorrect node positions in 1.11 and will be fixed in some future patch. Please avoid using them until then to avoid compatibility issues.
    • /prefab/fork_temp/exit_road_joint_tmpl
    • /prefab/fork_temp/exit_road_joint_mirrored_tmpl
    • /prefab/fork_temp/hw2_one_way_joint_tmpl
    • /prefab/fork_temp/hw2_one_way_joint_mirrored_tmpl
    • /prefab/fork_temp/road1_split_tmpl
    • /prefab/fork_temp/hw2_exit_joint_tmpl
    • /prefab/fork_temp/hw2_exit_joint_mirrored_tmpl
    • /prefab/fork_temp/hw2-hw2_exit_tmpl
    • /prefab/fork_temp/hw2-hw2_exit_mirrored_tmpl
    • /prefab/fork_temp/exit_road_joint_short_tmpl
    • /prefab/fork_temp/exit_road_joint_short_mirrored_tmpl
    • /prefab/fork_temp/hw_exit_joint_narrow_tmpl
    • /road_template/hw_exit
    • /road_template/hw2_exit_one_way

  • 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.

How to convert map

  • If you added Swden, Norway or Denmark as part of your mod, remove inclusion of those units from your mod-specific country.sii.
  • If you added Venice, Klagenfurt or Graz as part of your mod, remove inclusion of those units from your mod-specific city.sii.
  • If you did not properly use suffixes when adding new units, rename your units to avoid conflicts in the places where we added a new ones.
  • Load the map in the editor. If the load fails, examine the log and fix the errors. The -unlimitedlog command line parameter might be useful during that if you have many old prefabs.
  • Use the replacement dialog (F3, "Prefab node correction") to add to the map nodes which we added to some prefabs
  • Save map
  • Do rebuild (F8)
  • Save map

Changes

Mirror accessories

Previously the game did automatically hide the mirror accessories from the truck when rendering the reflection texture to avoid incorrect use of the rendering API. For this version we replaced this with explicit visibility flags specified in the accessories (see Accessory hiding). If you created a new accessory or modified .sii file of existing one, you need to apply the corresponding flags, usually 0x1E00.

Accessory hiding

It is now possible to explicitly hide addon accessories (accessory_addon_data) during specific rendering (e.g. specific mirror, shadows, reflections) if it would be obstructed by some geometry or have negligeable effect. This is done using a new hide_in attribute. The proper value for that attribute can be calculated using the calculator bellow. There are specific limitations:

  • Do NOT use values different from those generated by the calculator. That might cause issues on multi-monitor systems.
  • Accessories whose model references textures containing the mirror reflection (e.g. the mirrors itself) MUST be marked as not visible in the mirrors. Previously there was special mechanism to handle this however the now game exclusively relies on hide_in attribute to handle that.

Hide following views

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

Gearbox names

There was added optional structure that could display string for given gear. Short strings (up to 3 letters) are generally encouraged because not all truck dashboard may fit longer ones.
Names are added per transmission basis into standard definition in the /def/vehicle/truck/<truck_name>/transmission/<transmission_name>.sii. Gearbox can have new attribute transmission_names and its value is link to structure containing the names.

If the structure does not contain names for all possible gears default names (N, R, Dx) will be used.

Example of defining transmission names:

SiiNunit
{
accessory_transmission_data : 12_speed.scania.r.transmission
{
   transmission_names: .names
}

transmission_names : .names
{
  neutral: "N0"
  forward[0]: "C"
  forward[1]: "1L"
  forward[2]: "1H"
  forward[3]: "2L"
  forward[4]: "2H"

  reverse[0]: "R"
}
}

Changes in editor

Batch renaming improvents

The batch renaming feature now also supports replacement of prefab_looks and prefab_variants using new prefab_look and prefab_variant string arrays. The format of the string is following: "object_identification|new_value" where new_value is name of look or variant to set. The object_identification might be either just the name of the prefab (e.g. "322" for "prefab.322") to replace look/variant for any prefab of that name or name combined with old value (e.g. "322-foo") to replace the look/variant on prefabs of that name which currently have the specified value ( warning the replacement arrays are processed in order so the rule specified latter will see and might react to changes done by rule specified earlier).

It is now possible to specify "all sectors" by setting the sectors attribute to single entry containing "*".

Changes in traffic

AI vehicles

Simulation of AI vehicle acceleration has been improved. Acceleration is now influenced by:

  • whether the vehicle drives uphill/downhill
  • value of 'vehicle_mass' attribute (set per-vehicle in base/def/vehicle/ai/*.sii")
    • in case of trucks also the trailer mass and cargo mass are taken into account
  • value of 'engine_torque' (set per-vehicle in base/def/vehicle/ai/*.sii")
    • equivalent of 'torque' attribute set in truck engine accessory
  • values of 'gearbox' (set per-vehicle in base/def/vehicle/ai/*.sii")
    • in case of trucks, gearbox should have some reasonable values for trucks without any trailer
    • the gearbox now contains values for gear ratio coefficients instead of the acceleration
      • the first (and the highest) value for gear ratio coefficient is 1.0
      • the rest of the values are decreasing with increasing gear

Traffic signs and rules

NOTE: this topic concerns both AI vehicles and player vehicle

Prefabs
  • Traffic signs are no longer only a decoration, so please make sure you place them as they would be placed in real life
    • see more about traffic sign placing in the 'MAP' section below
  • As you probably know, in real life, traffic speed limits are canceled at the end of a crossroad. The game can automatically detect a crossroad where prefab curves leading from different nodes join or cross. However, there also exist crossroads where no curves meet. Good examples are highway prefabs or gas stations. In these cases, set the 'Crossroad end' traffic rule for prefab locators at places where the speed limit should be canceled.
  • In case of horizontal traffic signs (lines), don't forget to set the curve flags/rules, so that AI vehicles behave correctly:
    • set the intersections so that vehicles stop at the line
    • set the 'Stop' traffic rule at the curve locator, where vehicles should stop (in ADDITION to the stop sign)
      • in case there is no stop line, vehicles automatically stop at the closest intersection
  • Only use the 'per-curve' traffic rules when there is no traffic sign which the same functionality. For example, DON'T use any speed limit rule for curves - we have traffic signs for it.
  • As before, always check the 'correctness' of blinkers, intersection priorities, etc...
Traffic Signs
  • Traffic signs are no longer only a decoration, so please make sure that traffic sign models (/base/def/world/sign.sii) have correct traffic rules assigned to them:
    • speed limit and 'end of speed limit' signs
    • highway start
    • city area start, city end
    • stop signs
Road Looks
  • ALWAYS check if the value of 'ai_speed_type' property is set correctly (city/regular/highway)
    • this property is used to determine the speed limit if there are no traffic signs to override it
Map
  • Traffic signs are no longer only a decoration, so please make sure you place them as they would be placed in real life
  • Map designers have probably the biggest responsibility in creating the 'traffic world', because the placing of traffic signs override all other item properties like ai_speed_type (defined in road looks) or intersection priorities (taken from prefab curves). These are some of things to check:
    • speed limit signs placed just before a crossroad make no sense, since the speed limit will be immediately cancelled
      • this also concerns cases where lanes merge (e.g. gas stations)
    • to influence certain traffic lanes, a traffic sign has to be:
      • not too far away from the traffic lane
      • oriented parallel with the direction of the traffic lane
    • when creating roads, always check if they their road look has a correct ai_speed_type (e.g. don't use roads with 'regular' speed type to create highways)
      • a special case are 'city roads' - road with any speed type is considered a 'city road' as long as it is inside a city square