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

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

Closed
krzychu124 opened this issue Apr 9, 2022 · 8 comments · Fixed by #1543
Closed

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

krzychu124 opened this issue Apr 9, 2022 · 8 comments · Fixed by #1543
Assignees
Labels
BUG Defect detected confirmed Represents confirmed issue or bug PARKING Feature: Parking AI / restrictions / etc
Milestone

Comments

@krzychu124
Copy link
Member

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:

  • reset assigned vehicle so it may decide again if want to use car,
  • swap it with electric when cim wants to use it
@krzychu124 krzychu124 added BUG Defect detected investigating Issue currently under investigation PARKING Feature: Parking AI / restrictions / etc labels Apr 9, 2022
@krzychu124 krzychu124 self-assigned this Apr 9, 2022
@krzychu124
Copy link
Member Author

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
Copy link
Member Author

  • in the meantime while debugging Parking 😕

image

@krzychu124
Copy link
Member Author

krzychu124 commented Apr 22, 2022

@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
Copy link
Member

@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
Copy link
Member Author

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
Copy link
Member

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

👍

@originalfoo
Copy link
Member

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
Copy link
Member Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
BUG Defect detected confirmed Represents confirmed issue or bug PARKING Feature: Parking AI / restrictions / etc
Projects
None yet
2 participants