Author Topic: One-way Two-lane road Fun Patch  (Read 26534 times)

0 Members and 1 Guest are viewing this topic.

Offline THLeaderH

One-way Two-lane road Fun Patch
« on: February 06, 2017, 02:04:26 AM »
Current simutrans standard impose very strict conditions on overtaking. I made changes on the code so that both 2 lanes are fully used when traffic is separated like Highway system.

I haven't understood how to make patch file yet. Sorry. I uploaded a zip file which contains files I edited. Please download OTRP1-1.zip and OTRP1-2.zip. (Files are divided due to the file size restriction, Sorry. Please note that the text encoding of readme.txt is UTF-8.)

This patch(?) is based on simutrans 120-1-3.
<How to use>
1.Please download simutrans 120-1-3 source code.
2.Please replace simconvoi.cc, simconvoi.h, /vehicle/overtaker.h, /vehicle/simvehicle.cc, and /vehicle/simvehicle.h to the files contained in this zip file.
3.Compile them.

I know this is very sensitive topic, so excuse me if this is not convenient.
I made 2 videos that shows how this extension works.
https://www.youtube.com/watch?v=K_sI_rdwrL8 (This shows the extension realizes smooth overtaking even in a slope or a dense road.)
https://www.youtube.com/watch?v=bzeqceL23D4 (This shows the extension realizes a large road traffic using 2 lanes each direction.)

I think the algorithm of this extension is not safe enough to be integrated to simutrans standard. I'm waiting for your opinions and bug reports ;D

    Here is what I did in this extension.
    • Some conditions to overtake is abolished. For example, no-slope, no-crossings and no other vehicles apart from the two involved.
    • Current speed (not Maximum speed) is used to judge whether the convoy can overtake.
    • Before entering a tile, other traffic is checked when the convoy is in overtaking. (Current Simutrans does not check when the convoy is in overtaking.)
    • A convoy leaves passing lane only when the other lane is safe enough to change lane.

Offline Commander Noddy

Re: One-way Two-lane road Fun Patch
« Reply #1 on: February 06, 2017, 06:13:38 AM »
OMG Good Work THLeaderH:D Hope you enjoy the game simutrans and make improvement on it! I love your project very much! Actually, less and less people play simutrans because of people are getting bored with the old development. Thanks for your sharing anyway:D

2.Please replace simconvoi.cc, simconvoi.h, /vehicle/overtaker.h, /vehicle/simvehicle.cc, and /vehicle/simvehicle.h to the files contained in this zip file.

