CitiesSkylinesMods / TMPE

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

`Electric Cars` policy does not work as expected with ParkingAI enabled #1527

Closed krzychu124 closed 2 years ago

krzychu124 commented 2 years ago

Describe the problem

It looks like ParkingAI does not ensure that spawned parked residents vehicle in the district with mentioned policy are only electric cars. I've checked the code and found other weird issues but still nothing which could explain that behavior.

Steps to reproduce

  1. Clear parked vehicles and preferably all passenger cars to despawn residents returning home in their "non-environment friendly" vehicles,
  2. Paint district and set Electric Cars policy
  3. From description and the game implementation, if citizen is at home and decided to spawn car it should be electric (final probability = random.Int(100) < 100 (forced probability when spawning vehicle at building located in the district with mentioned policy))

Notes

Maybe we should also try to force already spawned vehicles (and assigned to resident) to be electric, potential solutions:

krzychu124 commented 2 years ago

Unrelated issue: reading the ParkingAI logs I noticed that TM:PE is trying to search parking spot when citizen exit its vehicle at outside connection (going outside), same for incoming citizens (just before they spawn at outside connection). Since usually there are no buildings then not a big deal but on the other hand, time is wasted for things that always fail...

Side note, maybe I don't have enough car asset but I feel like once I created a small district in the corner with Electric Cars policy, 80% cars driving in the city are...electric. What is going onπŸ˜‚ ParkingAI logic for spawning vehicle when cim is at home seem to be a bit broken (or too restrictive) because when I disable ParkingAI there are loads of cars around high capacity residential buildings unlike near empty roadside parking lanes with ParkingAI enabled

krzychu124 commented 2 years ago

image

krzychu124 commented 2 years ago

@aubergine10 should we despawn parked vehicle (if not electric) if citizen home is located in the district with Electric Cars policy (force electric cars), Swap with electric is also pretty simple to do.

originalfoo commented 2 years ago

@krzychu124 How does the situation arise in first place - does it only occur if the district policy is set after the car is already driving/parked? Does it only affect home, or does it also affect industry/commerce?

IMO rather than despawn it would be better to just give them electric car but that might look bit weird if they park and suddenly their car changes upon parking (despawning on park would look even more weird).

krzychu124 commented 2 years ago

There is bug in the code - always spawns random vehicle regardless of citizen type (resident/tourist).

IMO rather than despawn it would be better to just give them electric car but that might look bit weird if they park and suddenly their car changes upon parking (despawning on park would look even more weird).

I didn't want to swap vehicle when they park but when cim starts his journey (and vehicle was parked too far and has to be moved closer) or is close enough but not electric. With the fix for mentioned bug vehicle swap would only occur when user set the policy (and obviously owns Green Cities DLC).

The only way for cim to lose his parked car reference is when vehicle cannot be moved either because game is shuffling parked vehicles or was parked too far and there is not free parking spot closer to home.

originalfoo commented 2 years ago

I didn't want to swap vehicle when they park but when cim starts his journey

πŸ‘

originalfoo commented 2 years ago

ParkingAI logic for spawning vehicle when cim is at home seem to be a bit broken (or too restrictive) because when I disable ParkingAI there are loads of cars around high capacity residential buildings unlike near empty roadside parking lanes with ParkingAI enabled

Does that need tracking in separate issue? Maybe it's due to Lifecycle Rebalance mod or something like that?

krzychu124 commented 2 years ago

I would add it to some existing issue. I think it might be some kind of problem with randomization when they could use roadside parking. I don't use any other mods while testing ParkingAI since that feature is already pretty complex - I need to be sure it's a bug in TM:PE so later can try with other mods to search for regression/conflict