Closed originalfoo closed 5 years ago
Changing mod options did not appear to alter the situation in any notable way.
Problem segment:
Flour mill struggling to get deliveries:
I have just seen a truck deliver to mill, but it took some time for it to happen.
Maybe it's down to pseudo-random lane changing at nodes? So sometimes, rarely, a truck might choose the outer lane after u-turn?
@aubergine10
Yes, there is logic that u-turns only able to choose innermost lane.
Do you want to update this in some certain cases? I can help.
Yes, specifically at end of dead-end roads like shown above. I guess in that specific situation, vehicles from any lane should be able to u-turn in to any of the lanes in opposite direction. It's only at dead-end roads though. I assume there might be a node or segment flag that can be used to identify them (see https://cslmodding.info/asset/network/#flags )
@aubergine10
I know, there is a OneWayOut flag in the segment or node to identify this case.
I would do some testing first though, to check it is a valid problem. Like I say, I've seen occasional truck able to make delivery to the flour mill, but they seem few and far between.
@aubergine10
Can you try to modify blow logic and check if this issue will be solved
CustomPathFind2.cs
bool relaxedLaneRouting = m_isRoadVehicle && ((!m_queueItem.spawned || (m_queueItem.vehicleType & (ExtVehicleType.PublicTransport | ExtVehicleType.Emergency)) != ExtVehicleType.None) && (laneTransitions[k].laneId == m_startLaneA || laneTransitions[k].laneId == m_startLaneB)) || isStockUturnPoint;
I will try.
While I do that, you might also want to investigate this potentially related issue: https://github.com/krzychu124/Cities-Skylines-Traffic-Manager-President-Edition/issues/85#issuecomment-466227677
It's complaining that isStockUturnPoint
is undefined
.
What code do I need to add to define the isStockUturnPoint
?
@aubergine10
OK, isStockUturnPoint is in another if else, so you need to define it again bool isStockUturnPoint = (nextNode.m_flags & (NetNode.Flags.End | NetNode.Flags.OneWayOut)) != NetNode.Flags.None;
Ok, and that goes just above the other code you mentioned above?
Also, what is difference between CustomPathFind.cs and CustomPathFind2.cs?
@aubergine10
CustomPathFind.cs is useless now, you can see in the compile, TMPE is define as use FP2.
Ok, I tested with the code changes and I see more vehicles choosing the outer lane at the u-turn near the flour mill.
However, there is still this issue where u-turns (if allowed at the junction) limit to the innermost lane at normal junctions. I would suggest in that situation, we either allow similar flexibility by default or require that "can change junctions when going straight ahead" also be enabled (for that junction) in order to get that flexibility. What do you think?
@aubergine10
we can use lane connector to allow vehicle to do u-turn from innermost lane to outerlane
If you mean vehicle can start u-turn at outerlane in normal junction, that is not real, because there are left turn car in innermost, u-turn car start u-turn at outerlane will confict with left turn car in innermost
At normal junction, vehicle can only start u-turn from innermost lane, but should have at least some flexibility over which lane in turns in to as it leaves the u-turn. Currently it's limited to turning in to the innermost lane as it leaves the u-turn.
It's only at dead-ends (cul-de-sac) where vehicle can start the u-turn from any lane and leave the u-turn on any lane. The code you posted above seems to deal with this scenario very well and hopefully solves some of our pathfinding problems.
@aubergine10
OK, I know your requirement now and I am familiar with these codes which related to this function, I will check these codes and give you feedback later.
@aubergine10
I checked the code, I think "u-turn from innermost lane and to any lane" is allowed in any junction, but this change from innermost lane to outer lane will give addition cost in TMPE logic, so vehicles will not select this path(unless the target innermost lane is congestion, this case is very rare).
You can try to build a building near the junction, disable right turn & straight & left turn path to this building(by laneconnector), only U-turn can reach this building(also, you need a 4-lane road). I think in this case, vehicles will do u-turn from innermost to outer lane and enter this building.
Ok, I will do some more testing to see if that happens.
Is there a way to determine, when path finding, if the current segment is the first segment or the destination segment? If so, the relaxedLaneRouting could be enabled in those two cases, ensuring that vehicles can cross bus lanes when starting their journey or arriving at destination?
relaxedLaneRouting is now enable when starting journey
You see m_startLaneA and m_startLaneB.
But we can not let it enable when arriving, othewise in the final part, vehicles will ignore all the rules and go to the target.
bool relaxedLaneRouting = m_isRoadVehicle && ((!m_queueItem.spawned || (m_queueItem.vehicleType & (ExtVehicleType.PublicTransport | ExtVehicleType.Emergency)) != ExtVehicleType.None) && (laneTransitions[k].laneId == m_startLaneA || laneTransitions[k].laneId == m_startLaneB)) || isStockUturnPoint;
Ah, I was assuming the 'start lane' thing was iterating lanes of current segment.
What's the difference between lane A and B?
Also, seeing a it's been about 15 years since I last did any real coding, can you check that I've understood the above code correctly..
relaxedLaneRouting =
(
road vehicle
and
( not spawned or (public transport or emergency) )
and
initial segment
)
or
stock turn point
Regarding the stock turn point stuff, I'm going to do some testing to see if that's given any improvement on #86...
@aubergine10
Seems in vannila codes, for cars, only startlaneA is used. I do not know what is the effort for startlaneB
And your understanding is 100% correct.
It looks like this solved bug #86 :) When road deleted, nearby vehicles aren't despawning any more (I need to do more testing to be sure).
EDIT: Confirmed - it fixes #86 as well!! :D
Fixed in PR https://github.com/krzychu124/Cities-Skylines-Traffic-Manager-President-Edition/pull/104
Thanks @pcfantasy for the fix!
Fix was erroneous. A new fix which was implemented for #112 is upcoming for version 1.10.7
While testing https://github.com/krzychu124/Cities-Skylines-Traffic-Manager-President-Edition/issues/85#issuecomment-466212290 I discovered following...
When vehicle u-turns at dead-end (cul-de-sac) of road, it's only able to choose innermost lane.
This means it cannot reach buildings on the outermost lane of the segment where it did u-turn.
I'm currently testing mod settings (policies tab) to see if they make a different (allow lane change, allow u-turn).