Changes

Jump to navigation Jump to search

Games/ATS/Modding guides/1.29

3,256 bytes added, 07:54, 27 April 2018
Changes
= Changes =
== New Navigation Data navigation data ==
New navigation algorithm uses detailed info from traffic lanes so it can take lane counts, direction and other things into consideration. Be careful to have correct navigation data in map. For example if crossing prefab does not have a AI lane for right turn, the navigation will not turn right even if that means that it will find a much longer path.
It has some few value to compute weight of prefab roads, or other path segments, much like values for time evaluation of them. All are attributes of The '''''map_data''''' unit (in '''''/def/map_data.sii''''')contains a few attributes which can be used used to tweak the routing heuristic and the estimated driving time.
General values used by navigation:
* '''''navigation_maximum_speed''''' (25.0) - Maximum reasonable speed used for navigation computations (in m/s). Necessary due Keep it small to scaling for best precisionimprove efficiency of the search.* '''''navigation_turn_back_length''''' (400000.0) - Length of artificial connections representing u-turn not allowed by AI lines.
* '''''navigation_prefer_small_wide_road_penalty''''' (10.0) - Penalty applied to roads with more than one lane in a direction when using prefer_small_roads routing mode. Multiplicative.
* '''''navigation_special_prefab_additive_penalty''''' (0.0) - Penalty in meters applied to paths going over special prefabs (e.g. gas stations) outside cities. Additive. Generally should be left at zero unless no gas/weight station prefab used in map includes normal road in addition to the gas station area.* '''''navigation_special_prefab_additive_penalty_city''''' (0.0) - Penalty in meters applied to paths going over special prefabs (e.g. gas stations) in cities. Additive. Usually should be left at zero, see '''''navigation_special_prefab_additive_penalty'''''.* '''''navigation_gps_avoid_additive_penalty''''' (20000.0) - Penalty in meters applied to paths going over items roads or prefabs marked as "GPS Avoid". Additive.
Weights used for path findingin '''''prefer_shorter''''' routing mode.* '''''navigation_city_penalty''''' (1.0) - Penalty applied to paths through city area. Multiplicative* '''''navigation_slow_road_penalty''''' (5.0) - Penalty applied to paths through slow time area. Multiplicative Weights used for path finding in '''''best''''' routing mode:
* '''''navigation_narrow_road_max_speed_usage''''' (0.8) - Portion of maximal speed to use on narrow roads.
* '''''navigation_road_max_speed_usage''''' (0.9) - Portion of maximal speed to use on normal roads.
* '''''navigation_time_turn_oposite_side_duration''''' (30.0) - Time cost of turning to the oposite side (e.g. left in USA/continental, right in UK) - time calculation. Additive.
A road items in editor can be marked with "GPS Avoid" flag. This will cause the navigation to apply a huge penalty to paths using this road. There is no such flag for prefab items however prefab_model definition supports a gps_avoid attribute which will enable it for all uses of that prefab in map.
 
== Prefabs ==
 
The prefab format was changed to include separate data for use by the new navigation. The game should be able to automatically convert old prefabs with correctly formed AI lines and new version of conversion tools will generate them automatically.
 
=== Format changes ===
 
The new format adds navigational nodes. They are derived from both normal prefab nodes and AI curves. Each navigational node corresponds to either normal node or to end point of AI curve. Basically it is a simplified graph over AI curves representing places important for the navigation (e.g. for of AI lane) to reduce the size of the navigational graph.
 
The table of navigational nodes is stored in the same way as other tables. Offset and size of this table is stored directly after matching fields for intersection table.
 
Each navigational node has the following format
 
<nowiki>
u8 type; // Type of node. 0 = physical node, 1 = AI curve
u16 index; // Depending on the type it is either index of normal node or index of AI curve to whose ending point this nav node corresponds
u8 connection_count; // Number of outgoing connections leading to other navigational nodes (0-4)
connection_info connections[4]; // Information about those connections. First connection_count entries are used. Rest is set to {0xffff, MAX_FLOAT, 0, 0xffff[8]}</nowiki>
 
Each connection info structure has the following format
 
<nowiki>
u16 target_node; // Index of navigational node this connection leads to
float length; // Length of the connection in meters
u8 curve_count; // Number of AI curves the connection is created from, limited to 8, if more would be necessary, insert additional nav node
u16 curve_indices[8]; // Indices of the relevant AI curves in order they should be used. First curve_count entries are used, reset is set to 0xffff.</nowiki>
 
Additionally the AI curve structure was changed by adding a u32 value at its end. This value contains index of a navigational node which should be used if navigation starts from that AI curve or 0xffffffff if there is none. Basically it is a reverse mapping to the curve_indices from from nodes.
== Flares Data data ==
Flare blink unit (usually found as hookup defined models inside '''''/unit/hookup''''' directory) was reworked to use blinking pattern instead of just simple ON and OFF delays. Thus '''''blink_delay_on''''' and '''''blink_delay_off''''' attributes were removed and replaced with '''''blink_pattern''''' and '''''blink_step_length'''''. Unit is now defined as follows:
Consequentially flare blink sync inherited attributes and behavior from flare blink unit and has the same two new attributes: '''''blink_pattern''''' and '''''blink_step_length'''''.
== Time Zones Data zones data ==
Time zones are (for now) country based. Each country has defined '''''time_zone''''' (integer, in minutes) and '''''time_zone_name''''' (string). Eg. pacific daylight time is -420 minutes with "PDT" name.
In addition there is default timezone, stored in '''''economy_data''''' unit ('''''default_time_zone''''', '''''default_time_zone_name'''''), this is zone basic game time is expected int and its used every time where relevant spatial location and thus time zone is not known.
== Economy Data data ==
Some old values has been exported to '''''economy_data''''' unit ('''''/def/economy_data.sii''''') attributes:

Navigation menu