Traffic Lights (EM4)

This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

  • For the control of traffic on intersections, EMERGENCY 4 offers traffic light circuits. This tutorial explains how to build them.

    Traffic Lights

    It's possible to build traffic light systems at intersections in EMERGENCY 4, in order to control the traffic like in the real world. Each intersection can have up to four traffic lights. The following tutorial explains how to set up traffic light circuits.

    Build traffic light circuits

    Place and name traffic lights

    At first we open the map, on which we want to place the traffic light circuit. The next step is to place the models of the traffic lights. The models can be found in Objects -> Road Signs at the end of the list (check the picture below). Now we choose the model "Traffic Light 01".



    Now we place the model on each street, that leads to our intersection. The following picture is just an example, but in the real world the traffic lights would be placed in the same way.



    The next step is to name the traffic lights, so EMERGENCY 4 can recognize them als legit traffic lights and control them in the game. For this reason, we select the first traffic light and open the Properties menu in the left corner of the editor (marked with blue color in the picture below). We also can attach addtional pedestrian traffic lights, by checking the boxes in the green part of the menu.

    In the field beneath Objekt Name (red in the picture below) we can replace the name "Unnamed" with our own expression. How traffic lights have to be named is explained in the following paragraph.



    Every traffic light has to be labeled by the same scheme:

    [/i]traffic_A_B_C[i]

    Explanation:
    A - Number of the traffic light circuit
    B - Number of the traffic light within the traffic light circuit
    C - Time (in seconds) for the green-phase of the traffic light

    Example:
    traffic_1_3_6
    This traffic light is placed at interesction 1, it's traffic light number 3 within this intersection and the green-phase takes about 6 seconds.



    The last number, the duration of the green-phase, is very difficult to determine only by estimating the time in the editor. The best approach is to set the duration between six and ten seconds at first. Then you can observe the interesction with traffic in the game and check if the time is enough to handle the traffic without any traffic jams. If there is any traffic jam, you can increase the number of the traffic light with the traffic problems, in order to let more vehicles pass the interesction.



    The duration is set in seconds. On slow computers and with complex scripting functions running, EMERGENCY 4 can calculate the internal refresh processes a little bit slower. The effect is inaccurate calculation of the traffic lights green-phase duration, so the duration of the green-phases in-game can distinguish from real time.



    For our example intersection the traffic light will be named with "traffic_1_1_6".

    If you have entered the correct name, you can confirm it with OK in the right lower corner of the window. Now you'll have to name the other traffic lights in the same way.
    The correct names for all four traffic lights are:

    traffic_1_1_6
    traffic_1_2_6
    traffic_1_3_6
    traffic_1_4_6



    The second number in the name also determines in which order the traffic lights will be controled be the game. EMERGENCY 4 starts with traffic light number one, goes through until number four and starts with number one again. This can be important in order to realize especially traffic light circuits.



    Create and name virtual objects

    The next step is to create stopping lines for the traffic. For this reason, we use virtual objects (short form VO).

    At first, we open the Virtual Objects Editor in the command line under [Edit]. Alternatively you can press the shortcut F5.
    Next we click on [New] in order to create a new virtual object, You can place it like the VO in the picture below.

    Wichtig: The vehicles stop at the front side of the virtual object. In our case, it's the red marked line in the picture.

    The name follows the same scheme as the traffic lights itself. Only the duration for the green-phase at the end is missing. Our first virtual object will be named "traffic_1_1".



    We repeat this step until every traffic light has it's own virtual object. Take care to assign every virtual object to the right traffic light. The traffic light named "traffic_1_3_5" needs the virtual object named "traffic_1_3" nearby.

    If everything is finnished, the interesction should look like this:



    Create triggers for the intersection

    The traffic light circuit is already working with the traffic lights and virtual objects. But for the endless or challange mode of the game, we need additional triggers in order to enable defective traffig light incidents. We open the trigger menu under the menu point [Edit] and create with [New] a new trigger. The trigger has to be placed like the example trigger in the picture below, then name if "traffic_1".



    Now we have finnished a full traffic light circuit!

    Summary


    Below you can find the most important steps again:

    >> Max. four traffic lights per intersection

    But you also can plase only two or three traffic lights, for T-intersections for example.

    >> Traffic lights have to be named with the following scheme

    "traffic_A_B_C"

    A - Number of the traffic light circuit
    B - Number of the traffic light within the traffic light circuit
    C - Time (in seconds) for the green-phase of the traffic light

    Virtual objects ("traffic_A_B") and triggers ("traffic_A") n

    >> The second digit controls the order of the green-phases

    EMERGENCY 4 sets the green-phases from 1 to 4 and starts at 1 again

    >> If there are any traffic jams on the map you should adjust the green-phases of your traffic lights

    You can increase the duration of the green-phase at certain traffic lights in order to let more vehicles through the intersection. You can also decrease the duration on the other traffic lights.

    1,277 times viewed