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

Fix: game version 1.10.1-f2 breaks PT #189

Closed
wants to merge 1 commit into from

Conversation

Projects
None yet
@sxtyzhangzk
Copy link

commented Jul 12, 2018

Hi,

I was facing the issue #186 since the July update and I decompiled the updated game program Assembly-CSharp.dll.

I noticed that there's a new field named m_speed in struct PathUnit, which is calculated in PathFind.PathFindImplementation and seems to be the average speed of a path:
m_speed = 100 * methodDistance / duration

Then it is used by TransportLineAI.UpdatePath to update the length of lane:
lane.m_length = segment.m_averageLength * (100 / max(1, path.m_speed))

lane.m_length is used in CustomPathFind.ProcessItemCosts to compute the cost of public transport:

float prevDist;
if (prevLaneType == NetInfo.LaneType.PublicTransport) {
	prevDist = netManager.m_lanes.m_buffer[item.m_laneID].m_length;
} else {
	prevDist = Mathf.Max(SEGMENT_MIN_AVERAGE_LENGTH, prevSegment.m_averageLength);
}

However, the new field m_speed is not set in our custom PathFindImplementation so it should be 0 by default. Then the value of lane.m_length is multiplied by 100, which makes the costs of public transport too high.

I added some code in CustomPathFind.PathFindImplementation to calculate m_speed. Now PT seems working fine.

@Videonauth

This comment has been minimized.

Copy link

commented Jul 12, 2018

Now PT seems working fine.

If you build it on your branch and provide the .dll files I happily will long therm test it on my 12k Public Transport usage city.

@sxtyzhangzk

This comment has been minimized.

Copy link
Author

commented Jul 12, 2018

OK. These are my self-built dlls: TrafficManager.zip

@Sipke82

This comment has been minimized.

Copy link

commented Jul 12, 2018

This sounds cool! Can't wait to test it when i get home this evening.
Could you merge this change with 1.10.7 (and compile :-))? So that we also have a working ParkingAI, see #183

@Videonauth

This comment has been minimized.

Copy link

commented Jul 12, 2018

Just loading up my city including all my mods with the modified files. Will report back after having it run a prolonged bit of time.

@Xyrhenix

This comment has been minimized.

Copy link

commented Jul 12, 2018

I will be testing this as well, after making backup copies of my city and TMPE config files (for some reason changing version breaks all my timed traffic lights and lane assignments). I'll reply back here after around 90 minutes gametime.

Edit: This also broke my timed lights and lane assignments again so the first 30 minutes is going to be redoing around 80 lane connections (probably more) and around 8 sets of timed lights.

@Videonauth

This comment has been minimized.

Copy link

commented Jul 12, 2018

Report after running it for roughly 1 hour:
Initially dropping from 12k public transportation usage to about 9k then slowly stabilized at about 10k after all the traffic jams from running this save without TMPE cleared up.

  • It remembered the settings I had from the 1.10.8 version provided from steam workshop.
  • Passenger ships, trains and planes are still incoming
  • PT usage numbers still climbing, but slowly guess it will still need some time to settle at a fix number since the simulation is somewhat slow on my saved city due to the many assets used. (max FPS is 8-10)

Conclusion: for me this fix works as intended. Will test further for a few more hours simulation time.

Report after 1,5 hours:
Completely back to 12k PT usage. so I can confirm it works.

@Xyrhenix

This comment has been minimized.

Copy link

commented Jul 12, 2018

Still reconfiguring all my lane connections, restrictions, priority signs, traffic lights, etc.

It remembered the settings from the workshop 1.10.8 version (both Advanced Vehicle and Advanced Parking AI's were enabled), but all of my city-wide things (such as those listed above) were wiped. Hopefully that's isolated to me though.

@Videonauth

This comment has been minimized.

Copy link

commented Jul 12, 2018

@Xyrhenix Even if it is not isolated to you, I guess it would be a small price to pay for a working TMPE :) On my side the fix works wonderfully, I'm even back to a PT usage I never had before (12k+ now before it was always around 11900 +- 60, now its actually at 12900.

@Xyrhenix

This comment has been minimized.

Copy link

commented Jul 12, 2018

The fix is working, though slowly. My PT usage is up to around 2.5k metro, 1.5k bus (still rising, easily. In writing this comment metro went to 2.9k and bus to 1.8k). Hoping it'll get back to old figures soon (previously metro was at 8k, bus at around 5k). They jumped again before I'd finished writing the next paragraph to metro 3.5k and bus 2.1k.

I'm able to tolerate the resetting of lanes and such. Took an hour to do it all. I'm not sure what undoes it. My guess is maybe older versions of the mod don't recognise newer config settings (I had tried 1.10.3 two days ago as a potential fix, it was too laggy to work with so I went back to workshop 1.10.8 next day). Keeping regular save file backups to be sure I don't break something.

@NarodGaming

This comment has been minimized.

Copy link

commented Jul 12, 2018

Yep, I've tried it on a city which never had working PT, and when using this fix it all started working as soon as I loaded it up! Thanks!

@Xyrhenix

This comment has been minimized.

Copy link

commented Jul 12, 2018

Following from 160 minutes gameplay (after I redid lane connections, and such) PT figures were 9.2k metro and 4.5k bus in a city with 152k citizens.

Those PT levels seem to be consistent and stable. There are certainly no signs of decline in usage. I'll do more testing later to see if it remains at these numbers, but thus far things are looking good.

