The International Simutrans Forum

 

Author Topic: Private cars have an advantage over player convoys at road junctions  (Read 768 times)

0 Members and 1 Guest are viewing this topic.

Offline Matthew

  • *
  • Posts: 547
    • Japan Railway Journal
  • Languages: EN, some ZH, DE & SQ
I am not sure if this is bug or a pattern or what, so I have posted in this forum.

But I have noticed that private cars have an advantage over player convoys at road junctions. A player convoy will not proceed (either ahead or turning) unless the tile after the junction is completely free. But private cars will proceed as long as the junction is free. This is particularly problematic in two situations.

Firstly, imagine you have a crossroads with endless lines of traffic from the east and the west all turning south. If the road from the east has a bus route and the road from the west does not, the buses can never turn south because there is always a private car from the west road ahead of them. Eventually all the buses on the line will get Stuck behind the junction.

Secondly, imagine a road that has junctions at both ends, with a traffic light, bus stop or other obstacle at one end (e.g. east) and a high-traffic building (beer house, football stadium, etc.) next to the road's final tile at the west end. The combination of the delays from the obstacle and the constantly-spawning private cars mean that the final tile at the west end will never be free, and so player convoys can never move into it, even though private cars can.

Both situations can easily cause gridlock too.

EDIT: Here is a gif to illustrate:



Notice that the bus coming from the east cannot proceed over the junction. After about 10 seconds, a black car and green car approach from the south and are able to enter the same tile.

The workaround is to use traffic lights to give player convoys a chance to proceed. (Thus, pace an earlier discussion, Extended does have an incentive to use traffic lights). However, traffic lights cause all kinds of other problems, especially since it is very difficult to set them correctly when the private car explorer has multiple equilibria (on which I will post separately). And it feels unfair that private cars have an advantage over player convoys, even the lightest of vans.
« Last Edit: February 06, 2021, 05:02:08 PM by Matthew »

Offline Vladki

  • Devotee
  • *
  • Posts: 3714
    • My addons, mostly roadsigns, pak128.cs
  • Languages: EN, CS
Re: Private cars have an advantage over player convoys at road junctions
« Reply #1 on: February 07, 2021, 03:36:11 PM »
Yeah I wanted to report this too.  I wonder why there is different intersection logic for private and player vehicles in the first place?.
Would it be the same, we won't need traffic lights at all.

Offline zook2

  • *
  • Posts: 354
Re: Private cars have an advantage over player convoys at road junctions
« Reply #2 on: February 09, 2021, 12:21:30 AM »
Some of my convoys get stuck for months because of this. But I thought it's a feature :)

Offline Ranran

  • Devotee
  • *
  • Posts: 1479
  • Languages: ja
Re: Private cars have an advantage over player convoys at road junctions
« Reply #3 on: February 09, 2021, 03:21:07 AM »
A quick glance at the code reveals the difference that the code for a private car uses private_car_t::can_enter_tile and the road vehicle such as a bus uses road_vehicle_t::can_enter_tile.

From the observation of the intersection, it can be said that private cars can enter the intersection even if the next tile of the intersection is occupied. But convoy is not possible. That's the difference between a private car and a convoy. In other words, it is the cause of this.

I don't think this problem will be solved unless the private car checks the next tile at the intersection as well as the convoy. Otherwise, the private car has the right to enter the intersection in preference to the convoy.

Offline TurfIt

  • Dev Team, Coder/patcher
  • Devotee
  • *
  • Posts: 1432
Re: Private cars have an advantage over player convoys at road junctions
« Reply #4 on: February 09, 2021, 03:35:47 AM »
The code that handles this is commented out in Extended:
Code: [Select]
if(  !dt  ) {
// This possibly made traffic too cautious at junctions, causing delays. However, precisely what this did
// and why it did it remain unclear, so retaining for reference.
//dt = no_cars_blocking( test, NULL, next_direction, next_90direction, next_90direction, this, next_lane);
}

Offline Ranran

  • Devotee
  • *
  • Posts: 1479
  • Languages: ja
Re: Private cars have an advantage over player convoys at road junctions
« Reply #5 on: February 09, 2021, 11:01:38 AM »
Thank you for letting us know the code.
That change was made about a year ago.
https://github.com/jamespetts/simutrans-extended/commit/f58d8840ae63b3ac226a36c202ddde489386b594

Certainly, uncommenting the comment seems to improve the symptom.


Offline TurfIt

  • Dev Team, Coder/patcher
  • Devotee
  • *
  • Posts: 1432
Re: Private cars have an advantage over player convoys at road junctions
« Reply #6 on: February 09, 2021, 01:06:29 PM »
The comment is somewhat valid, citycars will end up more cautious than convois, flipping the 'advantage'.

The movement code for convois was enhanced a couple years ago, some of those changes could be applied to citycars, but many not. The issue largley comes down to citycars have random movement instead of a fixed route. In a case like this of intersections, keeping cars from blocking the intersections should be prime. Anything else will lead to eventual gridlock. For convois, once a convoi has cleared the intersection, other convois will enter the intersection as long as that first convoi can move. i.e. The logic assumes that if a convoi can move, it will, so is not treated as blocking. For citycars, this check is not done since following vehicles can't know where the citycar is going (no route) so can't find out if it can move.

The short term solution is to ensure the number of citycars never exceeds the point where they cause congestion due to low flow through an intersection. Balancing issue...
(and reverting this commenting out - gridlock [from blocking intersections] is worse than congestion)

Offline Vladki

  • Devotee
  • *
  • Posts: 3714
    • My addons, mostly roadsigns, pak128.cs
  • Languages: EN, CS
Re: Private cars have an advantage over player convoys at road junctions
« Reply #7 on: February 09, 2021, 09:05:49 PM »
I'd like to check if I understand correctly
a) private cars can enter the intersection without checking if the exit is free
b) there was a code that made them check the exit (be more cautious), but it was causing even more problems (gridlock) and so was disabled.
c) player trucks check if exit is free. Exit is considered free if there is no vehicle at all,
d) Exit is aslo considered free if there is a player vehicle moving in the same direction.

What would happen, if player vehicles would NOT check if the exit is free (points c and d), and behave exactly like private cars do? (i.e. point a)

Offline TurfIt

  • Dev Team, Coder/patcher
  • Devotee
  • *
  • Posts: 1432
Re: Private cars have an advantage over player convoys at road junctions
« Reply #8 on: February 09, 2021, 09:38:25 PM »
If vehicles don't check the exit free before entering the intersection, they can end up stopping in the intersection, blocking it, greatly increasing the chances of gridlock.

b) the reason stated for disabling in the citycar code is throughput, not gridlock prevention; Gridlocking is more likely.


Offline Vladki

  • Devotee
  • *
  • Posts: 3714
    • My addons, mostly roadsigns, pak128.cs
  • Languages: EN, CS
Re: Private cars have an advantage over player convoys at road junctions
« Reply #9 on: February 09, 2021, 10:12:20 PM »
So if a private car DOES check for the free exit, then gridlock is more likely.
And if player convoy DOES NOT check for free exit, then gridlock is more likely?

Does that make sense?
Or did I get it completely wrong, and the current situation is that now we have higher throughput (for private cars only), but ALSO higher chance for gridlock?
Then I would prefer reducing throughput, reducing gridlocks and getting equal chances for player and private cars to proceed into intersections.