However, I dont know what you mean:(
« Last Edit: February 06, 2017, 06:40:51 AM by Commander Noddy »

May The Force Be With You Always!

Offline THLeaderH

Re: One-way Two-lane road Fun Patch
« Reply #2 on: February 06, 2017, 06:58:57 AM »
Quote
However, I dont know what you mean:(
I edited 5 files of original simutrans 120-1-3 source code.
When compiling, please remove

simconvoi.cc (in the top directory)
simconvoi.h (in the top directory)
simvehicle.cc (in "vehicle" folder)
simvehicle.h (in "vehicle" folder)
overtaker.h (in "vehicle" folder)

from original source folder and copy files from the unziped zip files to simutrans source folder.
Can you get it?

Offline Commander Noddy

Re: One-way Two-lane road Fun Patch
« Reply #3 on: February 06, 2017, 03:23:20 PM »
Maybe I am a noob:( Or can you make a tutorial video for us please Thx:D

May The Force Be With You Always!

Offline Leartin

Re: One-way Two-lane road Fun Patch
« Reply #4 on: February 06, 2017, 04:29:28 PM »
 :o *checks date* nope, not april yet... AWESOME!

Offline sheldon_cooper

Re: One-way Two-lane road Fun Patch
« Reply #5 on: February 06, 2017, 11:57:52 PM »
That was great. Maybe, the harder to make the vehicles stop side by side in a supposed congestion, but that's the way to go !! :D

Offline prissi

  • Developer
  • Administrator
  • *
  • Posts: 8830
  • Total likes: 324
  • Helpful: 229
  • Languages: De,EN,JP
Re: One-way Two-lane road Fun Patch
« Reply #6 on: February 07, 2017, 03:42:30 AM »
The no crossing condition is something that has to stay, at least in a modified way. Otherwise it will completely mess up games in cities, when a standing bus is overtaken. (And also in most countries it is forbidden to overtake on a crossing).

Also the speed restriction has likely to stay, since otherwise two similar speed vehicle will block the road (as seen in your videos). That will rather reduce throughput then.

But some other thing might be indeed useful. Maybe the crssing restriction can go with enough looking ahead. Although the logic for cars and convois needs to be different then.

I think the better way would be a road with a flag marked as two lane highway. Then on such stretch other conditions would apply.

Offline THLeaderH

Re: One-way Two-lane road Fun Patch
« Reply #7 on: February 07, 2017, 04:46:20 AM »
Quote
The no crossing condition is something that has to stay, at least in a modified way. Otherwise it will completely mess up games in cities, when a standing bus is overtaken. (And also in most countries it is forbidden to overtake on a crossing).
The reason why I abolished no-crossing condition is a meeting point (like mt.jpg). If there is no-crossing condition, vehicles cannot move to passing lane at a meeting point and that will be a great bottleneck in road traffic.
At diamond crossings, overtaking (which means moving to passing lane from the other lane) should be forbidden. However, vehicles running on passing lane should be allowed to continue running on passing lane at a diamond crossing considering major local street (like dc.png).
[Added Feb. 7] Moving to passing lane at a diamond crossing is already prohibited. At three-way crossings, it's allowed.

Quote
I think the better way would be a road with a flag marked as two lane highway.
I think road way addons should have "no-overtake flag" considering compatibility. Old addons except city roads should be interpreted that overtaking is allowed.

Offline IgorEliezer

  • Devotee
  • Administrator
  • *
  • Posts: 3958
  • Total likes: 148
  • Helpful: 71
  • Lost In Stupid Parenthesis
    • Igor Eliezer Architect and Urban Planner/Arquiteto e Urbanista
  • Languages: PT, EN, AutoLISP, Python
Re: One-way Two-lane road Fun Patch
« Reply #8 on: February 07, 2017, 05:34:02 AM »
:o *checks date* nope, not april yet... AWESOME!
Too soon? :D

Offline Ters

  • Coder/patcher
  • Devotee
  • *
  • Posts: 4900
  • Total likes: 217
  • Helpful: 108
  • Languages: EN, NO
Re: One-way Two-lane road Fun Patch
« Reply #9 on: February 07, 2017, 06:39:19 AM »
Introducing these new rules everywhere will just be strange. One-way roads needs to know that they are exactly that, so that overtaking vehicles know that oncoming traffic is no issue. Without that knowledge, no overtaking across junctions can take place, or even across slopes or around bends, although that depends to a greater extend on the surrounding landscape as well in real life.

Offline THLeaderH

Re: One-way Two-lane road Fun Patch
« Reply #10 on: February 07, 2017, 06:55:07 AM »
Facing traffic is checked before and during overtaking. Before starting overtaking, vehicles confirm that there is no facing traffic ahead for enough distance as current simutrans release. During overtaking, vehicles confirm that there is no facing traffic for next 3 tiles ahead and vehicles take emergency avoidance when oncoming traffic is found.
Vehicles don't have to know that the road is exactly one-way road. These are very similar to real-life, I think :)

Offline Ters

  • Coder/patcher
  • Devotee
  • *
  • Posts: 4900
  • Total likes: 217
  • Helpful: 108
  • Languages: EN, NO
Re: One-way Two-lane road Fun Patch
« Reply #11 on: February 07, 2017, 07:07:50 AM »
Facing traffic is checked before and during overtaking. Before starting overtaking, vehicles confirm that there is no facing traffic ahead for enough distance as current simutrans release. During overtaking, vehicles confirm that there is no facing traffic for next 3 tiles ahead and vehicles take emergency avoidance when oncoming traffic is found.
Vehicles don't have to know that the road is exactly one-way road. These are very similar to real-life, I think :)

Yes, but with junctions, there may appear oncoming traffic at any time, so the rules on normal two-way roads more or less say that you can not overtake across a junction.

Offline prissi

  • Developer
  • Administrator
  • *
  • Posts: 8830
  • Total likes: 324
  • Helpful: 229
  • Languages: De,EN,JP
Re: One-way Two-lane road Fun Patch
« Reply #12 on: February 07, 2017, 09:04:43 AM »
One could of course extend the check at junctions, either of they are exit only (one way exit), so no problems, or if not, check in the branching directions for no traffic as there are tiles; or instead of three tiles ahead, rather check as soon as a crossing come into range the status of that crossing at every step.

And the overtaking of identical vehicles with identical load just creates a bigger traffic jam compared to before as soon as there are vehicles with greatly varying speed there and two same speed vehicles blocking effectly the road.

Furthermore, within city limits overtaking is entirely forbidden in many countires. So one could argue that one does not care about cities, and forbid overtaking there completely if the other is not standing at a stop.


Offline jamespetts

  • Simitrans-Extended project coordinator
  • Devotee
  • *
  • Posts: 16093
  • Total likes: 439
  • Helpful: 177
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: One-way Two-lane road Fun Patch
« Reply #13 on: February 07, 2017, 11:08:49 AM »
This is very interesting: there is much to be said for more realistic dual carriageways. I agree with Prissi that overtaking vehicles must be at least slightly faster than the vehicles that they are overtaking (this is a realistic requirement), although I am doubtful that preventing all overtaking in cities is a good idea given that there might be player 'buses trying stuck behind horse-drawn private carriages at some points in history that would make that very difficult.
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

Offline Leartin

Re: One-way Two-lane road Fun Patch
« Reply #14 on: February 07, 2017, 03:49:01 PM »
    One-way roads needs to know that they are exactly that, so that overtaking vehicles know that oncoming traffic is no issue. Without that knowledge, no overtaking across junctions can take place, or even across slopes or around bends, although that depends to a greater extend on the surrounding landscape as well in real life.

    I agree that one-way roads should know what they are (meaning it would be an asymetric waytype), especially since current 'one-way-roads' don't actually forbid vehicles to go the other direction if there are waypoints after the signs, or if a citycar spawns on it.

    But I'm wondering - the law is not the same everywhere. Eg. in the US, you are allowed to simply stay on the left lane, and others may overtake you on the right. Same is true for Austrian cities. Furthermore, if there is only one lane, you are supposed to drive about 20 km/h quicker than the car you try to pass. If there are two or more lanes, you only need to be slightly quicker and can pass on a longer stretch of street. You might even stay on the left as long as there are cars on the right, and no quicker car is coming from behind.

    So if anyone is going to put some more work into this, I would suggest:
    • Introduction of asymetric ways - essentially, each piece of road would exist twice, once for each direction. This would be a requirement for one-way-road to keep track of their direction, but also to graphically destinguish the directions (eg. having a guiding rail always to the right of the one-way-road)
    • If a car is on the right lane and a slower* car is in front, and no faster car is on the left lane on same height or behind, change to the left lane
    • If a car is on the left lane, and there are no cars ahead on the right lane, it switches to the right lane
    • If a car is on the left lane, and there are cars ahead on the right lane, if those are slower, it does not switch to the right lane on it's own.
    • If a car is on the left lane and a slower car is on the left lane in front, honk. I mean, send a signal to the car in front to switch back to the right lane as soon as possible. (but if we can get "honk"-sounds to that, I wouldn't be mad either...)
    Now obviously, one problem with this would be that normally, if there are cars of the same speed on the right lane, no left-lane car might ever get back in. Therefore, cars need to have at least a 'car length' of distance to each other, and left lane cars can squeeze in that distance. If a car has less than the 'car lenght' distance to the car in front, it slows down slightly. to build up that safe space again.
    [/list]
    *All instances of "slower" and "faster" car mean a comparison of the speed a car could go with the current load, not it's actual speed at the given time. Also, it means a 'significant' difference. If we had a difference of 20km/h for normal overtaking, I guess 5km/h would be appropriate.

     I think with rules like these, traffic of mixed vehicle types should go significantly faster. But it may be too much for too little gain, since it's ultimately just about roads. And Simutrans being a game of transportation, most of your vehicles might be trucks, which would have a "no overtaking allowed" flag anyway.

    Offline THLeaderH

    Re: One-way Two-lane road Fun Patch
    « Reply #15 on: February 07, 2017, 03:53:00 PM »
    I finally got how to make a patch file!
    Now, to try this One-way Two-lane extension,
    1.Download OTRP2.patch and simutrans 120-1-3 source code.
    2.Put the two in the same directory.
    3.In CUI, using "cd" command, move to the directory where you put the two.
    4.type
    Code: [Select]
    patch -u -p1 -d simutrans-src-120-1-3 < OTRP2.patchIf the patching succeeds, CUI will display the follows
    Code: [Select]
    patching file besch/reader/way_reader.cc
    patching file besch/weg_besch.h
    patching file besch/writer/way_writer.cc
    patching file boden/wege/weg.h
    patching file simconvoi.cc
    patching file simconvoi.h
    patching file vehicle/overtaker.h
    patching file vehicle/simvehicle.cc
    patching file vehicle/simvehicle.h

    I'm also working on sharing binary files for Windows and Mac. I want everybody "try" this extension and make progress in the discussion.

    Thanks to your helpful comments, I could add some new codes.
    Now, road has "overtaking_info" flag. 0 = overtaking is allowed, 1 = overtaking a loading convoy only, 2 = overtaking is completely forbidden.
    This parameter should be written in .dat file like
    Code: [Select]
    overtaking_info=0At the place where overtaking should not happen, players can use no-overtaking roads.

    Although I released new version, I've not tested makeobj yet because I had a trouble on compiling makeobj. I tried to compile makeobj and terminal shows
    Code: [Select]
    ../utils/dr_rdpng.cc:3:10: fatal error: 'png.h' file not found
    #include <png.h>
             ^
    1 error generated.
    make: *** [../build/default/utils/dr_rdpng-makeobj.o] Error 1
    I'm using MacPorts. and MacPorts says...
    Code: [Select]
    USER-120-1-3-extend USER$ port installed libpng
    Warning: port definitions are more than two weeks old, consider updating them by running 'port selfupdate'.
    The following ports are currently installed:
      libpng @1.6.16_0
      libpng @1.6.26_0 (active)
    What should I do?
    « Last Edit: February 07, 2017, 04:15:58 PM by THLeaderH »

    Offline Isaac.Eiland-Hall

    • Benevolent Dictator
    • Administrator
    • *
    • Posts: 3440
    • Total likes: 332
    • Helpful: 91
    • PanamaCityPC.com/support/
      • Facebook Profile
    • Languages: EN
    Re: One-way Two-lane road Fun Patch
    « Reply #16 on: February 07, 2017, 05:49:26 PM »
    I've got limited time to reply - work has been keeping me busy especially trying to catch up from having been sick.

    Some thoughts:

    1. In at least most states in the US, the law says slower traffic must drive to the right. In some states, passing on the right is illegal. What is enforced may be a bit different, of course.

    2. It is my humble opinion that even vehicles of equal speed should be allowed to drive side by side just because vehicles often enter and exit. And it seems more realistic to me - if there's enough traffic to use both lanes, but you don't allow equal speed vehicles to use both lanes, you may end up with a single file line that's not realistic. But it's all compromise...

    3. Even if #2 is argued against, remember also the scale of Simutrans - each tile is (in most paks) simultaneously 1km and... 20m? 40m? I forget. Point being that it's *also* unrealistic for vehicles not to be able to get closer to each other than 1km..... so a bit of compromise is *already* being done. :) And road vehicles are at a sharp disadvantage to trains on compact travel. So I think it would be fair to allow vehicles to use both lanes pretty freely. And personally, I'm fine with the situations where they move back over sharply - it's a compromise I'd be very willing to see.

    4. On distinguishing the roads - SimCity paints arrows on the tiles. Perhaps a partially-transparent overlay for direction would work. Or the road designer could do something like the mentioned guardrails on each side.

    5. I assume the most logical way to "make" a one-way road would be to have a tool to click-and-drag.

    Sorry, gotta run!

    Offline killwater

    Re: One-way Two-lane road Fun Patch
    « Reply #17 on: February 07, 2017, 10:59:00 PM »
    Thats an awesome improvement if implemented and incorporated. Just curious if other approach could be possible though - the scale of vehicles is way off so if there can be two vehicles on one road tile maybe it would be possible to put 4 vehicles two in each direction one by one on one tile as well? It would make road infrastructure much more compact and maybe easier to provide special junctions as a special road tile? Like waiting lanes for left turn for example?

    Offline sheldon_cooper

    Re: One-way Two-lane road Fun Patch
    « Reply #18 on: February 07, 2017, 11:52:05 PM »
    What is CUI? If you do not ask for much, a short video explaining how to install it would be of great help, since I am a layman in this matter.
    since already, thank you for your attention! :)

    Offline jamespetts

    • Simitrans-Extended project coordinator
    • Devotee
    • *
    • Posts: 16093
    • Total likes: 439
    • Helpful: 177
    • Cake baker
      • Bridgewater-Brunel
    • Languages: EN
    Re: One-way Two-lane road Fun Patch
    « Reply #19 on: February 08, 2017, 12:30:38 AM »
    Thats an awesome improvement if implemented and incorporated. Just curious if other approach could be possible though - the scale of vehicles is way off so if there can be two vehicles on one road tile maybe it would be possible to put 4 vehicles two in each direction one by one on one tile as well? It would make road infrastructure much more compact and maybe easier to provide special junctions as a special road tile? Like waiting lanes for left turn for example?

    Currently, only one road vehicle can occupy a tile, but tiles are divided into (if I recall correctly) 32 steps for vehicles. Vehicles also have a length encoded into their .dat files of how many of these steps that they occupy. These two data together should in principle be possible to be the basis for allowing multiple vehicles to occupy the same tiles travelling in the same directions with accurate spacing, and would be a significant improvement in road vehicle handling in the game.
    Download Simutrans-Extended.

    Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

    Follow Simutrans-Extended on Facebook.

    Offline isidoro

    Re: One-way Two-lane road Fun Patch
    « Reply #20 on: February 08, 2017, 12:55:31 AM »
    In the original overtaking patch that I submitted I imposed some conditions that I considered somewhat realistic: for instance, not overtaking on slopes since usually in RL on some slopes it's forbidden since you can't see ahead.  The same applies to some crossroads.  It would be very dangerous to allow vehicles to overtake there.

    When prissi reviewed the patch, some of those conditions were relaxed, some were made more stringent.

    I think that some way of indicating that a road is one-way and obeys other rules regarding overtaking (vs two-way roads) is sensible, but I would do that "dynamic".  That means that when altering a road, if you put/remove some road signs that forbid entrance to a piece of road, it's the program the one to mark that piece of road one-way tile by tile.  Whether that should be shown in graphics or not, is another matter.

    I wouldn't even call "overtaking" when you are in one-way roads.  For example in an T shaped crossroads, being the vertical line of the T one-way and the horizontal one two-way, it makes perfect sense that cars going up willing to turn right keep in the right lane and those willing to turn left move altogether to the left lane some tiles before the crossroads.

    Offline DrSuperGood

    Re: One-way Two-lane road Fun Patch
    « Reply #21 on: February 08, 2017, 02:47:24 AM »
    Simutrans is a game and not a real life simulator. Although some realism is nice, it is not critical and can even be detrimental to the game experience. For example, as it is large trains can teleport large distance when changing schedule, something impossible in real life but critical for trains to work properly. Having some unrealistic overtaking situations might be better for the gameplay than trying to keep everything realistic.

    Offline Ters

    • Coder/patcher
    • Devotee
    • *
    • Posts: 4900
    • Total likes: 217
    • Helpful: 108
    • Languages: EN, NO
    Re: One-way Two-lane road Fun Patch
    « Reply #22 on: February 08, 2017, 06:50:26 AM »
    Jumping trains happens only when manually triggered, and that is relatively rare and mostly avoidable. Vehicles passing through each other due to overtaking not being disallowed when it should could be very visually disturbing, especially for the group of players more interested in esthetics than economics or even logistics. Not that road vehicles never occupy the same space at stops, nor forgetting about boats and airplanes.

    Having two vehicles driving side-by-side at the same speed is not altogether unrealistic, but it will defeat the purpose of having two-land roads in the first place. If two trucks are lumbering down an uncongested motorway at 70 km/h blocking both lanes, it won't take long until someone in a faster car will get on the horn to tell them to make room. If the road is congested, things are differently. (Someone might still start honking, though.)

    Offline prissi

    • Developer
    • Administrator
    • *
    • Posts: 8830
    • Total likes: 324
    • Helpful: 229
    • Languages: De,EN,JP
    Re: One-way Two-lane road Fun Patch
    « Reply #23 on: February 08, 2017, 06:59:58 AM »
    I think, in the greater working of simutrans, having a "double lane Highway upgrade" wayobj could be the best solution. That can enforce a single direction when built and, at the same time, indicate relaxed overtaking rules. It  would also solve the backward compatibility issue, isnce it could upgrade any existing road.

    Grafikwise it could be two highway signs at one end and two not entry signs at the exit end and the other appropriate signs at crossings, together with a guard rails or so.

    Offline THLeaderH

    Re: One-way Two-lane road Fun Patch
    « Reply #24 on: February 08, 2017, 08:07:30 AM »
    Now I finally succeeded in making executable files! Please try One-way Two-lane road Fun Patch and make progress in the discussion!

    For Windows: http://www.filedropper.com/simwinotrp2
    For Mac: http://www.filedropper.com/simmacotrp2
    For Linux: Sorry, I haven't made an executable binary for Linux yet. Please compile and share with me :-[

    [Edited Feb.8] I heard that FileDropper keeps uploaded files only for a day. Do you know any good service to share executable files?
    patches.simutrans-germany.com is not useful because its maximum file size is only 3MB! :(
    « Last Edit: February 08, 2017, 08:26:44 AM by THLeaderH »

    Offline Leartin

    Re: One-way Two-lane road Fun Patch
    « Reply #25 on: February 08, 2017, 11:04:12 AM »
    I think, in the greater working of simutrans, having a "double lane Highway upgrade" wayobj could be the best solution. That can enforce a single direction when built and, at the same time, indicate relaxed overtaking rules. It  would also solve the backward compatibility issue, isnce it could upgrade any existing road.

    Grafikwise it could be two highway signs at one end and two not entry signs at the exit end and the other appropriate signs at crossings, together with a guard rails or so.

    Is there really a "backward compatibility issue"? Wether it's a wayobj or a way, the pakset would have to add something in order for two-lane-roads to be available, and if they don't it's not in the game. If a one-way-road uses the same graphics as a bi-directional road, it's simply a matter of writing a few new lines for dat files. I don't really see an issue with that. However, if artists are willing to get more creative, why would you want them to be stuck to a wayobject which would need to fit every way in the pak and potentially addons?

    And please consider this: One-way-roads require asymetric graphics*, so the road would actually go the other way if you turn a map 180 degree. But this is not something only one-way-roads would benefit from. For example, it would make sense for the poles of electrification to be on the same side of a track at all times. But this is currently semi-impossible to do. Similarly, p192c has noise-protection-walls at the very edge of the tile. But there are two, one for each edge, and while that's pretty versatile if you know how to use it, it would be instantly destroyed if you were to rotate the map.

    *They are not exactly required, the graphics could stay the same, but there would be functional asymetry either way.

    Offline THLeaderH

    Re: One-way Two-lane road Fun Patch
    « Reply #26 on: February 08, 2017, 01:20:27 PM »
    Thank you for your helpful opinions! However, I think this discussion is getting too complicated... I should explain some rules I imposed as a writer of this extension.
    These are conditions I imposed on this extension.
    • Vehicles start overtaking when there is 5km/h or more slower car in front of the vehicle. Current speed (not maximal possible speed) is used in this comparison.
    • Before starting overtaking, the vehicle confirms that there is no facing traffic for enough distance and that the passing lane is safe. (there is no car around the place the vehicle is going to move to.)
    • The number of tiles needed for overtaking is calculated when starting overtaking.
    • When the number becomes 1 and it is not safe to move to traffic lane, the overtaking vehicle stays on passing lane until traffic lane becomes safe to move to.
    • Overtaking vehicles immediately go back to traffic lane as traffic lane becomes safe.
    • If facing traffic is found while overtaking, the overtaking vehicle immediately goes back to traffic lane to avoid crash.

    And I want make some replies to the discussion...
    • In normal playing situation, players will put one-way signals when players want to use two lanes as one-way road. Under the situation that facing traffic easily occures, overtaking won't happen because vehicles check facing traffic for enough distance.
    • Quote
      within city limits overtaking is entirely forbidden in many countires. So one could argue that one does not care about cities, and forbid overtaking there completely if the other is not standing at a stop.
      I think the condition that overtaking loading convoy only or the conventional overtaking condition is suitable on city roads.
    • Quote
      Having two vehicles driving side-by-side at the same speed is not altogether unrealistic, but it will defeat the purpose of having two-land roads in the first place. If two trucks are lumbering down an uncongested motorway at 70 km/h blocking both lanes, it won't take long until someone in a faster car will get on the horn to tell them to make room. If the road is congested, things are differently.
      Actually I think this is not a big problem as this frequently occures in real roads. If a solution is required, I'll make vehicles on passing lane slow down a bit to make chance of going back to traffic lane. This slow down will happen only when the car behind the vehicle is (potentially) much faster than the vehicle.
    • Quote
      For example in an T shaped crossroads, being the vertical line of the T one-way and the horizontal one two-way, it makes perfect sense that cars going up willing to turn right keep in the right lane and those willing to turn left move altogether to the left lane some tiles before the crossroads.
      This project is an extension of the overtaking feature and I'm not planning to do this. I think this kind of lane change will make a mess on roads!

    Offline THLeaderH

    Re: One-way Two-lane road Fun Patch
    « Reply #27 on: February 08, 2017, 02:27:54 PM »
    I want say a little more about having two vehicles driving side-by-side at the same speed.
    It is the case that car's speed varies on real road. However, this is not because of car's performance but because of the variance of the extent to which drivers violate road's speed limit and driver's mind.
    In simutrans world, there is no violation of speed limits (except in down grades) or variance of driver's mind. Number of type of cars is much smaller than the one in real world. If two vehicles are not allowed to drive side-by-side at the same speed as many of you suggest, in many cases, vehicles cannot move to passing lane even in very congested situation and this problem is just what I want to solve in this extension!

    However, it is a big problem that slow vehicles stay on passing lane. I'm thinking about the solution.
    When a car behind the slow vehicle running passing lane is much faster than the slow vehicle, the slow vehicle should slow down to make a chance to go back to traffic lane.

    Offline Vladki

    Re: One-way Two-lane road Fun Patch
    « Reply #28 on: February 08, 2017, 04:54:47 PM »
    Just a few thoughts that may or may not be useful:
    In real life you do not know max speed of other vehicles. If the car ahead is accelerating, you accelerate too. If it is braking you brake too, as it may be due to some obstacle. Overtake only if it goes on almost steady speed and you think you can go significantly faster. Polite drivers do not accelerate when being overtaken, just to avoid parallel ride seen in the video. If the road is mostly empty, keep right. If the road is congested, use whichever  lane is free, overtaking on right side is then OK. Move to the left lane if you plan to turn left, or if more traffic is joining from right. Cities in simutrans have so many crossings, that overtaking is impossible.




    Offline isidoro

    Re: One-way Two-lane road Fun Patch
    « Reply #29 on: February 08, 2017, 10:51:48 PM »
    Well, you don't know the exact max speed and acceleration of other vehicles, but you can estimate it.  If I see a horse carriage or a bicycle, I'm certain that I won't have any problem overtaking them with my car.  If I see a sport car, I will doubt it.

    In the original patch, the idea behind using the max speed in ST instead of actual speed was this use case: a vehicle, let's say with a max speed of 50 kph starts overtaking one with actual speed of 20 kph.  But it happens that the overtaken one has high acceleration and max speed of 100 kph.  It will certainly happen that the first will never be able to overtake the second, since in ST there's no such a concept of politeness.

    Don't forget what was the original aim of the overtaking patch.  It was this other use case: I have a line with a mixture of old slow vehicles and new faster ones.  The slowest would make all the fastest to queue up behind them and make the latter completely useless.  To break this behavior, to consider only max speed would suffice.

    Offline Vladki

    Re: One-way Two-lane road Fun Patch
    « Reply #30 on: February 08, 2017, 11:32:14 PM »
    I will repeat: do not overtake if the car ahead is accelerating or breaking. Overtake only if the car ahead has almost constant speed (including 0) and you are capable of higher speed.

    I think simutrans cars know that they are being overtaken, so they can behave politely and not accelerate until the maneuver is finished




    Offline jamespetts

    • Simitrans-Extended project coordinator
    • Devotee
    • *
    • Posts: 16093
    • Total likes: 439
    • Helpful: 177
    • Cake baker
      • Bridgewater-Brunel
    • Languages: EN
    Re: One-way Two-lane road Fun Patch
    « Reply #31 on: February 08, 2017, 11:53:33 PM »
    I will repeat: do not overtake if the car ahead is accelerating or breaking. Overtake only if the car ahead has almost constant speed (including 0) and you are capable of higher speed.

    That would be a little too restrictive, I think, as a very slow vehicle might be accelerating very gradually to a very low top speed, braking to pull into a stop ahead, or slowing down because it is weak and going uphill, and these are all times when the vehicle should definitely be able to be overtaken, all other conditions being favourable.
    Download Simutrans-Extended.

    Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

    Follow Simutrans-Extended on Facebook.

    Offline Ters

    • Coder/patcher
    • Devotee
    • *
    • Posts: 4900
    • Total likes: 217
    • Helpful: 108
    • Languages: EN, NO
    Re: One-way Two-lane road Fun Patch
    « Reply #32 on: February 09, 2017, 06:35:31 AM »
    Overtake only if it goes on almost steady speed and you think you can go significantly faster.

    About half the time I overtake in real life, it is because the other vehicle doesn't hold a steady speed. Sometimes the other vehicle is just unable to hold its speed uphill, other times, the driver is just bad at maintaining the same speed. Only the former is relevant for Simutrans, though.

    Offline Vladki

    Re: One-way Two-lane road Fun Patch
    « Reply #33 on: February 09, 2017, 06:49:49 AM »
    OK, I agree the real life algorithm is not that easy to describe. I wanted to avoid the situation from video, where one bus slowed down on slope, and another (same type) started to overtake, but slowed down too, because of the same slope.

    If someone is about to stop, he should make it clear by blinking, but that is not possible in simutrans



    Offline Commander Noddy

    Re: One-way Two-lane road Fun Patch
    « Reply #34 on: February 09, 2017, 01:54:50 PM »
    Sorry for a bit off-topic, however this reminds me the discussion of overtaking has started since 2008, which is nearly 10 years ago xdd.
    https://youtu.be/V_ktD417nEM

    May The Force Be With You Always!