@ljy8280

This comment has been minimized.

Copy link

commented Jul 12, 2018

I use this Dll,it has brought my traffic level back to the beginning,Thanks!

@Xyrhenix

This comment has been minimized.

Copy link

commented Jul 12, 2018

The issue I am having regarding data failing to persist between game sessions (losing set lane connections, restrictions, and all of that which was mentioned in one of my earlier comments) may be a separate issue regarding deserialisation of data. I've opened a separate issue about that because I found a considerably large stacktrace in my TMPE log (see #190).

The fix for the PT problem here appears to be working fine as far as I can tell. It appears unrelated to the error I'm having.

@Sipke82

This comment has been minimized.

Copy link

commented Jul 12, 2018

  • PT works fine now!
  • All my lanes selections and timed trattic lights and speed limits were still intact ( i did not tested with older versions)
  • ParkingAI is still broken as reported in #183

Could you compile this fix into a 1.10.7 version? that would be perfect. then we would also have fixed Parking AI

@spiderpug

This comment has been minimized.

Copy link

commented Jul 12, 2018

Confirmed. This brings my PT usage back to normal while being zero before.

@Blacksharesvk

This comment has been minimized.

Copy link

commented Jul 12, 2018

Hi, I tried this updated version on new city and all cars left city (tried to wait 10min of fast forwarding). No traffic on highways.
When I reverted back to 1.0.3 or 1.0.5 and started new city I had plenty cars on highways and people moved into houses (took less than 3mins).

I would like to ask if anyone else tried it on new city. I deactivated all mods and moved them out of mod folder (ingame mod folder was empty just traffic manager in).
There is 0% traffic on map with this traffic manager.
Proof screenshot: https://www.photobox.co.uk/my/photo/full?photo_id=500888234509

@Videonauth

This comment has been minimized.

Copy link

commented Jul 13, 2018

@Blacksharesvk Can not reproduce that, just started a test game fresh on a vanilla map and i have traffic in my city. And it doesn't vanish at all even after having the simulation run for about 30 minutes and grown the city to about 5k citizens.

@Krutonium

This comment has been minimized.

Copy link

commented Jul 13, 2018

After switching to this version, My issue is that my cruise ships are spawning far too frequently, and most of the time with 0 people aboard. Otherwise transit seems to be back to normal.

@GamerMole21

This comment has been minimized.

Copy link

commented Jul 13, 2018

Thanks for this, it's great!
I wonder, due to how easily you found this, if the original creator of TM:PE wishes to continue development. If he doesn't people shouldn't be annoyed, instead they should thank him for all the brilliant work that he's done for the community, and with this fix I'm sure someone will continue development of this mod.
Thanks again LinuxFan and sxtyzhangzk and anyone else involved in the development of this mod.

@GamerMole21
Copy link

left a comment

I've tested this and can confirm that it does restore public transport usage in my city, although my usage is slightly less than before, this could be because the m_speed results in a slightly higher cost but I'm not 100% sure how it works so it could just be my city.

@Blacksharesvk

This comment has been minimized.

Copy link

commented Jul 13, 2018

Well I guess I will be using older version :D Its so easy to reproduce ghost city for me now :( . Do u have any idea if game keeps some old data stored somewhere on disk? I tried reinstall + manually deleted colosal order from appdata. Even after fresh install with just 1mod enabled (Tmpe) traffic is 0%. Btw in game it shows 1.10.8 is it correct?

Thanks for trying, Iam kinda jealous now at anyone for who it works :D

@GamerMole21

This comment has been minimized.

Copy link

commented Jul 13, 2018

What I did was unsubscribe from the workshop TM:PE and go into the appdata and delete all TM:PE files and stuff, except the config if u wanna keep arrows and stuff. Then downloaded sxtyzhangzk's DLLs, he provided a link to a zip, unzipped those DLLs into my appdata\local\colossal order\cities_skylines\addons\mods folder, they should be in their own folder called TrafficManager. Then I just enabled it in the game, traffic and PT works fine.

@Blacksharesvk

This comment has been minimized.

Copy link

commented Jul 13, 2018

Yeah I did same and 0traffic, I will try it on my laptop later when I get home. Cities skyline was never istalled there so I hope it will work and hopefully it will give me rough idea why its not working on my PC.

I installed it on laptop and I noticed game version was different in the corner - new version 1.10.1-f3 (old on PC 1.10.0).
Now it works also on PC i had to let game update and TMPEfix now works as intented.
Thanks guys.

@Videonauth

This comment has been minimized.

Copy link

commented Jul 13, 2018

@VictorPhilipp I uploaded this hotfix as a temporary solution to the workshop, please let me know when you update your mod so i can remove the version I took from @sxtyzhangzk and uploaded it. :)

@VictorPhilipp

This comment has been minimized.

Copy link
Owner

commented Jul 13, 2018

Thanks for your contributions! During the last two weeks I re-implemented the whole path-finding algorithm. The updated algorithm includes the change that was introduced with game version 1.10.1-f3. I will update the mod shortly.
Honestly, I was a little stumped by CO's change. That was the first time that a minor game update modified path-finding code...

@Videonauth

This comment has been minimized.

Copy link

commented Jul 13, 2018

Ahhhhh. He lives, well as soon yo u update TMPE on the workshop I'll remove my upload or update the description to point the people back to the original :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.