Road vehicle collision

Got an idea for OpenTTD? Post it here!

Moderator: OpenTTD Developers

Post Reply
daniel3ub
Engineer
Engineer
Posts: 14
Joined: 27 Nov 2005 14:01

Road vehicle collision

Post by daniel3ub »

I've been playing TTD for years, sometimes using just road vehicles (just for fun).

Sometimes I can see a loong road full of trucks and buses, and some of them running in the wrong way (the faster ones), overtaking the slower ones, and passing through the vehicles that are coming in the opposite direction.

Since we now have one-way roads, I think it would be interesting to implement road vehicles collision, "forcing" the player to use one-way roads so his/her buses/trucks don't start causing accidents when overtaking in heavy traffic roads..
What do you think about? This way, the road vehicles would behave as much as trains, forcing the player to think about "road management", cleaves, junctions and so on.

I'm no programmer, so I have no idea if this wold be easy or feasible.
zypa
Transport Coordinator
Transport Coordinator
Posts: 329
Joined: 30 Mar 2006 12:05
Location: Germany
Contact:

Re: Road vehicle collision

Post by zypa »

I guess this is quite hard to code. But I'm not a developer, too.

However, you may like Roujin's patch: Traffic Lights.
It adds some "realism" to crossings.
User avatar
belugas
OpenTTD Developer
OpenTTD Developer
Posts: 1507
Joined: 05 Apr 2005 01:48
Location: Deep down the deepest blue
Contact:

Re: Road vehicle collision

Post by belugas »

I have not yet looked at the collision code of trains, but from what I know, is that it is a bit CPU intensive. To the point that only the head/end vehicle are checking for collisions, and not middle parts. So, if collisions is to be added to road vehicles, I guess that the performance of the game will gradually degrade, and by a lot.

And then, next question is : if done to road vehicles, should the same medicine be given to boats?
Don't know, to be honest.
If you are not ready to work a bit for your ideas, it means they don't count much for you.
OpenTTD and Realism? Well... Here are a few thoughs on the matter.
He he he he
------------------------------------------------------------
Music from the Bloody Time Zones
llevering
Engineer
Engineer
Posts: 4
Joined: 13 Mar 2008 09:35

Re: Road vehicle collision

Post by llevering »

belugas wrote:I guess that the performance of the game will gradually degrade, and by a lot.
However there might be a lot of exceptions for checking for a collision. If a RV is on its own side of the road and if its not on a rail or road crossing for example a crash can never happen (of course it can crash by an overtaking RV, however only one of both needs to detect the crash I think). On a one-way road too there is no need for checking. I like the suggestion and for sure in combination with Roujin's patch.
User avatar
belugas
OpenTTD Developer
OpenTTD Developer
Posts: 1507
Joined: 05 Apr 2005 01:48
Location: Deep down the deepest blue
Contact:

Re: Road vehicle collision

Post by belugas »

So what you're saying is that there are ways to make the CPU impact less important if proper checkings are been done.
It could be.
But I guess the only way to find out would be to actually test it.
Which is not something i fancy doing myself, to be honest.
If you are not ready to work a bit for your ideas, it means they don't count much for you.
OpenTTD and Realism? Well... Here are a few thoughs on the matter.
He he he he
------------------------------------------------------------
Music from the Bloody Time Zones
daniel3ub
Engineer
Engineer
Posts: 14
Joined: 27 Nov 2005 14:01

Re: Road vehicle collision

Post by daniel3ub »

Well, I was thinking about it, too, the exceptions.
When the RV are entering and exiting stations they always pass trough the others.
It really seems that this is more complicated than it looks at first glance :)
sulai
Traffic Manager
Traffic Manager
Posts: 159
Joined: 24 Sep 2004 18:23

Re: Road vehicle collision

Post by sulai »

daniel3ub wrote:(...) Since we now have one-way roads, I think it would be interesting to implement road vehicles collision, "forcing" the player to use one-way roads so his/her buses/trucks don't start causing accidents when overtaking in heavy traffic roads.. (...)
I think collision detection is quite complicated, even if it's only for the vehicle that is overtaking.

Another proposal to make "overtaking" more realistic and make one-way roads more important to the game:

Let a vehicle only overtake if there is no oncoming traffic. If a RV wants to overtake it must be sure, that for the time it needs to be on the wrong way, there will be no other vehicle on that lane. I think this is quite easy to check since oncoming vehicles can only be in a certain radius. It's not even necessary to check whether the oncoming vehicle really comes that way, because a real bus driver wouldn't know that too.

The sketch shows all oncoming traffic detected by a very simple algorithm which just checks: is there some vehicle coming toward me, or is it traveling away from me? The two vehicles marked with (!) will be detected wrong by this simple algorithm.
Attachments
sketch: only overtake if there is no oncoming traffic
sketch: only overtake if there is no oncoming traffic
overtake if no oncoming traffic.png (11.23 KiB) Viewed 2730 times
daniel3ub
Engineer
Engineer
Posts: 14
Joined: 27 Nov 2005 14:01

Re: Road vehicle collision

Post by daniel3ub »

And, on top of this, to make things more "interesting", let's just add a random chance that the driver will overtake anyway, even if the algorithm says that it's not possible. Nothing greater than 1 or 2%, I think.

This way, the player can choose to not use one way roads, but more cars on the same road, more likely will be an accident.
sulai
Traffic Manager
Traffic Manager
Posts: 159
Joined: 24 Sep 2004 18:23

Re: Road vehicle collision

Post by sulai »

I just had a look at how overtaking works in the game right now.
  • The vehicle won't overtake if there are crossings. This isn't checked before: the vehicle starts overtaking and aborts doing so if there is a road crossing.
  • The vehicle will overtake if there is oncoming traffic.
So there are actually only two points to change:
  • if a vehicle wants to overtake, first check:
    • is there a crossing?
    • is there oncoming traffic?
  • ... and follow if it can't overtake
This will lower the capacity of two way roads and it will make one-way-roads more important.
tb2571989
Director
Director
Posts: 544
Joined: 04 May 2006 10:54
Location: Bristol, UK
Contact:

Re: Road vehicle collision

Post by tb2571989 »

also, bear in mind that road vehicles using one-way roads at the moment only use the default left or right-hand setting and not both, as a 'dual carriageway' and something I'd like to see them doing.
What about you? Will you join me when the time comes to be a hero?
daniel3ub
Engineer
Engineer
Posts: 14
Joined: 27 Nov 2005 14:01

Re: Road vehicle collision

Post by daniel3ub »

Sure. the final result will be just like we drive here in Brazil: slower vehicles at the right lane, faster vehicles overtaking at the left lane. Then the one-way road could be used to trigger overtaking and collision verification off. If the RV is at a one-hand road, do not check to see if it's possible to overtake (or do not check for collisions).
Post Reply

Return to “OpenTTD Suggestions”

Who is online

Users browsing this forum: No registered users and 3 guests