Vectorial1024 / ExpressBusServices

Buses skip stops whenever possible.
https://steamcommunity.com/sharedfiles/filedetails/?id=2262054175
MIT License
9 stars 0 forks source link

User reports: trolleybuses using Aggressive mode throws null pointer exception #37

Closed Vectorial1024 closed 1 month ago

Vectorial1024 commented 6 months ago

Some guesses:

luketeam5 commented 2 months ago

Hi @Vectorial1024, if i did gift you the sunset harbour DLC would that help you find & fix the issue?

Vectorial1024 commented 2 months ago

Can't remember correctly, but I think I made an update to disallow trolleybus from using the aggressive mode.

While the gift offer is appreciated, please don't do that. I've been rethinking my life for some time, and I intend to focus more on irl stuff. You may see I have already made a few open-source libraries (however usage seems too low).

Not too high priority when we have a workaround for now.

luketeam5 commented 2 months ago

Can't remember correctly, but I think I made an update to disallow trolleybus from using the aggressive mode.

Unless I am not somehow on the correct version I was able to reproduce the issue yesterday

While the gift offer is appreciated, please don't do that. I've been rethinking my life for some time, and I intend to focus more on irl stuff. You may see I have already made a few open-source libraries (however usage seems too low).

Not too high priority when we have a workaround for now.

Alright, that's fine if you ever change your mind and have time feel free to mention me

Vectorial1024 commented 1 month ago

Also see #16 ; clearly I didn't do anything about this...

Vectorial1024 commented 1 month ago

So, eventually, several things happened:

So, I got the Sunset DLC under a discount. I can play Cities Skylines later when I feel like it, but now @luketeam5 I have the means to really look into the problems by using eg Unlimited Money mod to create test cases.

Vectorial1024 commented 1 month ago

Still, while I can go and look at the mod codes again, @luketeam5 can you somehow reproduce this again after our old conversation in September?

luketeam5 commented 1 month ago

Hi @Vectorial1024,

nice to hear you're back in Cities Skylines.

Sadly can't reproduce it as of now due to a different issue from TLM. image

However, the way I did manage to trigger the issue in the past was very simple. making a road + depot setup like this: image

The mods used:

Vectorial1024 commented 1 month ago

Just in case, I should clarify that I am actually looking at all my side projects and deciding what to do with them. Given how CS1 itself is on life support mode, I'm not going to give too much effort to update CS1 mods. I'm just gonna "resign" myself to become more like a gamer instead of a modder.


