CitiesSkylinesMods / TMPE

Cities: Skylines Traffic Manager: President Edition
https://steamcommunity.com/sharedfiles/filedetails/?id=1637663252
MIT License
577 stars 85 forks source link

Traffic Lights not working sometimes feature #1499

Open t1a2l opened 2 years ago

t1a2l commented 2 years ago

Describe your idea

Screenshots?

image image

Why

Elesbaan70 commented 2 years ago

I think the basic implementation strategy would be to keep the traffic light flags set on the roads so that the props are still visible, but then make the traffic AI think all segment ends have stop signs instead. Then it behaves like a four-way stop until fixed.

Or just make the AI think there are neither lights nor signs. This might create a situation more realistic to how idiot drivers handle this in real life. 🤪

What's the word for the flashing icon over a location in the city to indicate a problem there? One of those would need to appear over the node.

t1a2l commented 2 years ago

I agree, that should be the basic. the police thing is just for extra realisem. We can just add a TMPE service that dispatch vehicles to traffic lights. Or make it a feature that require the DLC.

originalfoo commented 2 years ago

Tagging #305 , #980 , #1039

originalfoo commented 2 years ago

Traffic lights stops working randomly

What about making the chance of broken lights inversely proportional to road budget slider: image

High budget = less chance of lights breaking. Low budget = lights break more often. If user has Snowfall DLC, we could factor in road maintenance too, maybe?

As mentioned in #305 power cuts could cause broken traffic lights.

Or just make the AI think there are neither lights nor signs.

+1 ...although with some stuff that kryzchu is doing in #1229 that might result in traffic that's a bit too well behaved.

What's the word for the flashing icon over a location in the city to indicate a problem there? One of those would need to appear over the node.

Notification? Alert? ...what would user be expected to do upon discovering broken lights? Have lights fixed by a visiting road maintenance truck? If no Snowfall DLC, just have random time until lights automagically fix themselves?

t1a2l commented 2 years ago

Couple of options: A. require the snow fall dlc for this feature to work. B. if you have snowfall dlc - road maintenance will be used, otherwise the issue will be gone after a while. C. New TMPE service "traffic lights maintenance depot" - fix traffic lights porblems.

Elesbaan70 commented 2 years ago

What about having traffic lights fail without power as the initial, vanilla implementation of this feature, then adding other triggers later? The nice thing about this approach is that it works in vanilla, and the mechanisms are already in the game for this problem to occur and to be resolved.

t1a2l commented 2 years ago

ok lets try it, traffic lights will need electricity to work. (checkbox to enable it ofcourse).

Elesbaan70 commented 2 years ago

I think we're on the right track with this approach, but there are still questions that have to be answered. How is power delivery done? Currently stoplights will work without any intentional delivery of power. Do we require power lines or powered buildings nearby?

Maybe we just assume that the stoplights have power because the roads obviously have power to light the streetlights. But even then, the power failures apply to sections of the city, and power delivery via roads, even for the limited case of stoplights, would have to be accounted for and incorporated into that algorithm.

I have a feeling requiring nearby power lines or powered buildings will end up being the most straightforward solution, but that's a fairly significant change to the gameplay. Of course this will need to be behind a feature toggle that defaults to disabled.

originalfoo commented 2 years ago

If you want to see how the game does electricity coverage, check Quistar's Extended Managers Library (EML) source code as he was working on an 81 Tiles version of it prior to going AWOL. It's not just a simple case of "are there buildings / powerlines nearby" - the game seems to be able to do regional power brownouts if memory serves.

FYI I was thinking of adding a "Traffic Lights" group on the polices tab to group several existing traffic light related mod options so could possibly place new options there too? I've still got a bunch of work queued up regarding mod options (delayed due to illness IRL) that I need to resume at some point.

Elesbaan70 commented 2 years ago

the game seems to be able to do regional power brownouts if memory serves.

The whole point of this approach is for traffic lights to be impacted by those brownouts, by destroyed power lines, etc. That was my point. If we require a power connection for traffic lights as it is required for buildings, we should get that behavior for free if we do it right. If we try to implement this feature without adding the requirement that traffic lights be connected to power like buildings, we would have to figure out how to track when brownouts or power loss occur, and make traffic lights in the vicinity be impacted.

originalfoo commented 2 years ago

Ah, sorry, I misread and thought you were thinking of scanning for nearby buildings and checking their powered status.

Yeah, if we can hook traffic lights in to same stuff the game does with buildings that would be great.

Elesbaan70 commented 2 years ago

Requiring traffic lights to be powered like buildings is weird, though. Would we require those high-voltage power lines to run alongside roads that aren't developed? Is there an existing mod or assets that provide lower-capacity power lines that are smaller and cheaper?

t1a2l commented 2 years ago

Traffic lights can have two main issues:

  1. No lights at all - electricty issue (usually means no electricty in the buildings around).
  2. Yellow blinking light - problem with the light controller, michrochip failure etc.
originalfoo commented 2 years ago

Requiring traffic lights to be powered like buildings is weird, though. Would we require those high-voltage power lines to run alongside roads that aren't developed? Is there an existing mod or assets that provide lower-capacity power lines that are smaller and cheaper?

EML beta (see Update: 23 Jan changelog) mod apparently has some code for powered roads, and there's also Electric Roads mod by Klyte (apparently it causes in-game lag though).

However, that being said, how often are there going to be traffic lights at a junction in an area that's not built up? There are plenty of rural powerline assets, underground electricity, etc., that can be used if necessary. As long as feature is disabled by default it doesn't matter; users who enable the feature are committing to ensuring electricity reaches their traffic lights.

t1a2l commented 2 years ago

maybe we can do lighting strike cause no power.

BuiIdTheBuilder commented 2 years ago

Maybe also integrate this with Real Time mod, so that lights can be turned off at certain times of day, and priority signs used instead? This would greatly reduce delay at many of my intersections. Also I don't think we need a new road maintenance depot for this, the existing one can be used for it.

Elesbaan70 commented 2 years ago

Maybe also integrate this with Real Time mod, so that lights can be turned off at certain times of day, and priority signs used instead?

It's a cool idea, but I think it's a different feature. TMPE's part in this would be an API with (1) a switch another mod can use to globally enable setting up both priority signs and traffic lights on a single intersection, and (2) another switch that such a mod would use to determine which one controls traffic at an intersection. I think Adaptive Networks would also need to change how it does the flags, to avoid showing traffic lights and priority signs on the same intersection.

I suppose a case could be made for fully implementing the feature in TMPE, independently of Real Time. But vanilla and TMPE traffic don't vary enough between day and night for this to really be usable. (Is Real Time compatible with TMPE anyway? I've never used it.)

originalfoo commented 2 years ago

https://github.com/CitiesSkylinesMods/TMPE/issues/980 tracks feature for time-of-day traffic lights