Dear Devs: A proposal for improved (and performant) traffic lane distribution AI

  • We have updated our Community Code of Conduct. Please read through the new rules for the forum that are an integral part of Paradox Interactive’s User Agreement.

Morwynd

Private
Mar 19, 2015
23
14
So the problem with "smart lane selection" is that having every car constantly making such pathfinding calculations would cripple performance.

So how we can distribute lane usage better, in a way that still allows for a one-time calculated route at departure time?

I think a way that could work, is to randomly assign each vehicle a "lane preference number", that is then applied every time multiple appropriate lanes are available.

Eg: Assign every vehicle a random number between 1 and 60 (60 being the lowest common multiple of 2, 3, 4, 5, 6 which represent the possible number of lane options). Then every time the vehicle must choose a lane during the pathfinding calculation, use that number to select one.

So say there's 2 lanes making a left turn at an intersection. Cars with a number between 1-30 would choose the first lane, and 31-60 would use the second one. if there's 3 choices, the split is 1-20, 21-40, 41-60. If there's 4 choices, 1-15, 16-30, 31-45, 46-60... and so on for 5 and 6 lane choices.

(You want a single number that can be applied consistently to many choices instead of randomizing for each intersection, otherwise you'll get crazy weaving between intersections as everyone is switching lanes willy nilly.)

I have used randomization approaches like this to solve similar "congestion" problems in software before... typically for an event scheduler where too many things are trying to happen at the same time (so randomized time offsets instead of lane selection, but same general principle).
 
  • 13
Reactions:
The only issue I could see is the min/maxers complaining. Introducing some un-optimization sounds like a closer step towards realism, and I would love the challenge of dealing with bad drivers :p
 
This is such an elegant solution (at face value) that i doubt this thread will have much activity in it :p

Also, I just realized I probably should have posted in the "Suggestions & feedback" sub-forum. Whoops! First day on the forums here. :eek:o Perhaps a kind moderator could move this thread there if they see this.

The only issue I could see is the min/maxers complaining. Introducing some un-optimization sounds like a closer step towards realism, and I would love the challenge of dealing with bad drivers :p

UN-optimization you say? ;) When I see a million cars using the same turning lane when there's two available, that's what I consider un-optimal (in terms of usage of space). :)
 
I don't think the game itself has much of a problem with AI selecting the lanes they need to go in. The issue comes about when there is only 1 lane on a 6 lane road that can be used to make a turn when everyone wants to make that turn.

So a very simple solution to this problem is to increase the lanes that can be used. We have already seen work around from other using road behaviors. 6 lane road splits into 3 one way 2 lane roads. 2 lanes turn right, 2 lanes turn left, and 2 lanes go straight.

So the solution is to allow players to alter the lanes directions themselves. so they can dedicate as many lanes as they need.

Though I suppose you could combine both solutions, but I doubt the lanes being chosen is causing any sort of performance issues because the real calculations are happening when it's choosing the best route to take. In which case, that isn't going to change because they still need to calculate that.

Of course I am not a programmer and maybe I just am misunderstanding something.
 
Well the reason for that behaviour illustrated in the thread you linked to is because of subsequent turns they need to make, and they are planning ahead for it by getting in the right lane now. It's not realistic driving behaviour but it's what the AI seems to do. Your solution would need to override that lane selection algorithm in order to work, and then they will have to readjust to the fact that they now want to take a left after that right and so they need to switch lanes - not sure if it will be good or bad for traffic in game.
 
Well the reason for that behaviour illustrated in the thread you linked to is because of subsequent turns they need to make, and they are planning ahead for it by getting in the right lane now. It's not realistic driving behaviour but it's what the AI seems to do. Your solution would need to override that lane selection algorithm in order to work, and then they will have to readjust to the fact that they now want to take a left after that right and so they need to switch lanes - not sure if it will be good or bad for traffic in game.

The thing is, when there's multiple lane turns onto the same road, theoretically each lane is the same speed-to-destination. But the AI doesn't pick either one, it just pick the closest one. It'll change to that lane a set number of intersections or distance from the turn.

Since more than one lane can be the same speed-to-destination, varying the cars choice of lane randomly could end up making traffic more efficient while keeping each car on the optimal route. Even if it's just blind randomness it could still work.
 
