Open kianzarrin opened 4 years ago
I'd love some sort of template system, not just for traffic lights but potentially lots of other stuff too (vehicle restrictions, different roundabout configs, etc).
However, back to traffic lights....
We'd need some sort of template browser, where user can see list of applicable choices for given junction. Hovering or selecting a choice could "animate" through the sequence by highlighting lanes on the map (eg. the lanes would go green, amber or red as the traffic light sequence plays through).
That way user can see what will happen, and once they're happy can apply the template.
I guess point I'm making here is I think we need some overhaul of the traffic lights UI before we can reliably implement a template system. Not to mention, if we improve the general traffic lights UI it will make it much easier for us to test stuff and spot errors (and also for users to report errors with just screenshots of a sequence rather than trying to describe in words).
What do you think?
@aubergine10
Hovering or selecting a choice could "animate" through the sequence
That would be amazing!
we need some overhaul of the traffic lights UI before we can reliably implement a template system
I don't think the overhaul should be blocking the implementation templates specially the back-end functionality of the code. we need to separate the UI from middle layer or lower layer of the code. For now I suggest to put the templates in the "add nodes" panel and once we apply the overhaul thing we can change think of something to do with the UI.
Call me crazy but can we implement machine learning to decide the lane arrows and the timings of each traffic light? lol
Wouldn't that start to be the game playing by itself for that part? For me, it partially would take the fun out of working and tweaking traffic.
Making and saving templates is fine but having the game play by itself is, IMO, not.
@brunoais Well you say that but if the feature is implemented (and that's a big if) then I bet you are going to have a lot of fun playing with it observing how it gradually evolves!
No but seriously i get your point. In my opinion while modifying some traffic lights is fun, some casual users do not fancy putting too many traffic lights.
I bet you are going to have a lot of fun playing with it observing how it gradually evolves!
True but that's not cities skylines
some casual users do not fancy putting too many traffic lights.
Sometimes even, due to the UI. It takes a lot to place traffic lights and some people have trouble mirroring the views for each angle, forcing a lot of camera moving circling....
Sometimes even, due to the UI. It takes a lot to place traffic lights and some people have trouble mirroring the views for each angle, forcing a lot of camera moving circling....
That's my biggest annoyance with the current UI; I have to keep spinning camera to make sure I'm not getting mixed up about which lights are changing color. That could be fixed by highlighting lanes to indicate traffic light color (and then brightening the highlight when mouse moves over the floating traffic lights so I can see clearly which lane will be updated if I change a light).
I don't have that problem, btw... But I see that a lot in youtube videos and in my family.
That could be fixed by highlighting lanes to indicate traffic light color
I like that. Sounds effective enough and easy enough to program.
@kvakvs Was wondering about a way to make this algorithm testable (i.e. separate it from the game engine) and then create a simple unit test? And then you can call the same auto TL engine from the test. Maybe read some text inputs with junction configurations and then check that output TL parameters are what we expect.
I looked at tests and I can't find unit tests for the fundamental functions for timed traffic light or any of the TMPE get/set traffic rule functions. Am I missing something?
Its inappropriate to write test for my quick-setup functionality when there are not unit tests for its fundamentals.
No there aren't (m)any tests, especially for old functionality like traffic lights. What you could test is adding all possible configurations of roads, and checking that they are passable in at least one direction at all traffic light states. No need to deploy actual traffic light, this is about testing your logic which defines an automatic light.
@kvakvs I am not sure If it is even possible to test code in TrafficManager.dll because it uses the UnityEngine and it will throw security exception: https://stackoverflow.com/questions/30737729/c-sharp-security-exception
EDIT: we can tests the parts of code that does not call any unity function. but almost all code need to know left/right hand traffic and cannot be tested. if you are serious about testing then we need to open a new ticket for implementing a testing framework (maybe create impostors for some unity functions?)
related #690
540 provide a quick-setup timed traffic light triggered by ctrl-click.
This issue is continuation of that work. Here are some ideas (These are just some suggestions to think about. not all of them are good ideas):
EDIT: Also write tests for #540 : https://github.com/krzychu124/Cities-Skylines-Traffic-Manager-President-Edition/pull/554#issuecomment-558568104