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

V11 - Could not load type 'TrafficManager.Traffic.Data.VehicleState' from assembly 'TrafficManager` #649

Closed
SevenQM opened this issue Feb 4, 2020 · 25 comments · Fixed by #684
Labels
awaiting feedback More information required EXTERNAL Mod conflict or other external factor out of scope Not applicable to TM:PE or should be separate mod
Milestone

Comments

@SevenQM
Copy link

SevenQM commented Feb 4, 2020

Solution

Unsubscribe / remove the following mods:

  • CSUR_TMPE_Laneconnector_Fix
  • Advanced Junction Rule

Describe the problem

After the V11 update, I entered the game as before, and an error message popped up。
Could not load type 'TrafficManager.Traffic.Data.VehicleState' from assembly 'TrafficManager, Version=1.0.7026.40416, Culture=neutral, PublicKeyToken=null'. [System.TypeLoadException]

Details:
No details

I subscribed to the V11LABS version. No other subscriptions. There is no problem returning 10.20. Find solution: subscribe to V11 and subscribe to 10.20, the problem will only disappear when V11 is enabled

Steps to reproduce

  1. This error is caused by V11 update, no other modules are added

Log files

Savegame?

https://steamcommunity.com/sharedfiles/filedetails/?id=1988175689

Screenshots?

Notes or questions?

TMPE.log
output_log.txt

@SevenQM SevenQM added BUG Defect detected triage Awaiting issue categorisation labels Feb 4, 2020
@krzychu124
Copy link
Member

@SevenQM as I explained in comments on workshop item , it's the other mod which is dependent on TM:PE.

I suspect it's CSUR_TMPE_Laneconnector_Fix (it's obsolete, according to github page) or more likely Advanced Junction Rule Disable both for now if you want to use v11 version and just wait for update.
We can do nothing from our side.

Tagging @pcfantasy

@krzychu124 krzychu124 added out of scope Not applicable to TM:PE or should be separate mod awaiting feedback More information required and removed BUG Defect detected triage Awaiting issue categorisation labels Feb 4, 2020
@pcfantasy
Copy link
Contributor

@SevenQM

Both CSUR_TMPE_Laneconnector_Fix and Advanced Junction Rule is obsolete.

CSUR_TMPE_Laneconnector_Fix is never published and it is for CSUR beta3. please use CSUR ToolBox in steam.

Advanced Junction Rule is removed from steam. Please delete it.

@originalfoo originalfoo changed the title V11 V11 - Could not load type 'TrafficManager.Traffic.Data.VehicleState' from assembly 'TrafficManager` Feb 4, 2020
@originalfoo originalfoo added the EXTERNAL Mod conflict or other external factor label Feb 4, 2020
@originalfoo
Copy link
Member

@pcfantasy Can we incorporate that code (now in the CSUR ToolBox) direct in to TMPE? I assume it's to deal with lane connector issues on nodeless junctions? We have same issue for RWY (Railway) nodeless tracks and a few other networks too...

@pcfantasy
Copy link
Contributor

pcfantasy commented Feb 4, 2020

@aubergine10

Yes, in CheckSegmentsTurningAngle, TMPE will check

if (turningAngle < 1f)
{
// balabala...........................
float dirDotProd = sourceDirection.x * targetDirection.x + sourceDirection.z * targetDirection.z;
return dirDotProd < turningAngle;
}

if turningAngle < 1f and dirDotProd > turningAngle; then return false to prevent some lane connectors.

Sometimes for some reasons, asset owner will create some roads which turningAngle is not 1f. So I just return true for all CSUR roads to allow all lane connectors.

@originalfoo originalfoo pinned this issue Feb 4, 2020
@pcfantasy
Copy link
Contributor

@aubergine10

Add codes
https://github.com/citiesskylines-csur/CSURToolBox/blob/master/CustomAI/NewLaneConnectorTool.cs

@originalfoo
Copy link
Member

originalfoo commented Feb 4, 2020

@kianzarrin Could you incorporate that in to the stuff you're doing with lane connectors?

@kianzarrin
Copy link
Collaborator

@aubergine10 That review is already getting too big and out of hand.
I added fix for lane curves on the top of the ModeLaneMarker and SegmentLaneMarker stuff.

why not to do this in a separate pull request. It is not conflicting with my code.

@kianzarrin
Copy link
Collaborator

kianzarrin commented Feb 8, 2020

I am on this. I will also fix CSUR toolbox.

EDIT: WAIT IF CSUR wants to be compatible with previous TMPE versions it should check version string right? what version should it check?
tagging @aubergine10

@kianzarrin
Copy link
Collaborator

kianzarrin commented Feb 8, 2020

Actually Ill just check for existence of :
public static bool IsCSUR(NetInfo asset)
using reflection or something.

PS: who ever wrote this code has a really wide screan!

                    Loader.Detours.Add(new Loader.Detour(Assembly.Load("TrafficManager").GetType("TrafficManager.UI.SubTools.LaneConnectorTool").GetMethod("CheckSegmentsTurningAngle", BindingFlags.NonPublic | BindingFlags.Instance, null, new Type[] { typeof(ushort), typeof(NetSegment).MakeByRefType(), typeof(bool), typeof(ushort), typeof(NetSegment).MakeByRefType(), typeof(bool) }, null),
                                           typeof(NewLaneConnectorTool).GetMethod("CheckSegmentsTurningAngle", BindingFlags.NonPublic | BindingFlags.Instance, null, new Type[] { typeof(ushort), typeof(NetSegment).MakeByRefType(), typeof(bool), typeof(ushort), typeof(NetSegment).MakeByRefType(), typeof(bool) }, null)));

@pcfantasy
Copy link
Contributor

@kianzarrin

I suggest to return true for all roads.

Why do we need to check turningAngle to allow lane connector for road, only railway need this I think,

@kianzarrin
Copy link
Collaborator

@pcfantasy Sometimes for some reasons, asset owner will create some roads which turningAngle is not 1f. So I just return true for all CSUR roads to allow all lane connectors.

Can you please give me an example outside of CSUR?

@pcfantasy
Copy link
Contributor

@victoriacity

Can you help explain something about turningAngle?

@victoriacity
Copy link

maxTurningAngle < 90 degrees is necessary for implementing continuous median toggled by traffic lights. For example, when traffic lights are turned off for a T-junction of CSUR roads, the median and markings on the straight road is not broken so that one does not have to plop medians and markings manually to achieve such effect as in vanilla roads.

Specifically, the continuous median is a direct connect node triggered by a connect group (e.g., WideTram and NarrowTram), and most CSUR roads have connect group originally designed for trains and at-grade tram intersections. This leads to the need of setting an acute maxTurningAngle for continuous medians, because the maxTurningAngle is the maximum angle by which the game tries to create direct connect nodes.

Screenshot 251

In vanilla roads, the maxTurningAngle is 90°. This allows for making rail transit networks above or on the road turn at an intersection. In the screenshot above the turning angle of monorail is exactly 90° in the left and slightly larger than 90° in the right. Because the maxTurningAngle is 90°, the monorail is connected through a direct connect road only in the left.

Screenshot 250

Therefore, if the maxTurningAngle=90 is used for continuous median (right road in the above screenshot), one obtains a similar effect as is expected for a monorail/tram intersection. However, in this case the desired effect is the median of the branched road comes to an end right before the intersection (left road in the above screenshot), and this has to be achieved by setting maxTurningAngle < 90. In CSUR roads, we set maxTurningAngle=75 (maxTurningAngleCos=0.2588) to allow for some flexibility in the intersection angle.

Outside of CSUR, the earliest road assets implementing continuous median also have maxTurningAngle < 90, for example:
https://steamcommunity.com/sharedfiles/filedetails/?id=1300747514
https://steamcommunity.com/sharedfiles/filedetails/?id=1327917624
https://steamcommunity.com/sharedfiles/filedetails/?id=1319965985

@kianzarrin
Copy link
Collaborator

kianzarrin commented Feb 9, 2020

In the situation bellow its possible to select the monorail lanemarker even though it does not go anywhere. (EDIT: original TMPE code)

Screenshot (434)

Screenshot (433)

@kianzarrin
Copy link
Collaborator

OK I fixed the issue of the max turning angle. it only applies to tracks now:
Screenshot (435)
Screenshot (437)

@kianzarrin
Copy link
Collaborator

To solve #649 (comment) I made exception for unconnected tracks:
Screenshot (439)
Screenshot (440)

@kianzarrin
Copy link
Collaborator

kianzarrin commented Feb 9, 2020

The TMPE side is fixed(shortly will put a pull request)
the CSUR should not patch TMPE if the fix is present. One way to do this is to check for TMPE version:

TrafficManagerMod::public const string VERSION = "11.0";

Can I rely on this to be VERSION >= 11.1
EDIT: I am not intending to do string comparison. i will convert it to number first.

@pcfantasy
Copy link
Contributor

@kianzarrin

OK,I will update this too.

@originalfoo
Copy link
Member

originalfoo commented Feb 9, 2020

I think the VERSION needs to be string due to CO API (IUserMod) - could be wrong, been ages since I checked. And we often have versions with -beta1 etc in them.

We could add a separate property to the TrafficManagerMod with some sort of numeric version number?

@originalfoo
Copy link
Member

Just realised VERSION isn't part of IUserMod so we can change it to any format we want

@kianzarrin Change it to number but provide some way to include string bolt ons in the stuff that gets shown to user (eg. 11.1-beta1 or 11.0-hotfix)

@kianzarrin
Copy link
Collaborator

@aubergine10

Just realised VERSION isn't part of IUserMod so we can change it to any format we want
@kianzarrin Change it to number but provide some way to include string bolt ons in the stuff that gets shown to user (eg. 11.1-beta1 or 11.0-hotfix)

I prefer to use Version class.

// usage example
new Version(11.1,blah,blah)
version.ToString(2) //major and minor only
version1 > version2 // it has internal comparison

And I will get Version from AssemblyInfo.cs:

       public static string VersionString => ModVersion.ToString(2);
       public static Version ModVersion => typeof(TrafficManagerMod).Assembly.GetName().Version;

Hopefully no one has used TrafficManagerMod::VERSION externally.

@kianzarrin
Copy link
Collaborator

kianzarrin commented Feb 10, 2020

I fixed this issue: The images bellow are produced while CSUR did not patch TMPE.
Screenshot (445)

Screenshot (444)

also the log includes:

No need to defer LaneConnectorTool::CheckSegmentsTurningAngle calls

which means new version of TMPE was detected and was not patched.

@kianzarrin
Copy link
Collaborator

detecting median is not part of this issue but rather its part of #243
Screenshot (448)

@originalfoo
Copy link
Member

A beta is being pushed to LABS page that does not yet contian CSUR fix. The beta will be versioned 11.1.0 (note: build value)

The CSUR update will be in next beta, version 11.1.1. For more details see #687

@originalfoo
Copy link
Member

@SevenQM Please let us know if the issue is fixed or not.

kianzarrin added a commit that referenced this issue Feb 16, 2020
Changed version to 11.1.1 (for access by CSUR)
changed lane connection logic to always allow road connections (#293) but not on tracks disconnected due to max turn angle (#649)
@originalfoo originalfoo unpinned this issue Feb 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting feedback More information required EXTERNAL Mod conflict or other external factor out of scope Not applicable to TM:PE or should be separate mod
Projects
None yet
6 participants