Working Starting timer for my track

Discussion in 'General' started by Massimo, Dec 17, 2020.

  1. Xuacu

    Xuacu Member

    Joined:
    Jun 13, 2023
    Messages:
    39
    Likes Received:
    14
    I still don´t understand why you streched 1 second in 30 parts of second :oops:. It is because you decided that the loop is 30 seconds? If I want a loop of 50 seconds should I use Frequency=0,02 (1/50)?
     
  2. fughettaboutit

    fughettaboutit aka leBluem

    Joined:
    Jul 21, 2014
    Messages:
    1,119
    Likes Received:
    380
    yes exactly, the idea was rally cars can go off every 30 seconds, 30 was choosen on purpose
     
  3. Xuacu

    Xuacu Member

    Joined:
    Jun 13, 2023
    Messages:
    39
    Likes Received:
    14
    Ok! in my case I want to make a traffic lights for real traffic (traffic planner) and I have to time the loop of a standard traffic light.


    from the minute 47:33
     
    Last edited: Mar 18, 2024
  4. fughettaboutit

    fughettaboutit aka leBluem

    Joined:
    Jul 21, 2014
    Messages:
    1,119
    Likes Received:
    380
    no idea how you sync the cars movement to the green lights, but you would need 6 six different lights and conditions, three for one direction, three for the other direction

    i made a table for it and the luts
    https://docs.google.com/spreadsheet...ouid=109009767124286172412&rtpof=true&sd=true

    edit: i probably made some error, it might not be fully symetric
    i mean not same timespan of green/red for both directions
    edit: actually it is, 8 rows red and 7 rows green on both sides :)
     
    Last edited: Mar 18, 2024
    Xuacu likes this.
  5. Xuacu

    Xuacu Member

    Joined:
    Jun 13, 2023
    Messages:
    39
    Likes Received:
    14

    In the Traffic Planer intersection edition you have the option of assigning traffic lights to each entrance, and one option is to assign an emissive element for each signal, red, amber or green. I want to test if it can work but first I have to get the light sequence right.

    I already had in mind that I had to do a minimum of 6 conditions for a 2-road intersection.

    I have tried your rally traffic light configuration and it works perfectly even though I am having MATERIAL_ADJUSTMENT problems but I don't care too much about that now before I want to do the light loops well
     
    Last edited: Mar 18, 2024
  6. fughettaboutit

    fughettaboutit aka leBluem

    Joined:
    Jul 21, 2014
    Messages:
    1,119
    Likes Received:
    380
    ok its more different, i post a complete and tested conditions later

    wait, traffic planner has something for that? then we dont need this condition stuff!
     
  7. Xuacu

    Xuacu Member

    Joined:
    Jun 13, 2023
    Messages:
    39
    Likes Received:
    14
    Yes it has. when you create an intersecction in the "edit connections" of each intersecction you can modiffy parameters and one of the options is "traffic light". But depends your CSP version can enter to the edition or not, in my case 1.1.79 does not work well but 1.2.2 works all intersection configurations
     
  8. fughettaboutit

    fughettaboutit aka leBluem

    Joined:
    Jul 21, 2014
    Messages:
    1,119
    Likes Received:
    380
    note that you need to set
    1=1 as last value if first lut-value is =1
    and vice versa
    1=0 as last value if first lut-value is=0

    Code:
    [CONDITION_...]
    NAME=T1_RED
    INPUT=ONE
    FLASHING_FREQUENCY=0.02
    FLASHING_SYNCED = 1
    FLASHING_LUT= (|0=1|0.50=1|0.50=0|1=0|1=1)
    FLASHING_SKIP_OFF_STATE=1
    FLASHING_SKIP_DOWNHILL_STATE=1
    
    [CONDITION_...]
    NAME=T1_YELLOW
    INPUT=ONE
    FLASHING_FREQUENCY=0.02
    FLASHING_SYNCED = 1
    FLASHING_LUT= (|0=0|0.49=0|0.49=1|0.50=1|0.50=0|0.99=0|0.99=1|1=1|1=0|)
    FLASHING_SKIP_OFF_STATE=1
    FLASHING_SKIP_DOWNHILL_STATE=1
    
    [CONDITION_...]
    NAME=T1_GREEN
    INPUT=ONE
    FLASHING_FREQUENCY=0.02
    FLASHING_SYNCED = 1
    FLASHING_LUT= (|0=0|0.50=0|0.50=1|1=1|1=0)
    FLASHING_SKIP_OFF_STATE=1
    FLASHING_SKIP_DOWNHILL_STATE=1
    
    [CONDITION_...]
    NAME=T2_RED
    INPUT=ONE
    FLASHING_FREQUENCY=0.02
    FLASHING_SYNCED = 1
    FLASHING_LUT= (|0=0|0.50=0|0.50=1|1=1|1=0)
    FLASHING_SKIP_OFF_STATE=1
    FLASHING_SKIP_DOWNHILL_STATE=1
    
    [CONDITION_...]
    NAME=T2_YELLOW
    INPUT=ONE
    FLASHING_FREQUENCY=0.02
    FLASHING_SYNCED = 1
    FLASHING_LUT= (|0=0|0.49=0|0.49=1|0.50=1|0.50=0|0.99=0|0.99=1|1=1|1=0)
    FLASHING_SKIP_OFF_STATE=1
    FLASHING_SKIP_DOWNHILL_STATE=1
    
    [CONDITION_...]
    NAME=T2_GREEN
    INPUT=ONE
    FLASHING_FREQUENCY=0.02
    FLASHING_SYNCED = 1
    FLASHING_LUT= (|0=1|0.50=1|0.50=0|1=0|1=1|)
    FLASHING_SKIP_OFF_STATE=1
    FLASHING_SKIP_DOWNHILL_STATE=1
    
     
    Last edited: Mar 18, 2024
    Xuacu likes this.
  9. fughettaboutit

    fughettaboutit aka leBluem

    Joined:
    Jul 21, 2014
    Messages:
    1,119
    Likes Received:
    380
    oh damn, for testing i used 0.2 as frequency, but easy to replace with 0.02
     
    Xuacu likes this.
  10. Xuacu

    Xuacu Member

    Joined:
    Jun 13, 2023
    Messages:
    39
    Likes Received:
    14
    Thank you so much, I will try it! but at the end i will calculate the time of a real traffic lights because depends the main road and secundary roads preference time
     
  11. Xuacu

    Xuacu Member

    Joined:
    Jun 13, 2023
    Messages:
    39
    Likes Received:
    14
    0,2= 5 secs ; 0,02= 50 secs?
     
    fughettaboutit likes this.
  12. fughettaboutit

    fughettaboutit aka leBluem

    Joined:
    Jul 21, 2014
    Messages:
    1,119
    Likes Received:
    380
    updated lut for
    NAME=T1_GREEN
    in above post
     
    Xuacu likes this.
  13. fughettaboutit

    fughettaboutit aka leBluem

    Joined:
    Jul 21, 2014
    Messages:
    1,119
    Likes Received:
    380
    :lol: updated the whole thing now
     
    Xuacu likes this.
  14. Xuacu

    Xuacu Member

    Joined:
    Jun 13, 2023
    Messages:
    39
    Likes Received:
    14
    Thank you! ;)
     
  15. Xuacu

    Xuacu Member

    Joined:
    Jun 13, 2023
    Messages:
    39
    Likes Received:
    14
    Hello! here is my current traffic light status with some problems



    The problem is that I defined a loop of 90" but in AC the loop takes 141,5" and I dont understand why. The time of the green and yellow matches with my calculation but the red light spend much more time but matches with the start of the loop correctly...

    I can change the FLASHING_FREQUENCY (in my case is: 1/90 = 0,0111) and
    and approach the real time of 90" in AC but the green and yellow correct times I would waste and would be a mess recalculate at a guess.

    Below I explain my calculations (if I get everything working I will make a tutorial on YouTube explaining everything step by step):


    This is my loop. Traffic lights A+B are those on the main road, C and D are on the secondary one that cross and operate one after the other.

    [​IMG]

    In Asseto Corsa I have only tried the AB timeline so we discard the rest for the moment

    [​IMG]

    The green traffic light starts at 0 and ends at 23" then amber lasts 3" and red from second 29 to second 90

    1/90= 0,0111 is the frequency. To calculate the LUT I divide each on/off time by 90 and these are the values: 23"/90=0.255; 26"/90=0.288 so the LUT looks like this:

    AB_GREEN
    FLASHING_LUT= (|0=1|0.25=1|0.25=0|1=0|)

    AB_YELLOW
    FLASHING_LUT= (|0=0|0.25=0|0.25=1|0.28=1|0.28=0|1=0|)

    AB_RED
    FLASHING_LUT= (|0=0|0.28=0|0.28=1|1=1|)

    But the problem is that the loop lasts much longer than I calculated and I don't understand why.

    Below I leave all the traffic light configuration:

    ----------------------------------------------------------------------------------------------------------------------------

    [MATERIAL_ADJUSTMENT_...]
    ACTIVE=1
    DESCRIPTION = Green AB Traffic Light
    MATERIALS= Disco_Verde
    KEY_0=ksEmissive
    VALUE_0=0,150,0,1.09
    VALUE_0_OFF=0, 0, 0
    KEY_1= ksAlphaRef
    VALUE_1=0
    VALUE_1_OFF=100
    RANGE=25
    CONDITION= BLINKGREEN

    [MATERIAL_ADJUSTMENT_...]
    ACTIVE=1
    DESCRIPTION = Amber AB Traffic Light
    MATERIALS= Disco_naranja
    KEY_0=ksEmissive
    VALUE_0=255,150,0,5.09
    VALUE_0_OFF=0, 0, 0
    KEY_1= ksAlphaRef
    VALUE_1=0
    VALUE_1_OFF=100
    RANGE=25
    CONDITION= BLINKYELLOW

    [MATERIAL_ADJUSTMENT_...]
    ACTIVE=1
    DESCRIPTION = Red AB Traffic Light
    MATERIALS= Disco_Rojo
    KEY_0=ksEmissive
    VALUE_0=255,0,0,1.09
    VALUE_0_OFF=0, 0, 0
    KEY_1= ksAlphaRef
    VALUE_1=0
    VALUE_1_OFF=100
    RANGE=25
    CONDITION= BLINKRED

    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

    CONDITIONS

    [CONDITION_5]
    NAME=BLINKRED ;
    INPUT=ONE
    FLASHING_LUT=(|0=0|0.28=0|0.28=1|1=1|)
    FLASHING_FREQUENCY=0.0111 ; loop 90 seconds
    FLASHING_SKIP_OFF_STATE=1
    FLASHING_SKIP_DOWNHILL_STATE=1
    FLASHING_SMOOTHNESS=1


    [CONDITION_6]
    NAME=BLINKYELLOW ;
    INPUT=ONE
    FLASHING_LUT=(|0=0|0.25=0|0.25=1|0.28=1|0.28=0|1=0|)
    FLASHING_FREQUENCY=0.0111 ; loop 90 seconds
    FLASHING_SKIP_OFF_STATE=1
    FLASHING_SKIP_DOWNHILL_STATE=1
    FLASHING_SMOOTHNESS=1


    [CONDITION_7]
    NAME=BLINKGREEN ;
    INPUT=ONE
    FLASHING_LUT=(|0=1|0.25=1|0.25=0|1=0|)
    FLASHING_FREQUENCY=0.0111 ; loop 90 seconds
    FLASHING_SKIP_OFF_STATE=1
    FLASHING_SKIP_DOWNHILL_STATE=1
    FLASHING_SMOOTHNESS=1

    ----------------------------------------------------------------------------------------------------------------------------


    On the other hand, I don't know what these values mean and if they affect the loop (I copied them from your first example):

    FLASHING_SKIP_OFF_STATE=1
    FLASHING_SKIP_DOWNHILL_STATE=1
    FLASHING_SMOOTHNESS=1


    Afterwards I tried to set these values of fughettaboutit excel and the loop when stopping stays static at the red light and does not start again, perhaps the problem is in these lines, I don't know...

    FLASHING_SYNCED = 1

    If it occurs to you what the problem could be, it would be of great help to continue. I haven't yet tested if the traffic lights work with traffic planer, during the week I don't have much time to experiment.

    Thank you very much in advance
     

    Attached Files:

    Last edited: Mar 21, 2024
  16. fughettaboutit

    fughettaboutit aka leBluem

    Joined:
    Jul 21, 2014
    Messages:
    1,119
    Likes Received:
    380
    Xuacu likes this.
  17. Xuacu

    Xuacu Member

    Joined:
    Jun 13, 2023
    Messages:
    39
    Likes Received:
    14
  18. Xuacu

    Xuacu Member

    Joined:
    Jun 13, 2023
    Messages:
    39
    Likes Received:
    14
  19. Rob Pawn

    Rob Pawn Member

    Joined:
    Sep 24, 2022
    Messages:
    92
    Likes Received:
    17
    Location:
    Germany
    more than a year ago i tried this, with the same result.
    and my intersection looked the same like yours (with more than 4 sides)

    now i was curious again and made a test.
    it seams to work for me somehow?! is it gambling tho?! i dunno...

    but i suggest try it with a normal 4 sided square intersection
    if this is not the solution like i think it is, maybe try messing around with the priority offsets.
    basically that every side/lane has another priority (in intersection menu)

    upload_2024-3-31_11-34-28.png

    but anyway, main focus is on multiplayer traffic. isn't it?
     
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice