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

Parking AI: Infinite loop when parking spaces cannot be found #259

Closed
VictorPhilipp opened this issue Mar 30, 2019 · 34 comments · Fixed by #359
Closed

Parking AI: Infinite loop when parking spaces cannot be found #259

VictorPhilipp opened this issue Mar 30, 2019 · 34 comments · Fixed by #359
Assignees
Labels
BUG Defect detected confirmed Represents confirmed issue or bug LABS TM:PE LABS branch medium priority Issue with medium priority of work PARKING Feature: Parking AI / restrictions / etc STABLE TM:PE STABLE branch under-review A pull request has been created and is currently being reviewed
Milestone

Comments

@VictorPhilipp
Copy link
Collaborator

VictorPhilipp commented Mar 30, 2019

as reported by @leaderofthemonkeys via Discord.
https://gyazo.com/7f7311ba45fba9632e8ff4aa7928a1fc

Temporary workaround:

  1. Check you don't have duplicate copy of "Advanced Vehicle Options" mod installed - only use one version, unsubscribe the other.
  2. To remove stuck vehicles: Click vehicle to show info panel, then click despawn to despawn the vehicle.
@VictorPhilipp VictorPhilipp added the BUG Defect detected label Mar 30, 2019
@VictorPhilipp VictorPhilipp self-assigned this Mar 30, 2019
@originalfoo
Copy link
Member

Another user just reported this same issue in Discord chat. Only this time it was a vehicle leaving the city that was skipping between "leaving..." and "looking for parking..."

@originalfoo originalfoo added confirmed Represents confirmed issue or bug LABS TM:PE LABS branch medium priority Issue with medium priority of work STABLE TM:PE STABLE branch labels Apr 4, 2019
@Its-Damon
Copy link

Here are all requested things (I hope)
TMPE.log
output_log.txt

https://www.youtube.com/watch?v=tgsIcnYh8oY

And last the save game with the issue still included.

https://steamcommunity.com/sharedfiles/filedetails/?id=1705119239

@originalfoo
Copy link
Member

originalfoo commented Apr 9, 2019

Report by Steam user tls18:

Hello! Sometimes cars in my city stop on roads to remember a parking lot in the city. They do it even on the highway, so traffic jams will be produced. Is it because of "realistic parking" option? Will the cims use my steam workshop parking lots properly if this option is disabled? Because that stopping really destroys everything in the moment. Thanks!

I will have asked for log and savegame.

@krzychu124
Copy link
Member

@Its-Damon unsubscribe duplicate mod: Advanced Vehicle Options 😉 You don't need both I believe 😄

@originalfoo
Copy link
Member

Duplicate AVO mod (original + industries) can also cause vehicle spawning issues.

@originalfoo
Copy link
Member

Hunch: This might be caused by #277 (infinite loop on ped path nodes causing pathfinder to bork)

Also, just had another report of this bug on Steam (asked for savegame):

**Penguin 28 minutes ago **:
Is there any way to see more details on why they are giving up on finding a parking spot? Finding it rather frustrating to have cars blocking my traffic while they think of good parking spots - despite there being plenty available just on the opposite side of the road. Also have red buildings on my traffic overlay with plenty of parking in front of them :S Seems that the pedestrians are able to both walk and drive to them...

@eudyptula
Copy link

Okay, I'm going to move my response in here, as steam doesn't like comments on 1000+ chars...

First what I already wrote on steam:

@aubergine18: Technically mine is only a finite loop, they try to find a parking spot 10 times and give up. But they're just standing all still blocking the traffic while counting to 10 (without finding the nearby free parking spaces). Having a row of 20 cars or so that all have to drive to the same spot one-by-one to do this, causes quite the traffic havoc in a fine-tuned city though...

I will try to have a closer look when I open my city today and see where (and probably when, since I'm playing with RealTime mod) I have this issue. One thing that hit me yesterday; If I have a lot of smaller parking lots (1-4 spaces per lot) but they are already filled up - would each of these count as an attempt? Can easily happen with the parking road assets where you have to place the lines manually...

Then what I was trying to write:

Okay, been restarting my entire game and loading the same save for the last almost 2 hours. Each time I been trying out different fixes to see what changes things. Here's what I found so far:

The original solution: Cars stop at the corner of the harbor (where the two blueish cars are). When clicking on the cars, I can see that most of them attempts to locate a parking space 10 times, then disappears. A few manage to find one at the other parking lots around, but none find the the big parking lot just opposite the road - some even drive in there to turn around to get to other lots!

Rebuilding the access road: I tried deleting the access road to the parking lot (and a bit of the tram line). Then rebuilding it just as a straight piece. They still doesn't drive to the lot for parking though.

Adding an access road: I then tried adding an access road in the other side, closer to where the cars stop. Just added it as a straight piece through the tram road with anarchy. Now they finally use the lot for parking!

So there seem to be nothing wrong with the lot itself, but rather problems finding it when the access road is in the far side. I know they have to drive around to get in there, but is it really too far?

Save game: https://steamcommunity.com/sharedfiles/filedetails/?id=1750418655

Hmm, just reading the last post again makes me wonder if infinite ped. paths could be my issue - since I'm changing the ped. network by adding the additional access road...

Sorry for the rather lengthy post, but hope it's helpful

Penguin

@originalfoo
Copy link
Member

@eudyptula Can you try the following: Without the added access road (ie. remove it so the parking problem starts again), go in to TMPE mod options and disable then re-enable the Lane Routing tool on the Maintenance tab.

If that sorts it (at least temporarily) then it's possibly caused by the infinite loop issue mentioned in #277

As for the vehicles despawning, that will happen whenever a vehicle can't find a path for a certain amount of time or attempts.

@krzychu124
Copy link
Member

I've just subscribed that save and I am going to check that in a minute 😉

@krzychu124
Copy link
Member

I've just checked that and that issue seems to be not related to #277 , unfortunately 😕

@eudyptula
Copy link

Wish there was a way to click on a building and see which parking lots would be considered for travelling to that building...

@Sipke82
Copy link

Sipke82 commented May 29, 2019

Perhaps after a failed parking attempt, people should search further away for a parking spot, so eventually P+R facilities will be reached =)

@eudyptula
Copy link

Compiled with debug enabled and been looking through log files, so far I noticed that my problem seems to be a path-finding one. It finds the parking lot (confirmed at the building ID is indeed the right building), and starts the path-finding to that building. This however ends with:

[Debug] @ 3653277469 CustomCarAI.CustomSimulationStep(6115): Path: 226143, mainPathState=Failed
[Debug] @ 3653281161 AdvancedParkingManager.UpdateCarPathState(6115, ..., Failed) called.
[Debug] @ 3653284268 AdvancedParkingManager.UpdateCarPathState(6115, ..., Failed): mainPathSate is Failed.
[Debug] @ 3653287324 AdvancedParkingManager.UpdateCarPathState(6115, ..., Failed): Checking if path-finding may be repeated.
[...]

Might be trying to look further into this, but this was just my findings so far...

In the attached log snippet, car id=6115 and parking lot building id=33193:
TMPE-snipping.log

@VictorPhilipp VictorPhilipp added this to the 10.21 milestone Jun 2, 2019
@VictorPhilipp VictorPhilipp added the in-progress The problem is being solved currently label Jun 6, 2019
@VictorPhilipp
Copy link
Collaborator Author

VictorPhilipp commented Jun 7, 2019

Might be a duplicate of #352, due to:
[Debug] @ 3679994133 Could not find parking space prop in range (32) at building 33193.
According to the logs building 33193 does not have parking spaces has parking spaces which are too far away from its center point.
grafik

@originalfoo
Copy link
Member

originalfoo commented Jun 7, 2019

Do we update TMPE or list the building as broken?

Edit: It would be useful if the debug message included details about the building asset (eg. it's name or id, something that helps us find it in the workshop).

Also, would it be worth having a hash list (or whatever is fastest) of building instances where the values are booleans indicating whether the building should be considered for parking purposes? That way if there is a problem we can flag the building as 'do not try and park here'.

IMO it might be worth having a project milestone to overhaul parking mechanics.

@VictorPhilipp
Copy link
Collaborator Author

VictorPhilipp commented Jun 7, 2019

Caused by #232.
Solved by #196.

Path-finding constantly switches between the Parking AI modes *CarPathTo[Known|Alt]ParkPos and *MixedCarPath. Path-finding eventually fails in both modes.

There are two individual problems at play here. Reconstruction:

  • Car wants to leave the city.
  • Since the target is a (non-highway) outside connection the car needs to park & ride.
  • *CarPathTo[Known|Alt]ParkPos mode: A parking space in the vicinity is found before path-finding: Building 20335 (3x2 parking lot near the harbor)
  • First problem: Target segment to reach parking space is 28063 (Tram Track next to the parking lot). Since this segment is unreachable by car path-finding fails. The problem here is that the algorithm does not require the target segment to be accessible by car.
  • Now *MixedCarPath mode kicks in: Path-finding yields a path that tells it to park at the current segment.
  • Second problem: The current segment does not have parking spaces, nor does a parking building exist in close proximity: parking procedure fails.

The first problem can be solved by only accepting parking space target segments that allow for car traffic.
However, there is no 100% fail-safe solution for the second problem right now because path-finding does currently not know where a switch from vehicle lane to pedestrian lane (= parking) is possible or not. However, I need to check whether the randomParking flag is active for these path-finds.

@VictorPhilipp
Copy link
Collaborator Author

Do we update TMPE or list the building as broken?

I don't know which building id 33193 was referring to. In fact, there is no building 33193 in the savegame.

Also, would it be worth having a hash list (or whatever is fastest) of building instances where the values are booleans indicating whether the building should be considered for parking purposes? That way if there is a problem we can flag the building as 'do not try and park here'.

You mean that the Parking AI keeps track of experienced parking problems? Might be something to consider.

@VictorPhilipp
Copy link
Collaborator Author

I need to check whether the randomParking flag is active for these path-finds.

Nope, currently randomParking is false for mixed car paths. Turning it on for those paths might be a decent workaround.

@originalfoo
Copy link
Member

Not sure if it's relevant, but you mentioned cims leaving via non-highway roads, is that related to the issue where tourists struggle to leave the map via 2-way roads? See: #273

@VictorPhilipp
Copy link
Collaborator Author

I will check issue #273.

Meanwhile I fixed the randomParking bug.

And I found and fixed another issue. The junction restriction which allows to toggle pedestrian crossings affects road-side parking: When crossing is prohibited, cars are also unable to park at the same segment.

@VictorPhilipp
Copy link
Collaborator Author

I found another issue:
grafik

Crossing is prohibited for bent nodes at the spiral underground garage. Since the destination parking space is located at the other side of the road cims must be able to cross the street.

@originalfoo
Copy link
Member

Are the issues with ped crossings being bundled with the parking AI fix PR, or separate? Just thinking about noting them in change log - is it worth creating separate issue to track those or should I just reference this issue?

@VictorPhilipp
Copy link
Collaborator Author

I will bundle them into one PR since they are part of the whole fix.

@originalfoo
Copy link
Member

Just updating the changelog (in milestone, not the readme/changelog files yet) and found this ambiguous:

The junction restriction which allows to toggle pedestrian crossings affects road-side parking: When crossing is prohibited, cars are also unable to park at the same segment.

Does that mean "when prohibited it now prevents parking", or "there was a bug which prevented parking if crossing prohibited"?

And for this:

Crossing is prohibited for bent nodes at the spiral underground garage. Since the destination parking space is located at the other side of the road cims must be able to cross the street.

IIRC doesn't that asset include an 'elevator' in the central building allowing cims to exit the building without crossing a road?

VictorPhilipp added a commit that referenced this issue Jun 7, 2019
- Parking AI: Last segment before parking space is now required to be accessible by car
- Bugfix: Random parking broken
- Bugfix: Pedestrian crossing restriction affects road-side parking
- Pedestrian crossing is allowed at untouchable bent nodes
- Removed u-turn lane arrow check at transition nodes
@VictorPhilipp
Copy link
Collaborator Author

"there was a bug which prevented parking if crossing prohibited" 👍
I don't know about the elevator, I have to check. But when they cannot cross the road inside the garage path-finding fails.

@VictorPhilipp VictorPhilipp added under-review A pull request has been created and is currently being reviewed and removed in-progress The problem is being solved currently labels Jun 7, 2019
@eudyptula
Copy link

Just been reading through this quickly...

Might be a duplicate of #352, due to:
[Debug] @ 3679994133 Could not find parking space prop in range (32) at building 33193.
According to the logs building 33193 does not have parking spaces has parking spaces which are too far away from its center point.
grafik

As I remember it tries twice to find the parking space, once with a short range (32) and once with a longer range (256?) - as you see its about 128 away:
Found parking space prop in range (128.9706) at building 33193.

@VictorPhilipp
Copy link
Collaborator Author

I believe it only searches for parking space props once, with a search range of 32. Where have you seen it searching a second time?

@eudyptula
Copy link

First attempt at l.3:
[Debug] @ 3644184886 Could not find parking space prop in range (32) at building 33193.

Second attempt at l.58:
[Debug] @ 3644235112 Found parking space prop in range (128.9706) at building 33193.

If it searches once in a range of 32, how can it find the prop at the range of 128? Might just be me, not really that familar with your code, but it seems as it searches for a prop in short range first and then tries a wider range when the first fails... Anyways, looking forward to see if your next release fixes the issues!

@originalfoo
Copy link
Member

Feedback on 10.21 release:

Shadertheboi 9 hours ago
Cool! Thanks guys!

I'll putting it to the test right now on my current city and letting it run for a few hours by itself to test for #259.

Usually when I'm back after a few hours, my traffic's condition at 75% will drop ALL the way to 30+% or even below 30%.

Shadertheboi 2 hours ago
After testing for 6 hours, I can safely say that issue #259 has been resolved.

:)

@originalfoo
Copy link
Member

Tagging: #280 , #479

@originalfoo originalfoo added the PARKING Feature: Parking AI / restrictions / etc label Aug 11, 2019
@ve3
Copy link

ve3 commented May 24, 2020

I have this problem that car parking too far away from its position. For example, car parking at top left corner of the city while the owner go to somewhere at bottom right corner of the city while there are a lot of parking available there.
What options I should enable/disable to fix this?
Using TM:PE v11

https://postimg.cc/mzQgBNLt

@nostrabar
Copy link

I'm having a similar problem running this in my city as well. I'm doing a (right now) single square on the Riverrun map, putting the residential neighborhoods and commercial thoroughfares on the larger side of the river, and the industrial on the smaller side, and not linking the two halves via roads: i.e. vehicles which want to cross the river must leave their side via the highway and go around the other side (there's no roadaccess).

What I do see when doing this, however, is people trying to visit something on the residential side trying to enter the industrial side, and then stopping in the middle of an intersection, gumming up the works. Here's one example, of an SUV trying to find parking for their house on the industrial side of the map:

SUV, going home in the industrial district

Their home is located in Myrtle Square, located across the river, and literally two doors down from a "Standard Parking Garage" structure which has visible capacity, and on a street which has parking available:

home is in Myrtle Square

For whatever reason, the vehicle stops directly in front of the tram road coming from the tram stop:

the road they're blocking

This is after some fiddling, previously they would stop on the roundabout, which was an even more fun time.

I moved the tram station, and changed the road in question to the in-game 2-way-tram road, they would come in and target the same point, then re-calculate their destination to somewhere else in the industrial area, before eventually doing the right thing: leaving the industrial area via the highway and going around to the residential.

It's worth noting that the only way in/out of either the R/C/O or the Industry sectors is via the highway, so I'm not really sure why any car would ever try to get to the RCO sector via the Industry sector.

@krzychu124
Copy link
Member

Their home is located in Myrtle Square, located across the river, and literally two doors down from a "Standard Parking Garage" structure which has visible capacity, and on a street which has parking available:

You mean this garage (green rectangles represent real available parking spaces which game can use)?

Anyways, if it's not a problem could you share that savegame for further testing?

@nostrabar
Copy link

nostrabar commented Jan 4, 2021

No, I'm using Badi_Dea's parking garage

Savegame-wise, I have this one which the game says is two days old, and who's preview image reflects the smaller industrial section, but has the tram depot/road still in that location.

There's also a more recent version, which has the tram depot moved and Parking AI disabled. With parking AI enabled, it should be possible to find cars trying to park in the residential sector coming into the industrial sector, and fiddling around before eventually giving up (with PAI disabled, they simply put their cars in their pocket and board the tram).

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 LABS TM:PE LABS branch medium priority Issue with medium priority of work PARKING Feature: Parking AI / restrictions / etc STABLE TM:PE STABLE branch under-review A pull request has been created and is currently being reviewed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants