The International Simutrans Forum

Simutrans Extended => Simutrans-Extended future development discussion => Simutrans-Extended development => Implemented feature ideas => Topic started by: VOLVO on January 18, 2021, 08:44:09 AM

Title: Private cars attempt to reverse on the edge of towns causing circular jam
Post by: VOLVO on January 18, 2021, 08:44:09 AM
In the BB server in Barnor. it seems that private cars have a tendency to wait for a space for reversing on the edge of town blocking traffic behind, which in turn the traffic behind blocked the roundabout, which blocked the traffic leaving Barnor, and therefore the private cars never have the space to reverse. Perhaps roundabouts are not supposed to be a thing on Simutrans (either extended or not), but the waiting for space for reverse have cause the road traffic jam to be more serious than it actually should be. I think it makes more sense for the private cars to only be allowed to reverse when they hit a dead end.
Title: Re: Private cars attempt to reverse on the edge of towns causing circular jam
Post by: Vladki on January 18, 2021, 08:52:41 AM
I have seen similar behavior on stephenson-siemens many times too.
Title: Re: Private cars attempt to reverse on the edge of towns causing circular jam
Post by: Matthew on January 18, 2021, 09:01:16 AM
I just came here to say exactly the same thing!  ;D

To be clear, the specific issue is not that private cars turn around at the edge of town, it's that they do so on trunk roads. As a result, these 'town cars' cannot turn around until there is a break in the flow of traffic coming into town, which may be almost never. This can, and does, cause gridlock: a car on the west edge of town is waiting to turn eastwards, but the eastbound traffic isn't moving because there is a car on the east edge of town waiting to turn westward.

It should be noted that this is a gameplay issue that has no basis in reality. It's caused by a very sensible abstraction that improves performance, so the basic design is good!

Two possible fixes:

If the first option is chosen, then it could cause delays on intercity roads as 'town cars' randomly turn right (that is, across the other lane, depending on the left/right setting). So if someone is kind enough to code this, it would be a bonus if 'town cars' would only turn left (that is, the same direction as the left/right setting) when outside a city.
Title: Re: Private cars attempt to reverse on the edge of towns causing circular jam
Post by: Vladki on January 18, 2021, 12:55:22 PM
Yeah I think that a car on straight road should just continue along without regard of his destination. A check for destination should happen only on crossing, where there is a choice. And if the vehicle has to turn back for whatever reason, then the path it was following should be recalculated ASAP.
Title: Re: Private cars attempt to reverse on the edge of towns causing circular jam
Post by: jamespetts on January 18, 2021, 08:08:52 PM
This is not a bug: private cars have to reverse when they reach the edge of towns or else the private car routing system that allows cars to leave towns only on a route to their destination could not work and the whole private car routing system would fail.

However, I can see the problem that is created by cars waiting to turn around on busy trunk routs. Matthew's second solution has something to recommend it, although care must be taken for this not to be able to be exploited by the building of "car traps". An alternative might be for such a car, instead of turning around, to teleport to some other road in the immediate locality, thereby reducing the impact of local traffic on trunk roads.
Title: Re: Private cars attempt to reverse on the edge of towns causing circular jam
Post by: Mariculous on January 18, 2021, 08:24:44 PM
Teleportation indeed simulates reality quite well, just to pick up the most commonly used argument.
Title: Re: Private cars attempt to reverse on the edge of towns causing circular jam
Post by: Vladki on January 18, 2021, 08:36:59 PM
:-)  How about letting such cars to just continue in their random/heuristic mode? Let them get out of town and turn into whatever branch road they find eventually returning to their home town, or timer expiring?  Real drivers, if they happen to enter trunk road and leave the town (by mistake) - usually just have no other choice than to get to nearest crossing, turn on less busy road, turn around there, and get back to the town.
Title: Re: Private cars attempt to reverse on the edge of towns causing circular jam
Post by: jamespetts on January 18, 2021, 09:01:08 PM
The real problem with allowing cars to leave the towns not on a route to their destination is that it makes it much less likely that they will ever get to the route to their destination as they can get very, very far away indeed on an inter-town route. Also, it will mean that the level of traffic on inter-town routes does not accurately reflect the actual number of vehicles using those routes to get to their destinations.

Since it is (relatively) easily possible to solve the underlying problem without either of these side effects, it is not sensible to choose a means of solving it that does have these side effects.
Title: Re: Private cars attempt to reverse on the edge of towns causing circular jam
Post by: jamespetts on January 18, 2021, 11:02:40 PM
I have now implemented Matthew's second suggestion: this will be incorporated from to-morrow's nightly build. I should be grateful if people could test whether this improves the position apropos trunk roads and gridlock in towns from to-morrow onwards.
Title: Re: Private cars attempt to reverse on the edge of towns causing circular jam
Post by: Matthew on January 19, 2021, 12:54:24 PM
Thank you for addressing this issue so quickly, James! My initial impression is that this has worked and that at least one place (Wheaterpool island) has come out of gridlock as a result.