The International Simutrans Forum

 

Author Topic: Solving deadlocks in road traffic - "patience" meter  (Read 3892 times)

0 Members and 1 Guest are viewing this topic.

Offline dantedarkstar

  • *
  • Posts: 98
Solving deadlocks in road traffic - "patience" meter
« on: May 20, 2009, 09:26:14 PM »
We all know that road traffic has one major problem, that is extremely artificial - deadlocks. These are speciality of the citycars, although with little help even player vehicles can get stuck, each waiting for another to clear the way. This can happen on any loop, and a mixture of randomly-going and street-clogging cars and player vehicles that will only take fixed route, the potential is very large.
The problem is, where traffic jams are expected and realistic outcome, the deadlocks are not. Humans are smarter than waiting for each other infinitely and don't have enough patience for that.

My proposal is to introduce sort of "patience" or "timeout" to solve the deadlocks:
>if a player vehicle is completely stuck (not a single move) for a given time, it will drive forward and enter the next tile, regardless of blocking vehicles (but only one tile, since moving forward would reset the patience)
>if a citycar is completely stuck (not a single move) for a given time, it will just disappear or do the same as player vehicles (this is up to decide)
Note: all this would apply ONLY to road vehicles.

While it may seem like strange idea - intentionally allowing vehicles to "overlap", given sufficient "timeout" it will really only happen when deadlock occurs. And when a traffic jam like that occurs, people tend to get creative with their driving. Squeezing two vehicles where normally only one fits wouldn't be so out of place. After all, people will try to manouvre and finally find a way to solve a deadlock, and while this cannot be probably implemented in the game, a "representation" of that could.

Offline jamespetts gb

  • Simutrans-Extended project coordinator
  • Devotee
  • *
  • Posts: 18547
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: Solving deadlocks in road traffic - "patience" meter
« Reply #1 on: May 20, 2009, 09:32:58 PM »
This is an interesting idea - but would it not be better (and more realistic) for city cars simply to turn back and take a different route if their timeout expires? It is easier for city cars to do this than player vehicles.

Offline Spike

  • *
  • Posts: 1361
  • First Simutrans Developer and Graphics Artist
Re: Solving deadlocks in road traffic - "patience" meter
« Reply #2 on: May 20, 2009, 09:47:50 PM »
While it may seem like strange idea - intentionally allowing vehicles to "overlap", given sufficient "timeout" it will really only happen when deadlock occurs.

In the early Simutrans versions, city cars could drive through each other, so deadlocks never really happened. Then people complained that it is unrealistic, and citycars got collisions checks. Now we have deadlocks and people want the old features back ;D

On a more serious note, I also think it's good to let citycars bypass each other if stuck.

Offline prissi

  • Developer
  • Administrator
  • *
  • Posts: 9454
  • Languages: De,EN,JP
Re: Solving deadlocks in road traffic - "patience" meter
« Reply #3 on: May 20, 2009, 09:49:41 PM »
Since the vehicles waiting in front of crossings, deadlock became for infrequent. But then, this means you assinged too many vehciles to the task. (Citycars will self destruct after three month without moven, by the way ... )

Offline jamespetts gb

  • Simutrans-Extended project coordinator
  • Devotee
  • *
  • Posts: 18547
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: Solving deadlocks in road traffic - "patience" meter
« Reply #4 on: May 20, 2009, 09:59:07 PM »
Would it perhaps be better to have them attempting to turn back earlier, before they get to the stage of self-destructing?

Offline prissi

  • Developer
  • Administrator
  • *
  • Posts: 9454
  • Languages: De,EN,JP
Re: Solving deadlocks in road traffic - "patience" meter
« Reply #5 on: May 20, 2009, 10:00:40 PM »
Please have a look at the code: They should try this but it is almost never working out. (I think there is a bug still in the code.)

Offline jamespetts gb

  • Simutrans-Extended project coordinator
  • Devotee
  • *
  • Posts: 18547
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: Solving deadlocks in road traffic - "patience" meter
« Reply #6 on: May 20, 2009, 11:18:27 PM »
Ahh - if the bug were fixed, good things would happen! :-)