CitiesSkylinesMods / TMPE

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

Events / Signals #426

Open originalfoo opened 5 years ago

originalfoo commented 5 years ago

Steam user suggested this:

I think it would be great to have an event detector on timed traffic lights. For example on an intersection with a low-usage tram line: the intersection works like there was no tram line, but when a tram shows up, traffic lights change to a certain defined state (and pauses the loop, or even just background it), then switches back to the loop.

So event can, in this case, switch between traffic light programmes.

There could be various triggers (if we can find really fast no-performance-impact way to do this sort of stuff) for example:

Events could affect any of the features - junction restrictions / priority signs / traffic lights / etc.

Just the time-based event alone could facilitate most if not all the stuff in https://github.com/krzychu124/Cities-Skylines-Traffic-Manager-President-Edition/milestone/11

krzychu124 commented 5 years ago

I love that, and I think that good starting point would be to check how CO made a level crossings (auto-close on approaching train)

originalfoo commented 5 years ago

If events were chained it could perhaps facilitate #11

kvakvs commented 5 years ago

Step 1. Design a thread-safe super cheap message/event passing mechanism Step 2. Ensure that if event/message was not processed, it would not fill up the mailbox in the receiver, maybe allow one event of a kind, and maybe some time-to-live when it becomes obsolete. Step 3. Process in the AI step or something like that, when possible but not instantly. Step 4. Send messages and enjoy crossings knowing the car situation.

originalfoo commented 4 years ago

Just saw this posted on Reddit, which would be perfect example of where event/signal system could be useful:

image