Also, I just realized I probably should have posted in the "Suggestions & feedback" sub-forum. Whoops! First day on the forums here. :eek:o Perhaps a kind moderator could move this thread there if they see this.



UN-optimization you say? ;) When I see a million cars using the same turning lane when there's two available, that's what I consider un-optimal (in terms of usage of space). :)
Yes, but a min-maxer will have min-maxed the road system that the cars will be using the lanes perfectly. Throw some randomisation in there and it'll upset their balance, whilst making everyone else much happier.
 
Also, I just realized I probably should have posted in the "Suggestions & feedback" sub-forum. Whoops! First day on the forums here. :eek:o Perhaps a kind moderator could move this thread there if they see this.

Its probably easier to just open the same thread there again...
 
Would you not get the same problem when say you have a highway going off to an offramp? You'd just end up with people blocking ALL lanes instead of the one they want to come off at?
 
I have to echo in saying great idea. Right now the single line result is hampering my enjoyment of the game. Hope the devs are really test your theory and see if it produces a better/realistic result.
 
Well the reason for that behaviour illustrated in the thread you linked to is because of subsequent turns they need to make, and they are planning ahead for it by getting in the right lane now.

Yes that is correct, it would alter the current behaviour where the lane selection appears to be solely based on the next turn they need to make.

It's about increasing intersection throughput and mitigating the giant backups that result. With a single lane being used, the amount of cars that pass through the intersection on each green light is very low.
 
First, thanks for making such a well thought out suggestion. Forums need good communicators like yourself.

Just so I can understand more clearly, are you saying that each car should have a pre-designated lane that they will always use? So what happens when you have two lanes that can turn left onto a two-way street, so 50% of traffic is using each turning lane, but then after both lanes turn left they both need to turn left again but this time there is only one turning lane?

Then what you would have is one lane trying to merge into the other, which would cause massive backups anyways. The difference being is that now the entire two-way street is backed up, preventing cars from turning left AND right, rather than the current system which only blocks the left.

Make sense?
 
I don't think the game itself has much of a problem with AI selecting the lanes

I disagree. The problem lies exactly there. Either they are bugs or it is intended, either way it should be changed.

Situation (sadly no screen):
We have a 3-lane one-way road (highway) splitting into 2 separate 2-lane one-way roads (still following...?) like this: Y.
The one-way highway part has 2 lanes for right, and 2 for left (the middle lane having both possibilities).
Now EVERY vehicle, either going left or right, is using the far RIGHT lane of the one-way highway road. Even tho on this lane is only an arrow drawn for going right.
The other 2 lanes are NOT used.

If you follow this or not, in both cases it makes no sense...
 
Based on the scenario you stated, we would be assuming that all vehicles in the traffic jam are basically going to the same area. If so be the case, I can easily see where the choke point is (you second left turn) and resolve it. In the current state, I have no idea if the problem is truly a road capacity issue as the roads are not being utilized to its fullest potential. Using the OPs suggestion, it would be somewhat simple to try and resolve the problem you stated...add a second lane to the second turn. Currently, that simple option does not exist.

Hope I also make sense but I would like to hear the thoughts of the OP on this as well.

Edit: This was in response to the Azurespecter's scenario above.
 
I agree this is a better solution, because A) it's more realistic B) it shows you where the congestion is at it's source based on the build up of vehicles trying to get into the one lane.

It's also the most complained about thing in most reviews and most ppl who aren't aware of how the A.I works think it's because the game is broken
 
A) Just so I can understand more clearly, are you saying that each car should have a pre-designated lane that they will always use? B) So what happens when you have two lanes that can turn left onto a two-way street, so 50% of traffic is using each turning lane, but then after both lanes turn left they both need to turn left again but this time there is only one turning lane?

Then what you would have is one lane trying to merge into the other, which would cause massive backups anyways. The difference being is that now the entire two-way street is backed up, preventing cars from turning left AND right, rather than the current system which only blocks the left.

Make sense?

Speaking on behalf of OP without any authorisation whatsoever:

A) Given a certain number of lanes in any one direction, yes.

B) That would, I think, still be preferable to the current system. I can think of three ways around the problem off-hand, only one of which involves the introduction of new road types. :)
 
Last edited: