Giter Site home page Giter Site logo

hidecrosswalks's People

Contributors

kianzarrin avatar originalfoo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

hidecrosswalks's Issues

Possible Compatibly issue with "Garbage bin collector" mod

Could this be cause by your update? I have nothing new -only your mod is updated...
@thebugfixnet

Seems to collide with Garbage Bin Controller https://steamcommunity.com/sharedfiles/filedetails/?id=1386697922 ???
A Mod caused an error [System.Exception] Details: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.ArgumentException: No target method specified for class VanillaGarbageBinBlocker.PropManagerDataPatch (declaringType=, methodName =AfterDeserialize, methodType=, argumentTypes=NULL) at Harmony.PatchProcessor.PrepareType () [0x00000] in :0 at Harmony.PatchProcessor..ctor (Harmony.HarmonyInstance instance, System.Type type, Harmony.HarmonyMethod attributes) [0x00000] in :0 at Harmony.HarmonyInstance.b__6_0 (System.Type type) [0x00000] in :0 at Harmony.CollectionExtensions.Do[Type] (IEnumerable1 sequence, System.Action1 action) [0x00000] in :0 at Harmony.HarmonyInstance.PatchAll (System.Reflection.Assembly assembly) [0x00000] in :0 at VanillaGarbageBinBlocker.UserMod.OnEnabled () [0x00000] in :0 at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (object,object[],System.Exception

@kianzarrin

enabling and disabling mods does not always work due to an internal bug in the game resulting in "zombie" mods. You need to restart CS particularly if you migrate between different mod versions.

@thebugfixnet

I not only disabled the mod - i even uninstalled him and restarted several times to test...not your - https://steamcommunity.com/sharedfiles/filedetails/?id=1386697922 ... one this is uninstalled, everythink works again. Interesing: this error apeared already in april in combination of NS2 and Garbage Bin Controller. Look at https://community.simtropolis.com/forums/topic/758072-network-skins-2/?page=2 for VanillaGarbageBinBlocker.PropManagerDataPatch
I have a huge list of mods active and up to today they all worked flawless together.
The error appear on starting the game - so before loading a save.
As soon as i have your Mod + Garbage Bin Controller active this error appears... unsubbed from Garbage Bin Controller is the short term solution... as it is not really horrible to have the C:S Trashcans in Town...
Tomorrow I'll have a further look...

So.... I started now several time new with sub- unsub.... where able to reproduce it - BUT: I needed to delete some Garbage Bin Controller files manually from the C:S folders. At unsub three files stayed there... don't know why... So it works now....
And regarding to my used mods...as I said: a long list - so a real stress test for new mods :D
81 Tiles (Fixed for 1.2+) [DEACTIVATED atm]
Adaptive Prop Visibility Distance
Adjust Pathfinding [BETA]
Advanced Stop Selection (ex MTSE)
Advanced Vehicle Options AVO (Industries DLC ready)
Airport Roads
Any Road Outside Connections
Better Bulldozer [Park Life Compatible]
Building Anarchy
Building Themes
Bulldoze It!
Campus Parks
Crossings
Custom Namelists
Customize It Extended
Daylight Classic
Decal Prop Fix
Detail
Disable Zone Check
Electric Roads Mod 1.2.3
Elektrix's Road Tools 2.0
Elevated Stops Enabler
Emergency Light Changer
Employ Overeducated Workers V2 (1.11+)
Empty It!
Environment Changer (+ Improved Theme Selection )
Extended Game Options
Extra Landscaping Tools
Find It!
Fine Road Anarchy 2
Fine Road Tool 2
Force Level Up
Garbage Bin Controller
Hide It!
Hide TMPE Crosswalks V2.2 [ALPHA]
Improved Public Transport 2
Land Ships
Less Steam
Loading Screen Mod [Test]
More Advanced District Snapping
Move It!
Network Extensions 2
Network Skins 2 (Beta)
Network Tiling
No Abandonment
No Tree Brush Slope Limit
Not So Unique Buildings
Optimised Outside Connections
Parkify
Pause on load
Plop the Growables
Ploppable Asphalt +
Precision Engineering
Prefab Hook (Mod Dependency)
Prop & Tree Anarchy
Prop Line Tool [PLT] (vAlpha)
Prop Precision
Prop Snapping
Prop it Up! 1.4.4
Quay Anarchy
Realistic Population and Consumption Mod v8.4.0
Realistic Walking Speed
Roundabout Builder
Service Vehicle Selector 2
Set your own Start Money amount
Sharp Textures
Ship Converter
Ship Path Anarchy
Smart Intersection Builder
Sort Mod Settings
Spawn Points Fix
Spawn/Unspawn Positions Swapper
Sub-Buildings Tabs
Surface Painter
TM:PE 11.0 ALPHA
Theme Decals
Theme Mixer 2 [DEACTIVATED atm]
Ticket Price Customizer
Toggle It!
TotalyFree Camera
Touch This! Tool 3
Tram Station Track
Transparency LODs Fix
Transparent Selectors
Tree LOD Fix
Tree Movement Control
Ultimate Level Of Detail (ULOD)
Unlimited Outside Connections (Beta)
WaterPipeUpgrader v2 PARKLIFE READY
Zoning toolset (toggle + upgrade tool)
Zoom It!

Detect inverted Asym. Rd. textures

###Intro:
I am trying to blend in the segment textures into node textures to create smooth junctions for custom roads. For asymmetrical roads there is an extra challenge to know which end of the segment the node texture is attached to (it makes sense if it is the large end but its better not to assume anything). To simplify the code and to boost memory and performance I decided to cut the texture in half and the second half of the texture is the mirror of the first half.

###Problem
I assumed that the segment texture will have the larger part of the road on the left but I was mistaken. Network extension 2 has some weird textures:

  • AsymAvenueL2R4: "6-Lane Asymmetrical Road: (2+4)" : texture is not inverted
  • AsymAvenueL2R3: "Five-Lane Asymmetrical Road: (2+3)" : texture is inverted
    texture name = "Ground_Segment_Inverted__AlphaMap ":
    segment-original_APRMap

Need

I need to find a way to understand if the texture is inverted so that I can change my processing.
Currently I just look for the name "inverted" in the texture name to understand. But I need a more future proof approach to understand when a texture is inverted.

Action

To distinguish inverted VS non-inverted texture I tried to compare AsymAvenueL2R4 to AsymAvenueL2R3 because they are very similar but the texture is inverted in one but not the other.

  • I went through fields in asset editor but I did not find anything helpful.
  • I went through the fields in modtools and compared the prefabs, required/forbidden flags, materials,, materials, textures but I did not manage to find anything helpful.
  • I read the Network extension source code (with diff tool) for these two roads but did not find anything helpful

This is the part of code that loads the inverted texture:

if (invertMe || info.m_segments[i].m_mesh.name == "Bus") 
inverted = "_Inverted"; ```
but this does not explain how CS understands the texture is inverted (I doubt that it is by name).

### Plan
- one more thing I have not check is the mesh uv. I do not know how to do that yet but maybe it helps.

some roads have bad textures

Fix in V3.0:

  • 6 lane 2+4 Asymmetrical road has black marking in tunnel piece
  • both tram track tunnel piece
  • reproduce game crash : can't reproduce
  • Small 4 lane mod industrial road still has crossing remain in tunnel piece: Ill add a hard-coded exception. but roads without pedestrian lanes are not supposed to have zebra crossings.

Won't fix:

  • Special toll roads still have crossing:toll roads are not supported. Is there any reason why I should support them? They are weird and hard to support.
  • Small 2 lane industrial road ground level looks like it's missing texture: its not my fault. those corrupt textures are there even without my mod (partially covered by the zebra crossing).

why some nodes have same textures as segment?

In the picture bellow you can see a road from Next2 that does not have zebra crossings texture. In my hide crossings mod I : EDIT 1- clone the material 2- get defuse texture from node material (NetInfo.Node[0].m_nodeMaterial.GetTexture(ID_DEFUSE)). 4- do some processing (lets say I flip the texture). 5- set the processed texture as defuse texture of the node material.
And as you can see int he picture bellow it draws a weird junction texture:
Screenshot (785)

This is the defuse texture of m_nodeMaterial from mod tools:
Screenshot (786)

Why does it look exactly like the segment texture? in fact the are identical. So I decided to exclude the situation when node texture is equal to the segment texture in the code bellow. This solved the problem (more like a hack arround):

public static bool HasSameNodeAndSegmentTextures(NetInfo info, Material nodeMaterial, int texID) {
    foreach (var seg in info.m_segments) {
        Texture t1 = nodeMaterial.GetTexture(texID);
        Texture t2 = seg.m_segmentMaterial.GetTexture(texID);
        if (t1 == t2)
            return true;
    }
    return false;
}

So
1- is the original m_nodeMaterial is not being rendered but when I change its defuse texture then it gets rendered?
2- why does it have such a weird node texture in the first place?


So far so good. but now users are complaining why my mod does not hide the crosswalks from THIS ROAD:
255710_screenshots_20200405171730_1

The node texture is the same as one of the segment textures:
Screenshot (784)

Although the node texture is identical to one of the segment textures, this time the node texture IS rendered ( I don't understand why). But because my hide crossings mod will not hide the crossing because the node texture is identical to one of the segment textures.

I need to know when the node texture is rendered and when it is not so that I know when to exempt it from my hide crossing mod and when not to. The condition node[i].m_nodeMaterial.GetTexture(texID) == segment[i].m_segmentMaterial.GetTexture(texID); is not a good condition. So what should I look for?

EDIT:
while we are at it what is the difference between NetNode.Node.m_nodeMaterial and NetNode.Node.m_material ?

crashes because incompatible mod patches NetNode.RenderInstance

@RaeTheGit 4 hours ago
Of course. Murphy's Law kicked in and I couldn't "deliberately" get the game to actually crash with both mods activated, but I managed to get a log of Hide Crossings disabled, where everything runs smooth (but doesn't look as good/desired) and one with Hide Crossings enabled, where unpausing after load changes the button but the simulation doesn't start running. Also, most UI stuff didn't work like changing lane arrows in TMPE or bulldozing anything.
Log w/out Hide Crossings [ufile.io]
Log with Hide Crossings [ufile.io]
raethegit 5 hours ago
So, for now i deduce this said incompatibility exists and seems to be only triggered by certain circumstances like either OS, installed assets, mods, or even the hardware, or any combination of that... which will probably and hopefully be revealed by the output log.
raethegit 5 hours ago
@albeo I don't have Bonjour on my Linux machine
I never got any indications that Hide Crosswalks or Remove Need For Pipes was actually in any way related to those crashes, they both work(ed) just fine and as expected. I just very frequently got those ominous crashes to desktop right after loading or unpausing a game so I did some random search on the workshop to see if there might be known issues for some of the installed mods, assets, etc, and that is when I came across Duplicate Assembly Scanner which described the exact behaviour and the possible reason for that.
For verification, I have now temporarily unsubscribed from Hide Crosswalks, as it is "only" for cosmetics and doesn't influence functionality. Now the game runs much more stable and is way more responsive additionally to being playable much faster after loading. To not distort the result I deliberately changed nothing else than unsubscribing from HC.
I'll try to resubscribe so I can get a fresh output log later.
aubergine18 6 hours ago
@RaeTheGit Share your output_log.txt so we can see what actual error is.
Albreo 7 hours ago
@LemonsterOG I second this.
@RaeTheGit Try to get rid of Bonjour if you have one on your computer. I'm trying to confirm if it's related to my crash.
LemonsterOG 8 hours ago
@RaeTheGit -- I use both this mod and Remove Need for Pipes without issue. You must have some other mod(s) conflicting.
raethegit 8 hours ago
I have experienced "instant crashes" a lot lately and just now found the Duplicate Assembly Scanner in the workshop, so i gave it a shot. Turns out this mod and Remove Need For Pipes are conflicting as they use the same method from different Harmony versions (yours v2.0.0, Remove Need For Pipes v1.2.0) which is said to be a very probable cause of those crashes.
Just wanted to give a heads up on this as both mods add a lot of value to gameplay for me, and did the same over at the Remove Need For Pipes mod.
Still want to leave a big thanks for your work! :)
player-1.log
player-2.log

System.TypeLoadException: Could not load type 'NetworkSkins.Skins.NetworkSkin'

Discovered this while wading through world's biggest error log: https://steamcommunity.com/app/255710/discussions/0/1750148101145257091/

The class NetworkSkins.Skins.NetworkSkin could not be loaded, used in NetworkSkins, Version=1.0.7319.2601, Culture=neutral, PublicKeyToken=null
The class NetworkSkins.Skins.NetworkSkin could not be loaded, used in NetworkSkins, Version=1.0.7319.2601, Culture=neutral, PublicKeyToken=null
System.TypeLoadException: Could not load type 'NetworkSkins.Skins.NetworkSkin' from assembly 'NetworkSkins, Version=1.0.7319.2601, Culture=neutral, PublicKeyToken=null'.
  at HideTMPECrosswalks.Utils.NS2Utils._HideJunction (UInt16 segmentID) [0x00000] in <filename unknown>:0 
  at HideTMPECrosswalks.Utils.NS2Utils.HideJunction (UInt16 segmentID) [0x00000] in <filename unknown>:0 
  at HideTMPECrosswalks.Utils.NS2Utils._HideJunction (UInt16 segmentID) [0x00000] in <filename unknown>:0 
  at HideTMPECrosswalks.Utils.NS2Utils.HideJunction (UInt16 segmentID) [0x00000] in <filename unknown>:0 

No idea what caused it, but user has a massive number of broken assets/mods so could be side effect of that.

Fix road/node texture mismatch on "plain" roads

In the picture bellow 4L road has smooth segment to junction transition but there is a APR texture missmatch for the 6L road.
Screenshot (1)

After doing a few experiments it appears that only plain roads(no aymmetry/decoration/medians) have this problem.

sometimes CS stretches node texture WRT the segment texture before rendering them. In such circumstances blending in the segment texture to node texture can result into texture mismatch.

// Simplified blending code
float weight= i/length; 
node_color[i] = node_color[i]*weight+segment_color[i]*(1-weight);

So far I look for grass/trees in the name of the road to determine if it has decoration and look for a lane with laneType == None to find medians. If so I shrink segment textures by 91%.

Problem

I do not know what exactly to look for (is there a field or a flag I need to check) to distinguish such roads from one another and I do not know how much is the scaling factor.

  • I do not know if the shrinking factor is always a constant 91%.
  • My criteria of searching the road name to determine decoration is hackish and not future proof.
  • Is it really the roads without median/decoration that have texture mismatch?

###Need

  • better criterion for determining road decoration (info.GetDecorationArea() does not work - maybe calculate integral of yellow color in the segment texture?).
  • my criteria of looking for decorations/median seems hackish and not future proof. I need to know what part of code is responsible for this texture mismatch and replicate that code or myself.

Further notes

In the images bellow I put the segment texture underthe generated (by blending) node APR texture for 4L and 6L road:

Screenshot (246) - Copy

node melt_APRMap

related:
#1 (comment)

Crosswalks do not hide on Industrial Highway

Using an Industrial Highway and any other cross-street, the crosswalks will appropriately disappear on the cross-street when toggled but do not disappear on the Industrial Highway when toggled.
Cities: Skylines_2023 06 22_09 57 25

Texture replacement bug

Hi !
I have some problem with all basic roads only, when I remove the crosswalk it's appear like below:
crosswalk
Any idea ?
P.S. I have the mass transit DLC

Benchmarking/performance thread

Ideas to improve FPS

Ideas to improve one-time processing speed.

  • parallel processing of colors[][]
  • find a way to compress textures outside of main thread. (maybe perform compression manually and then give the compressed data to texture?)

Benchmarking

Error in output log

HideTMPECrosswalks patches Reverted.

(Filename: C:/buildslave/unity/build/artifacts/generated/common/runtime/DebugBindings.gen.cpp Line: 51)

NullReferenceException
at (wrapper managed-to-native) UnityEngine.Component:get_transform ()
at BuildingThemes.BuildingVariationManager.Reset () [0x00000] in :0
at BuildingThemes.LoadingExtension.OnReleased () [0x00000] in :0
at LoadingWrapper.OnLoadingExtensionsReleased () [0x00000] in :0
UnityEngine.DebugLogHandler:Internal_LogException(Exception, Object)
UnityEngine.DebugLogHandler:LogException(Exception, Object)
UnityEngine.Logger:LogException(Exception, Object)
UnityEngine.Debug:LogException(Exception)
LoadingWrapper:OnLoadingExtensionsReleased()
LoadingWrapper:Release()
LoadingManager:ReleaseRelay()
LoadingManager:OnDestroy()

tasks

Moving boformer/NetworkSkins#42 to here because it does not sound like I am merging this with NS2 in the next version. and even if I do it may be a submodule.

In this task I hide tmpe cross walks
here I continue to version 2 of the operation to make further improvements.

Version 2.0 released:

  • use harmony
  • merge with ns2 Check compatibility with NS2
  • investigate cropped textures.
  • have road specific modification of crosswalks (eg small roads, highways, etc)
  • test custom on segments mentioned by users.
  • Hide crosswalks on level crossings.

Version 2.5 released:

  • when loading the game cache clear textures for all junctions with crossing ban. Currently when the
    game is loaded the user will have a hard time to move the camera around until the textures are cached.
  • mix segment ARPMap texture with node texture for smooth transition.
  • increase the performance of texture processing.
  • Cache used textures upfront
  • fix Real time compatibility
  • E/B/T support.
  • investigate caching of textures.
  • create texture dumps in debug mode.
  • benchmark/fix cache (array VS hashtable) EDIT: this won't apply to version 3
  • support asym road.
  • fix scale mismatch for 6L road. #2
  • more fine tuning for smoother textures. (some of the Next2 roads)

Version 3.0:

  • Polish code
  • fix hot reload
  • Ensure texture cache hit
  • use CSUtilsCommons for logging.
  • wrap NetInfo
  • Option to exclude prefabs.
  • hard coded exclusion list.
  • Fix outstanding issues #6 #8
  • publish as experimental
  • publish as stable one week later
  • TMPE to require this mod.

Version 3.*

  • allow builtin prepared textures.
  • allow asset creators to add their textures.
  • allow users to add their own textures to my mod.
  • allow parallel processing of colors.
  • update should hide markings when segment/node flags are updated.

Version 4:

  • read about LODs: https://steamcommunity.com/workshop/filedetails/discussion/667342976/1636416951459546732/
  • hide crosswalks when camera is very far away. (LODs)
  • Update textures periodically
  • Patch TMPE to post update textures (harmony)
  • better scale detection algorithm.
  • better asym invert detection algorithm
  • provide options for list of roads to never/always hide crossings. (requires optimizations)
  • reset cache when game resolution changes.
  • perform real-time texture processing in a separate thread.
  • investigate texture replacements with median color.

Debug tools:

  • process texture outside of CS and then use Texture swap mod. This is to quickly review the results of texture swapping.
  • use in game debug UI to fine tune textures.

related:
CitiesSkylinesMods/TMPE#27
CitiesSkylinesMods/TMPE#27 (comment)
CitiesSkylinesMods/TMPE#40

No scrolling in exceptions list

Not sure if you would rather have this in the workshop comments. Anyway...

I have quite a lot of roads installed on the workshop. The effect of this is that I cannot make exceptions for some roads. The list does not have a scrollbar for this. Maybe a scrollbar could be added, or the type of form could be changed alltogether.

Thanks for an amazing mod.

  • Liam

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.