CitiesSkylinesMods / TMPE

Cities: Skylines Traffic Manager: President Edition
https://steamcommunity.com/sharedfiles/filedetails/?id=1637663252
MIT License
576 stars 85 forks source link

Timed Traffic Lights Not Saving/Loading #36

Closed FireController1847 closed 4 years ago

FireController1847 commented 5 years ago

Possibly related to https://github.com/VictorPhilipp/Cities-Skylines-Traffic-Manager-President-Edition/issues/231, I've noticed that my timed traffic lights are not saving (which sucks because I spent a lot of time setting those up D: ). Unsure of what could be going wrong.

krzychu124 commented 5 years ago

Please provide TMPE.log and savegame (via workshop share function is the best because I can see which dependent mods I need). I've noticed that sometimes traffic light are not saved because of invalid segment relations. I have no idea what is cause and it has to be checked.

(If you build this mod in FullDebug you will see detailed info for every operation in TMPE.log - on loading, saving game and manipulating traffic light and other stuff)

FireController1847 commented 5 years ago

Apologies on my late response (busy week 😫). I've been building it straight from source and using it casually from there, if that helps. Learning about the GlobalConfig and the debug switches, I did what any other smart person would do. Enabled every single one. Then played my game like that. :thinking: Was it a good idea? Absolutely. Was it actually a good idea? No, it was not. Let's just say I couldn't even get the level to load within ten minutes. So, I did the actual smart thing, and only enabled the ones I needed to (which was none, because none of the debug switches relate to this, for whatever reason). Here's your output logs! :)

New Game, Creating the Map, then Saving: TMPE.log Loading: TMPE.log

And here's the save. I didn't use any custom mods other than TMPE, Unlimited Money, & Unlock All. I had some custom assets enabled, but I didn't use any so that shouldn't be a problem. Sorry I didn't publish it to the workshop, I just used so little mods I thought it would be easier to do this. And it's 12:30 AM lol.

TMPE Bugtesting.zip

*Notice how when you load the save, there's no timed traffic lights, even though clearly the first log shows me setting them up. **I had to zip it due to GitHub's filetype limitations (I couldn't directly upload the .crp)

krzychu124 commented 5 years ago

Did you removed any field/property or changed something in class Configuration?(TLM/State/Configuration.cs) As you can see in TMPE.log (Loading log) you've added at line 329 - Error deserializing data: System.ArgumentException (type used to serialize has the same name but AFAIK it seems that is not the same as current version while loading) It seems that you've changes something(might be related to your PR ff60e17 😉 ) that prevents deserialization (process of reading savegame byte array chunk to create instance of Configuration class)

krzychu124 commented 5 years ago

Sadly it seems I couldn't reproduce your issue with loading. Everything working perfectly fine no issues in log. I can see you have added three Timed traffic lights. Look 😉 zrzut ekranu 72

I've been testing attached savegame with my latest build as well as yours from PR. No issues 😃

FireController1847 commented 5 years ago

Well that's very, very odd. I've noticed my game has a bunch of weird issues every once in a while. Is there any sort of cache you'd suggest I clear? GloablSettings delete maybe? Anything I can really do to figure out why it's not loading them?

krzychu124 commented 5 years ago

You can try deleting GlobalSettings file but I believe it has nothing to do with loading particular save 😕 Are you running game with subscribed TMPE? Where do you put compiled dll's if you are using your own build?

FireController1847 commented 5 years ago

Not subscribed TMPE, built files. Using the locations defined in the project (I even made a shortcut to D:\Games)

krzychu124 commented 5 years ago

You can put all dll's to C:\Users\<User Folder>\AppData\Local\Colossal Order\Cities_Skylines\Addons\Mods\TrafficManager

FireController1847 commented 5 years ago

As far as I know that's where they go according to the project, no? I saw them there last time I checked

krzychu124 commented 5 years ago

Yup, that folder is set in post build script

krzychu124 commented 5 years ago

I've pushed my commits to 1.10.15 and I think you should sync again 😉

FireController1847 commented 5 years ago

I'm on a different computer this time, but I cannot reproduce the working version. It still fails to load the manual traffic lights (am using latest commit).

krzychu124 commented 5 years ago

Manual traffic lights? Could you upload here zipped tmpe mod you've built if you find some time? I suspect that there must be something since on my version it is working properly. I will try to compare it with mine. Does that exception about failed configuration on loading is still there or something else? You can check output_log.txt for errors too.

FireController1847 commented 5 years ago

I have absolutely no idea what I changed, but I just loaded up the level and it worked. I'll try again on my desktop before closing this issue (as I'm on my laptop), but that's.... odd.

FireController1847 commented 5 years ago

After clearing my cache, deleting almost everything in my LocalAppData Colossal Data folder, and deleting every mod configuration I had, it still does not load timed traffic lights. I will mention, however, that when I am subscribed to the workshop version of the mod, it does. Could this be an issue with the build process?

krzychu124 commented 5 years ago

one moment 😉

krzychu124 commented 5 years ago

Ok, sync via steam workshop mod and tell me if it's working

FireController1847 commented 5 years ago

Yes, it is working. When you sent that, I was in the middle of loading my savegame. Do you want me to exit and re-sync again?

krzychu124 commented 5 years ago

Yup, I've updated mod on steam with fix

krzychu124 commented 5 years ago

Unfortunately it seems that every savegame created on new build has no TMPE data inside because of null pointer exception... All savegames created before this build should work normally

FireController1847 commented 5 years ago

Ok, well I can confirm that when building with the latest master (your hotfix), it still does not work. And I can also confirm that when playing with the workshop it works. (Sorry it took me so long to do this, loading with 75 mods on 12 GB of ram (reaching 11 GB on the game itself O.o) doesn't work very well lol.

krzychu124 commented 5 years ago

No problem and thank you for confirmation 😉

Let's fix something 😆

originalfoo commented 5 years ago

When not subscribed through Steam workshop, the PluginInfo object might be missing; if parts of config, logging, or whatever, are expecting that object, usually to construct folder paths, they could be causing the problem. There are probably some hard-coded folder paths or something to allow for testing in build environment, and if you've not got those set up correctly that could cause issues.

(For reference, here's some carnage that happened with Real Time mod when not installed through Steam)

krzychu124 commented 5 years ago

I will check that, thanks 😃

[UPDATE] Nope, there is no reference to this in TM:PE codebase 😅

originalfoo commented 5 years ago

How is it working out its folder paths, eg. for the localisation .txt files?

krzychu124 commented 5 years ago

They are compiled inside dll file 😉 so I have to rebuild whole project to see changes

FireController1847 commented 5 years ago

Well, it seems we've found the cause of this, so that's good. Now we just need to investigate why it's happening.

originalfoo commented 5 years ago

Did we ever find out what caused this?

FireController1847 commented 5 years ago

I don't think so. If I recall, we discussed about the fact that this resulted from building the game yourself, and was not an issue with the workshop item. However, I don't think we identified a cause.

originalfoo commented 5 years ago

Is it possible that it was caused by having two versions of TM:PE at the same time, even if one was disabled?

Does it still happen? (if not can this be closed?)

krzychu124 commented 5 years ago

I think we didn't know about that then, so yeah, it is possible

FireController1847 commented 5 years ago

I will test later today and report back here

originalfoo commented 5 years ago

Unless anyone states otherwise, I'm going to assume this was caused by multiple TM:PE versions present at same time, in which case #333 updates to incompatibility mod checker will resolve the issue (at least for most end users).

FireController1847 commented 5 years ago

I can confirm that this is still an issue related merely to building the DEBUG version of the mod. Using the workshop versions do not make this issue. This is not an issue due to two TM:PE versions at the same time... afaik

krzychu124 commented 4 years ago

I'm closing this. I've just checked attached log again to see well known error: Error deserializing data: System.ArgumentException: Object type System.Collections.Generic.List'1[xyz] cannot be converted to target type: System.Collections.Generic.List'1[xyz]

originalfoo commented 4 years ago

@krzychu124 What causes that error, for future reference?

krzychu124 commented 4 years ago

Multiple mod subscriptions for sure (probably one local and one from workshop but disabled).