Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove Crosswalk decals when crosswalk disabled #27

Closed
FireController1847 opened this issue Feb 4, 2019 · 29 comments
Closed

Remove Crosswalk decals when crosswalk disabled #27

FireController1847 opened this issue Feb 4, 2019 · 29 comments
Labels
enhancement Improve existing feature JUNCTION RESTRICTIONS Feature: Junction restrictions low priority Issue with low priority of work question General question

Comments

@FireController1847
Copy link
Collaborator

I know we can disable crosswalks programmatically, but it doesn't remove it from the road junction itself. Is that possible?

Somewhat leaving this for future note, also somewhat leaving this for my own purposes.

@FireController1847 FireController1847 changed the title Feature Request: Disable Crosswalks Ability to Disable Crosswalks on Roads Feb 4, 2019
@krzychu124 krzychu124 added enhancement Improve existing feature question General question low priority Issue with low priority of work labels Feb 4, 2019
@originalfoo
Copy link
Member

The Junction Restrictions allow you to disable individual crossings and junctions, but the stripe decals still remain.

I assume you mean the stripe decals should also disappear?

Those decals are triggered by a flag on the road prefab instance IIRC. So in theory changing that flag should make them disappear?

I've seen mods that remove all the crossing decals, which I assume they just delete them from the prefab definitions or something during game load?

But what would be ideal is to find out what causes the game to toggle the decals on and off at junctions, and modify that so that if Junction Restrictions have disabled a crossing then that individual crossing should have its decal removed.

Note: Traffic lights (especially timed ones) also need to account for the removal of a crossing, as does the pathfinder.

@FireController1847
Copy link
Collaborator Author

Yeah, that's what I meant. The striped decals should disappear.

@krzychu124
Copy link
Member

I am not sure if we can remove them but replacing with transparent blank decal could be easier. I will try to find in code where and how these decals are selected and rendered.

@Sipke82
Copy link

Sipke82 commented Feb 8, 2019

Just plopable asphalt?

@originalfoo
Copy link
Member

Ploppable asphalt needs careful positioning to avoid it overlapping other road parts of the road texture, such as 'stop lines'.

@FireController1847
Copy link
Collaborator Author

FireController1847 commented Feb 14, 2019

Possible addition to the feature, often times in the U.S. people are allowed to cross even without the crosswalk lines being painted on the road. It's be awesome if we could make crosswalk lines optional in its entirety.

@originalfoo
Copy link
Member

originalfoo commented Feb 14, 2019

So the three states would be:

Crosswalk Decal

@originalfoo
Copy link
Member

This mod, although broken, apparently found a way to hide the crosswalk decals at junctions (but not at tunnels): https://steamcommunity.com/sharedfiles/filedetails/?id=1147015481

@originalfoo
Copy link
Member

Boformer has indicated he might have a way to remove the crossing decals per segment. He's working on a new version of Network Skins. IMO we should collaborate as we can already achieve removal of the 'path' part of it but not the visual, and network skins will be the opposite - removing visual but not path.

@originalfoo
Copy link
Member

boformer

@originalfoo
Copy link
Member

From #129:

"Ach hier hast du mich kontaktiert. :-D

Ja, so ein Feature wäre prinzipiell nicht verkehrt. Ich selbst habe mit Texturen noch nicht gearbeitet. Ich kann mir vorstellen, dass es einiges an Arbeit kosten wird, Texturen für sämtliche Straßentypen zu erstellen.

Wenn du abfragen willst, ob Fußgänger an einem Segment/Knoten die Straße überqueren können, kannst du die Methode JunctionRestrictionsManager.Instance().IsPedestrianCrossingAllowed(ushort segmentId, bool startNode) nutzen. segmentId ist die Id des Segments und startNode gibt an, ob du den Fußgängerüberweg am Startknoten (true) oder am Endknoten (false) meinst.

Wie würden die Mods denn miteinander kommunizieren können? Über Reflection oder gibt's da einen eleganteren Weg?"

@FireController1847
Copy link
Collaborator Author

From #129 (translated):

Oh, here you contacted me. :-D

Yes, such a feature would not be wrong in principle. I myself have not worked with textures yet. I imagine it will take a lot of work to create textures for all road types.

If you want to know if pedestrians can cross the road on a segment / node, you can use the JunctionRestrictionsManager.Instance (). IsPedestrianCrossingAllowed (ushort segmentId, bool startNode) method. segmentId is the id of the segment and startNode indicates whether you mean the pedestrian crossing at the start node (true) or at the end node (false).

How would the mods communicate with each other? About Reflection or is there a more elegant way?

@originalfoo originalfoo added the JUNCTION RESTRICTIONS Feature: Junction restrictions label Aug 11, 2019
@originalfoo originalfoo changed the title Ability to Disable Crosswalks on Roads Remove Crosswalk decals when crosswalk disabled Aug 12, 2019
@originalfoo
Copy link
Member

Kian is close to having solution for this: kianzarrin/myrepo#1

@kianzarrin
Copy link
Collaborator

Can we close this. I have posted this mod that fixes this issue:
https://steamcommunity.com/sharedfiles/filedetails/?id=1934023593

@originalfoo
Copy link
Member

originalfoo commented Dec 11, 2019

Once it merges in to NS2.

@originalfoo
Copy link
Member

From my comment in Discord:

It should certainly be in NS2 as lots of TM:PE users, including myself, use NS2. I suspect NS2 could also elaborate on the functionality, eg. allowing any or all crossings to be hidden purely for aesthetic purposes (eg. the actual crossing remains as far as pathfinder is concerned, but the visual element is removed).

However, I'd like to see the basic functionality in TM:PE also as it should hide disabled (via Junction Restrictions tool) crossings regardless of whether NS2 is active or not. The TM:PE version of it would deactivate if any version of Network Skins (1 or 2) or is active, or any mod conflict (patch collision) detected.

@originalfoo
Copy link
Member

originalfoo commented Dec 11, 2019

Kian: We can merge this into TMPE later. Although I do not think its a good idea since TMPE is not supposed to deal with textures. Also might create incompatibility issues with other mods.

While not the primary goal of TM:PE, it's been long-standing feature request (eg: VictorPhilipp/Cities-Skylines-Traffic-Manager-President-Edition#16) from users and it's regularly been mentioned in various suggestion/improvement threads over the years, so there is user expectation that when crossing is disabled in TM:PE the visual stuff on the road should update.

There's a similar trend with speed limit sign props - where users have asked if we can make those reflect the speed set by TM:PE speed limit tool. (see: #49, #124 for some recent discussion on that).

Also, we already alter lane arrows when TM:PE changes lane routing at junctions, so there is some precedent of us altering or affecting the visible stuff on the map.

@kianzarrin
Copy link
Collaborator

@aubergine10
what are you going to do about compatibility issues with NS2? maybe we an say if NS2 is loaded then do not patch NetNode.RenderInstance()?

PS:I talked to NS2 last night and he said he likes to merge my mod as it is into his mod (it will use harmony though). And he has future plans to create user UI that generates Network skins without crosswalks.

@originalfoo
Copy link
Member

what are you going to do about compatibility issues with NS2? maybe we an say if NS2 is loaded then do not patch NetNode.RenderInstance()?

Yes, precisely that.

We check to see if any NS mod (v1 or 2, assuming they both update the NetNode.RenderInstance()) is enabled, and if so we don't apply our patch and NS2 does the work.

cc: @boformer

@originalfoo
Copy link
Member

The only possible issue I foresee is if users start getting confused that hiding crosswalk in NS2 doesn't 'disable' the actual pedestrian crossing.

@kianzarrin
Copy link
Collaborator

@aubergine10 @boformer How should we have both NS2 and TMPE to remove crossings without having too much duplicate code?
This will be more important in future as I suspect both TMPE and NS2 would like to do more road texturing. TMPE for one is developing a taste for it! I can feel it! see #557

@Sipke82
Copy link

Sipke82 commented Dec 12, 2019

In my opinion texture changes caused by TMPE adaptions, should be performed by TMPE.

@kianzarrin
Copy link
Collaborator

@Sipke82
That is easier said than done because there are compatibility issues. So for example NS2 might want to use rainbow crosswalks (presumably by hiding original crosswalks and adding rainbow prop). while TMPE might want to hide crosswalks. They both need to patch the same line of NetNode.RenderInstance().

@originalfoo
Copy link
Member

A shared git module perhaps?

@krzychu124
Copy link
Member

There are few cases to cover. The best option would be to separate responsibility (TMPE - manages paths, NS2 - manages textures). Use observer pattern or similar to notify about changes.

  1. new game, both mods installed - both mods are connected via simple observer API, any change in one mod is propagated to the other, works in both directions + additional configuration (update paths when crosswalk is shown/hidden using NS2 or TMPE disabling/enabling pedestrian crossing should update textures - managed by NS2)
  2. NS2 not installed (TMPE manages textures by itself) - easiest case, I think

Synchronization problems to solve. I think that will be the hardest part.

  1. NS2 installed at later date - what to do with hidden crosswalks? Should we move settings from TMPE to NS2 or not? If yes, how?
  2. NS2 installed before TMPE - similar to previous case - what to do with hidden crosswalks, Should we move settings from NS2 to TMPE or not? If yes, how?

@originalfoo
Copy link
Member

originalfoo commented Dec 12, 2019

If both mods have it there's also the issue of duplicate data in the save (NS2 saving that it's hidden the crossing lines, TM:PE saving that the actual crossing path is disabled).

There's also the issue that a user hiding crossing lines in NS2 might not want the actual crossing path removed (example: #27 (comment)).

My suggestion would be:

  • Disabling path in TM:PE always makes NS2 hide the crossing lines
  • Hiding crossing lines in NS2 does not by default disable the crossing path in TM:PE (a mod option in NS2 could override that behaviour)

@FireController1847
Copy link
Collaborator Author

I think @krzychu124 has the best solution: if both mods are installed, then NS2 can handle it, but if not, TM:PE should handle it. It'd make no sense to make the mod an external dependency. If people don't want it installed, then why should TM:PE miss a feature because of it, you know?

I think to solve the synchronization, you should try your best to work with their team to get the mods to work together. If TM:PE is installed first, then it should move them to NS2 as NS2 has a more fleshed out implementation. TM:PE's should be a "backup" per-say.

@originalfoo
Copy link
Member

Kian's crosswalk decal hiding mods which might get merged in to TMPE once we move to Harmony 2 properly:

Will keep this #27 open until integration.

@krzychu124
Copy link
Member

Hide crosswalks mod will probably be a part of AR(Advanced Roads) mod. Closing for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Improve existing feature JUNCTION RESTRICTIONS Feature: Junction restrictions low priority Issue with low priority of work question General question
Projects
None yet
Development

No branches or pull requests

5 participants