Still, normally I would suggest eg installing Extended Error Reporting (https://steamcommunity.com/sharedfiles/filedetails/?id=2055465280) first to get a better stacktrace for me to do things, but even when I am looking at the over-simplified stacktrace, I can already notice that your TLM version is very strange.

Technically you are using the latest version of TLM, but you are actually using the wrong TLM. Basically, Klyte45 left the CS1 modding community too early with no apparent reason (guy is not gone; they are currently making CS2 mods eg Extended Transport Manager XTM https://github.com/klyte45/CS2-ExtendedTransportManager), which meant the TLM mod had several bugs that was not fixed. Then, another guy t1a2l came in and made a de-facto continuation of TLM (https://steamcommunity.com/sharedfiles/filedetails/?id=3007903394), which fixed the aforementioned bugs.

@luketeam5 You should switch over to t1a2l's TLM before we continue. And when you are switching, be sure to also switch the EBS TLM plugin to the t1a2l variation.

Me using t1a2l's TLM at version 14.5.2 found no general errors but also could not reproduce the trolleybus error.


Also, I got notifications enabled so you do not need to explicitly ping me; I will still see the new texts.

luketeam5 commented 1 month ago

Just in case, I should clarify that I am actually looking at all my side projects and deciding what to do with them. Given how CS1 itself is on life support mode, I'm not going to give too much effort to update CS1 mods. I'm just gonna "resign" myself to become more like a gamer instead of a modder. That's completely fine

Still, normally I would suggest eg installing Extended Error Reporting (https://steamcommunity.com/sharedfiles/filedetails/?id=2055465280) first to get a better stacktrace for me to do things, but even when I am looking at the over-simplified stacktrace, I can already notice that your TLM version is very strange.

Technically you are using the latest version of TLM, but you are actually using the wrong TLM. Basically, Klyte45 left the CS1 modding community too early with no apparent reason (guy is not gone; they are currently making CS2 mods eg Extended Transport Manager XTM https://github.com/klyte45/CS2-ExtendedTransportManager), which meant the TLM mod had several bugs that was not fixed. Then, another guy t1a2l came in and made a de-facto continuation of TLM (https://steamcommunity.com/sharedfiles/filedetails/?id=3007903394), which fixed the aforementioned bugs.

@luketeam5 You should switch over to t1a2l's TLM before we continue. And when you are switching, be sure to also switch the EBS TLM plugin to the t1a2l variation.

Me using t1a2l's TLM at version 14.5.2 found no general errors but also could not reproduce the trolleybus error.

Also, I got notifications enabled so you do not need to explicitly ping me; I will still see the new texts.

I was using the t1a2l's version, Skyve would've notified me if I was using the wrong one.

Vectorial1024 commented 1 month ago

You sure? It just feels really strange when you say you have problems with the TLM itself. Afaik Skyve maintains a manually-updated database, and if maintainers are all gone, then it will not tell you your mods are outdated.

image


I am running the following demo setup in a blank map, but supposedly my setup is equivalent to yours:

image


But still, while leaving the game running (!!!) to type out this message, I finally got the long-awaited error:

An exception occured during VehicleAI simulation step.
Asset: Trolleybus 01
VehicleID: 23314
Type: TrolleybusAI
Severity: High

System.NullReferenceException: Object reference not set to an instance of an object
at ExpressBusServices.Patch_PublicTransportExtraSkip.ExtraSkippingLogic (VehicleAI,uint16,Vehicle+) <0x009f9>
at (wrapper dynamic-method) VehicleAI.VehicleAI.ArrivingToDestination_Patch2 (VehicleAI,uint16,Vehicle+) <0x00059>
at (wrapper delegate-invoke) TrafficManager.Patch._VehicleAI.Connection.ArrivingToDestinationDelegate.invoke_void__this___VehicleAI_uint16_Vehicle+ (VehicleAI,uint16,Vehicle+) <0x0009c>
at TrafficManager.Patch._VehicleAI.UpdatePathTargetPositionsPatch.Prefix (VehicleAI,uint16,Vehicle+,UnityEngine.Vector3,int+,int,single,single) <0x0489a>
at (wrapper dynamic-method) VehicleAI.VehicleAI.UpdatePathTargetPositions_Patch1 (VehicleAI,uint16,Vehicle+,UnityEngine.Vector3,int+,int,single,single) <0x001fc>
at CarAI.SimulationStep (uint16,Vehicle+,Vehicle/Frame+,uint16,Vehicle+,int) <0x009a5>
at TrolleybusAI.SimulationStep (uint16,Vehicle+,Vehicle/Frame+,uint16,Vehicle+,int) <0x0012b>
at (wrapper dynamic-method) VehicleAI.VehicleAI.SimulationStep_Patch2 (VehicleAI,uint16,Vehicle+,uint16,Vehicle+,int) <0x005b9>
at TrafficManager.Patch._VehicleAI._CarAI.SimulationStepPatch.Prefix (CarAI,uint16,Vehicle+,UnityEngine.Vector3) <0x006c0>
at (wrapper dynamic-method) CarAI.CarAI.SimulationStep_Patch1 (CarAI,uint16,Vehicle+,UnityEngine.Vector3) <0x00057>
at HealkitMod.Patches.VehicleManagerPatch.SimulationStep (VehicleAI,uint16,Vehicle+,UnityEngine.Vector3) <0x00062>

So, @luketeam5 this bug is confirmed, and I can start thinking about what is happening for real. One thing to notice, I did not provide power/water to the depot, and the exception was thrown when the "no power"/"no water" becomes red.

Vectorial1024 commented 1 month ago

A quick observation shows that when the trolleybuses are force-recalled to their depots due to the depot not functioning, they become "unassigned" and are not part of any transport line, but will still emit a "arrived at bus stop" event when they arrive at the depot. Clearly, this mod should not touch what happens when vehicles return to base.

The reason why I basically never found this bug is because I always ensure the depots get their power and water before I do anything about the transport system, so when vehicles need to return to base in normal usage, TLM would have taken care of them and this mod did not need to do anything.

Update pending.

Vectorial1024 commented 1 month ago

Update released; closing.

Vectorial1024 commented 1 month ago

Many thanks to @luketeam5 for their persistence with this situation, which really helped to solve this bug!

luketeam5 commented 1 month ago

So glad you found & explained the issue, thank you so much!