Changes

Jump to navigation Jump to search

Documentation/Engine/Random Road Events

4,216 bytes added, 07:48, 24 May 2018
Synchronization
</pre>
=== Total length ===
 
The total length of RE is defined as: <pre>total_length = (distance between start cutscene placement and end cutscene placement) + (start cutscene right width) + (end cutscene left width)</pre>
 
Depending on defined '''max/min_length''' there can be three situations by spawning of the RE:
* '''max_length''' not defined - Start and end cutscenes are placed in the way that '''total_length''' is the same as road length and the RE occupies.
* '''max_length''' < '''total_length''' - Start and end cutscenes placements are translated closer to each other so that computed '''total_length''' is equal to '''max_length'''.
* '''min_length''' is defined and '''min_length''' > '''total_length''' - RE will not be spawned.
=== Total length ==={{Note|In case of very short road segment it is possible that no layer cutscene will fit into the middle, so one can use '''min_length''' to prevent this.}}
TODO{{Note|In case that '''traffic_block''' is set to true then there must be '''35m of uninterrupted''' roads in front and the back of RE, otherwise event will not spawn.}}
=== Curvature ===
TODOAs roads are usually not straight it's essential that RE can be spawned on curved roads also. This is driven by '''layer_min_curve''' and '''layer_max_curve''' attributes which have to be defined for all layer cutscenes (number of elements in this arrays has to be the same). These numbers determine the minimal and maximal allowed curvature between each adjacent cutscene within one layer. [[File:Engine random event curvature.jpg|600px]] Example above shows layer consisting of two barrier cutscenes and direction vector of their placements (blue arrows). Curvature is then computed as angle between these vectors, from which we can get minimal and maximal curve angle.
=== Signage ===
TODOAs RE can change flow of the traffic and even block lanes, we have to have support for warning signage which is placed before and after event. Warning signs are defined with:* '''signs_cutscenes_inner''' and '''signs_distances_inner''' - defines signs and it's distances on most inner road lane.* '''signs_cutscenes_outer''' and '''signs_distances_outer''' - defines signs and it's distances on most outer road lane. In both cases sign cutscenes donates array of cutscenes for warning signage and distances provide their placement (this also means that array size of cutscenes and distances has to be the same). Positive distances place sign cutscene before road event and negative distances place sign cutscene after road event (example below shows inner signs placed before event). Thus for RE to be spawned there has to be enough uninterrupted road before and after event (at least as much as provided maximal distance). [[File:Engine random event cutscene signs.jpg|800px]] === Synchronization === Choices which cutscene will be generated from the '''start_cutscene''', '''end_cutscene''' and '''layer_cutscene''' are independent. But sometimes it could be useful to have some degree of dependency between them. Because of that the game can synchronize their selection. We can have 2 cases when the synchronization will happen:# RE has both '''start_cutscene''' and '''end_cutscene'''. If these cutscenes have the same number of '''cutscene tokens''' then the game will randomly choose index for both of them.#* Moreover if the RE has '''layer_cutscene''' with the '''fixed''' sequence mode and the number of '''cutscene tokens''' is the same as the '''start_cutscene''' and '''end_cutscene''' tokens then, their chosen index will be used for the '''layer_cutscene''' as well.# RE has either '''start_cutscene''' or '''end_cutscene'''. If the RE has '''layer_cutscene''' with the '''fixed''' sequence mode and the number of '''cutscene tokens''' is the same as the '''start_cutscene''' resp. '''end_cutscene''' tokens then the index selected for the '''start_cutscene''' resp. '''end_cutscene''' will be used for the '''layer_cutscene''' as well. [[File:Engine random event sync1.png|1000px]] [[File:Engine random event sync2.png|1000px]] Example of two RE variants with synchronized '''start_cutscene''', '''end_cutscene''' and the first '''layer_cutscene'''. = See also = * [[Documentation/Engine/Units/journey_events_cutscene]]* [[Documentation/Engine/Units/journey_events_road_event]]

Navigation menu