Difference between revisions of "Documentation/Engine/Random Road Events"
(→Synchronization) |
(→Road events creation pipeline) |
||
(32 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
[[File:Engine random event.jpg|thumb|Random event preview|400px]] | [[File:Engine random event.jpg|thumb|Random event preview|400px]] | ||
− | |||
__TOC__ | __TOC__ | ||
Line 11: | Line 10: | ||
According to the length of the RE and the lengths of cutscenes, the space between start and end cutscenes is filled with layer cutscenes. | According to the length of the RE and the lengths of cutscenes, the space between start and end cutscenes is filled with layer cutscenes. | ||
+ | |||
+ | Composition of RE: | ||
+ | |||
+ | [[File:Engine random event composition.jpg|800px]] | ||
= Road events creation pipeline = | = Road events creation pipeline = | ||
For working road event we need: | For working road event we need: | ||
− | # Exported one or more cutscenes from map editor | + | # Exported one or more cutscenes from map editor. |
− | # Defined cutscenes exported in step 1 - [[# | + | # Defined cutscenes exported in step 1 - [[#Defining cutscenes for random events]]. |
# Defined journey cutscenes with last token of cutscene unit names defined in step 2 - [[#Defining journey cutscenes]]. | # Defined journey cutscenes with last token of cutscene unit names defined in step 2 - [[#Defining journey cutscenes]]. | ||
# Finally defined road events inside with linked journey cutscenes from step 3 - [[#Defining random events]]. | # Finally defined road events inside with linked journey cutscenes from step 3 - [[#Defining random events]]. | ||
− | == | + | == Defining cutscenes for random events == |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | + | TODO | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
== Defining journey cutscenes == | == Defining journey cutscenes == | ||
Line 55: | Line 31: | ||
All cutscene attributes of RE: '''start_cutscene''', '''end_cutscene''', '''layer_cutscenes''', '''mirror_cutscenes''', '''signs_cutscenes_inner''' and '''signs_cutscenes_outer''' are using same unit type: [[Documentation/Engine/Units/journey_events_cutscene|'''journey_events_cutscene''']], which are listed/defined in "'''/def/world/journey_cutscene.sii'''". | All cutscene attributes of RE: '''start_cutscene''', '''end_cutscene''', '''layer_cutscenes''', '''mirror_cutscenes''', '''signs_cutscenes_inner''' and '''signs_cutscenes_outer''' are using same unit type: [[Documentation/Engine/Units/journey_events_cutscene|'''journey_events_cutscene''']], which are listed/defined in "'''/def/world/journey_cutscene.sii'''". | ||
− | These cutscenes are then linked to RE via their unit names. | + | These cutscenes are then linked to RE via their unit names. For example cutscene "'''''j_cut.acc_stop_li'''''" defined below is featured as start cutscene of RE "'''''j_re.acc_plane'''''" in example above. |
Example '''journey_cutscene.sii''' file definition: | Example '''journey_cutscene.sii''' file definition: | ||
Line 71: | Line 47: | ||
journey_events_cutscene : j_cut.acc_stop_li | journey_events_cutscene : j_cut.acc_stop_li | ||
{ | { | ||
− | cutscene_tokens[]: acc_stop_li1 | + | cutscene_tokens[]: acc_stop_li1 |
cutscene_tokens[]: acc_stop_li2 | cutscene_tokens[]: acc_stop_li2 | ||
Line 107: | Line 83: | ||
# Rotate the cutscene in map editor so that driving direction is from right to left:<br>[[File:Engine random event cutscene widths.jpg|none|Random event cutscene left and right width]] | # Rotate the cutscene in map editor so that driving direction is from right to left:<br>[[File:Engine random event cutscene widths.jpg|none|Random event cutscene left and right width]] | ||
# Once seeing cutscene as on picture, use the ruler tool in map editor to measure distance from cutscene origin point on each side. | # Once seeing cutscene as on picture, use the ruler tool in map editor to measure distance from cutscene origin point on each side. | ||
− | # Use measured widths in | + | # Use measured widths in cutscene definition. |
== Defining random events == | == Defining random events == | ||
Line 137: | Line 113: | ||
journey_events_road_event : j_re.acc_plane | journey_events_road_event : j_re.acc_plane | ||
{ | { | ||
− | start_cutscene: j_cut.acc_stop_li | + | start_cutscene: j_cut.acc_stop_li |
layer_cutscenes[]: j_cut.acc_mid | layer_cutscenes[]: j_cut.acc_mid | ||
end_cutscene: j_cut.acc_plane | end_cutscene: j_cut.acc_plane | ||
Line 155: | Line 131: | ||
} | } | ||
</pre> | </pre> | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− |
Revision as of 14:57, 22 May 2018
Contents
Road events (RE) are dynamically generated situations on roads present in ETS2 and ATS.
RE are defined from several cutscenes placed along the road. RE distinguishes 3 types of cutscenes:
- Start cutscene - The first cutscene of the RE, only one per the RE.
- End cutscene - The last cutscene of the RE, only one per the RE.
- Layer cutscenes - Cutscenes between Start and End cutscenes.
According to the length of the RE and the lengths of cutscenes, the space between start and end cutscenes is filled with layer cutscenes.
Composition of RE:
Road events creation pipeline
For working road event we need:
- Exported one or more cutscenes from map editor.
- Defined cutscenes exported in step 1 - #Defining cutscenes for random events.
- Defined journey cutscenes with last token of cutscene unit names defined in step 2 - #Defining journey cutscenes.
- Finally defined road events inside with linked journey cutscenes from step 3 - #Defining random events.
Defining cutscenes for random events
TODO
Defining journey cutscenes
All cutscene attributes of RE: start_cutscene, end_cutscene, layer_cutscenes, mirror_cutscenes, signs_cutscenes_inner and signs_cutscenes_outer are using same unit type: journey_events_cutscene, which are listed/defined in "/def/world/journey_cutscene.sii".
These cutscenes are then linked to RE via their unit names. For example cutscene "j_cut.acc_stop_li" defined below is featured as start cutscene of RE "j_re.acc_plane" in example above.
Example journey_cutscene.sii file definition:
SiiNunit { # For modders: Please do not modify this file if you want to add a new entry. Create in # this directory a new file "<base_name>.<idofyourmod>.sii" where <base_name> is name of # 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. # # Warning: Even if the units are specified in more than one source file, they share the # same namespace so suffixes or prefixes should be used to avoid conflicts. journey_events_cutscene : j_cut.acc_stop_li { cutscene_tokens[]: acc_stop_li1 cutscene_tokens[]: acc_stop_li2 left_width: 80.0 // [m] right_width: 5.0 // [m] sequence_mode: pseudo } journey_events_cutscene : j_cut.acc_mid { cutscene_tokens[]: acc_mid_1 cutscene_tokens[]: acc_mid_2 cutscene_tokens[]: acc_mid_3 left_width: 15.0 // [m] right_width: 15.0 // [m] sequence_mode: pseudo } journey_events_cutscene : j_cut.acc_plane { cutscene_tokens[]: acc_rare_1 left_width: 35.0 // [m] right_width: 25.0 // [m] sequence_mode: pseudo } }
Cutscene width
In case of RE, cutscene definition of type journey_events_cutscene also uses left_width and right_width attributes, which defines the length of the cutscene. This two attributes are very important as they determinate how much space is between different cutscenes, how many layer cutscenes can be places in whole RE and where traffic blocks will be placed.
To determinate left and right width one has to:
- Add cutscene on the part of the road.
- Rotate the cutscene in map editor so that driving direction is from right to left:
- Once seeing cutscene as on picture, use the ruler tool in map editor to measure distance from cutscene origin point on each side.
- Use measured widths in cutscene definition.
Defining random events
All RE are stored in "/def/world/journey_road_event.sii" as list of journey_events_road_event units.
Example journey_road_event.sii file definition:
SiiNunit { # For modders: Please do not modify this file if you want to add a new entry. Create in # this directory a new file "<base_name>.<idofyourmod>.sii" where <base_name> is name of # 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. # # Warning: Even if the units are specified in more than one source file, they share the # same namespace so suffixes or prefixes should be used to avoid conflicts. journey_events_road_event : j_re.acc_uni_p { signs_distances_outer[]: 50 layer_min_curve[]: 0.0 layer_max_curve[]: 15.0 max_length: 55.0 min_length: 55.0 } journey_events_road_event : j_re.acc_plane { start_cutscene: j_cut.acc_stop_li layer_cutscenes[]: j_cut.acc_mid end_cutscene: j_cut.acc_plane min_shoulder_space: 3.0 outer_lane_allowed: true centerline_displacement: true layer_max_curve[]: 2.0 weight: 10.0 parent: j_re.acc_spec_p name: "Accident country specific plane (1)" } }