The International Simutrans Forum

Development => Patches & Projects => Larger Projects => Topic started by: THLeaderH on February 06, 2017, 02:04:26 AM

Title: One-way Two-lane road Fun Patch
Post by: THLeaderH on February 06, 2017, 02:04:26 AM
To download and learn the latest version of OTRP, please visit https://github.com/teamhimeh/simutrans/blob/OTRP-distribute/documentation/OTRP_information_en.md (https://github.com/teamhimeh/simutrans/blob/OTRP-distribute/documentation/OTRP_information_en.md)


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 (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 (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.
Title: Re: One-way Two-lane road Fun Patch
Post by: Commander Noddy 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:(
Title: Re: One-way Two-lane road Fun Patch
Post by: THLeaderH 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?
Title: Re: One-way Two-lane road Fun Patch
Post by: Commander Noddy 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
Title: Re: One-way Two-lane road Fun Patch
Post by: Leartin on February 06, 2017, 04:29:28 PM
 :o *checks date* nope, not april yet... AWESOME!
Title: Re: One-way Two-lane road Fun Patch
Post by: sheldon_cooper 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
Title: Re: One-way Two-lane road Fun Patch
Post by: prissi 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.
Title: Re: One-way Two-lane road Fun Patch
Post by: THLeaderH 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.
Title: Re: One-way Two-lane road Fun Patch
Post by: IgorEliezer on February 07, 2017, 05:34:02 AM
:o *checks date* nope, not april yet... AWESOME!
Too soon? :D
Title: Re: One-way Two-lane road Fun Patch
Post by: Ters 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.
Title: Re: One-way Two-lane road Fun Patch
Post by: THLeaderH 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 :)
Title: Re: One-way Two-lane road Fun Patch
Post by: Ters 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.
Title: Re: One-way Two-lane road Fun Patch
Post by: prissi 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.

Title: Re: One-way Two-lane road Fun Patch
Post by: jamespetts 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.
Title: Re: One-way Two-lane road Fun Patch
Post by: Leartin 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.
    Title: Re: One-way Two-lane road Fun Patch
    Post by: THLeaderH 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?
    Title: Re: One-way Two-lane road Fun Patch
    Post by: Isaac.Eiland-Hall 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!
    Title: Re: One-way Two-lane road Fun Patch
    Post by: killwater 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?
    Title: Re: One-way Two-lane road Fun Patch
    Post by: sheldon_cooper 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! :)
    Title: Re: One-way Two-lane road Fun Patch
    Post by: jamespetts 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.
    Title: Re: One-way Two-lane road Fun Patch
    Post by: isidoro 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.
    Title: Re: One-way Two-lane road Fun Patch
    Post by: DrSuperGood 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.
    Title: Re: One-way Two-lane road Fun Patch
    Post by: Ters 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.)
    Title: Re: One-way Two-lane road Fun Patch
    Post by: prissi 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.
    Title: Re: One-way Two-lane road Fun Patch
    Post by: THLeaderH 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 (http://www.filedropper.com/simwinotrp2)
    For Mac: http://www.filedropper.com/simmacotrp2 (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! :(
    Title: Re: One-way Two-lane road Fun Patch
    Post by: Leartin 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.
    Title: Re: One-way Two-lane road Fun Patch
    Post by: THLeaderH 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!
    Title: Re: One-way Two-lane road Fun Patch
    Post by: THLeaderH 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.
    Title: Re: One-way Two-lane road Fun Patch
    Post by: Vladki 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.



    Title: Re: One-way Two-lane road Fun Patch
    Post by: isidoro 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.
    Title: Re: One-way Two-lane road Fun Patch
    Post by: Vladki 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



    Title: Re: One-way Two-lane road Fun Patch
    Post by: jamespetts 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.
    Title: Re: One-way Two-lane road Fun Patch
    Post by: Ters 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.
    Title: Re: One-way Two-lane road Fun Patch
    Post by: Vladki 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


    Title: Re: One-way Two-lane road Fun Patch
    Post by: Commander Noddy 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 (https://youtu.be/V_ktD417nEM)
    Title: Re: One-way Two-lane road Fun Patch
    Post by: Ters on February 09, 2017, 04:52:25 PM
    If someone is about to stop, he should make it clear by blinking, but that is not possible in simutrans

    No, but Simutrans vehicles can read each other's "minds". How easy it is to make the correct decision even then is another matter.
    Title: Re: One-way Two-lane road Fun Patch
    Post by: Andyh on February 10, 2017, 06:47:32 PM
    I downloaded the patch yesterday and tested it. 


    I created one way roads the normal Simutrans way (using the 'no entry' signs) and tested the new functionality using a variety of scenarios involving different types of road, and a mix of citycars and player vehicles.  This definitely seems to be an improvement on the old overtaking functionality.  Overtaking happened more frequently and there were occasional instances of multiple overtakes (but not very often). 


    However, in most cases the scenarios eventually degenerated into slow moving queues of traffic in the right (slow) lane, with vehicles refusing to overtake one another.  Worse, when I set up a stop on a one way road, vehicles would soon refuse even to pass a stationary bus waiting at the stop, and a large queue of stationary traffic would result, even though the overtaking lane was completely empty. 


    My guess at what's happening is that at lower speeds vehicles are struggling to achieve the 5 kmph speed difference with a vehicle in front and therefore cannot start to overtake. 


    Here are some suggestions for improvement:


    1. Consider reducing the speed difference required to start overtaking to 1 or 2 kmph (the risk of two vehicles ending up at the same speed side by side, as mentioned in this thread, based on my observations, seems minimal)
    2. Consider changing the 'start overtaking' rule so that it compares the current speed of the vehicle in front with the theoretical maximum speed of the overtaking vehicle.  That's much more likely to result in a 5 kmph difference (and is much more realistic in my opinion)
    3. Consider making the required speed difference a percentage (say 5%) of one of the vehicle's speeds instead of a fixed value.  That would make it easier for vehicles to initiate overtaking at lower speeds.
    4. Consider relaxing the requirements for a vehicle to return to the right (slow) lane after overtaking.  Time and again I saw vehicles finish their overtaking maneuver too soon and get caught in a slow moving queue in the right lane.




    Title: Re: One-way Two-lane road Fun Patch
    Post by: jamespetts on February 10, 2017, 11:03:00 PM
    These seem to be very sensible ideas.
    Title: Re: One-way Two-lane road Fun Patch
    Post by: THLeaderH on February 11, 2017, 03:48:46 AM
    Thank you for your testing and suggestions, Andyh!
    I'm still working on solving the slow vehicle blocking issue. It is assumed that this takes a couple of more days to deal with, sorry :(
    I'm planning to release a new version of patch and executable binary in a few days.

    Quote
    However, in most cases the scenarios eventually degenerated into slow moving queues of traffic in the right (slow) lane, with vehicles refusing to overtake one another.
    In the current release of this patch, when vehicles on passing lane is blocked by another vehicle, the vehicle is forced to go back to traffic lane immediately. This is a bug of the current release. I'll fix it in the next release. (Actually this is already fixed in my code.)

    Quote
    1. Consider reducing the speed difference required to start overtaking to 1 or 2 kmph (the risk of two vehicles ending up at the same speed side by side, as mentioned in this thread, based on my observations, seems minimal)
    On congested roads (vehicle's speed is lower than a half of maximum theoretical speed), even speed difference == 0 is accepted to overtake. However, this condition does not seem to work efficiently. I'm still researching about this issue.

    Quote
    2. Consider changing the 'start overtaking' rule so that it compares the current speed of the vehicle in front with the theoretical maximum speed of the overtaking vehicle.  That's much more likely to result in a 5 kmph difference (and is much more realistic in my opinion)
    When road is filled with vehicles which have same maximum speed and there is traffic jam, moving to passing lane will not happen and passing lane will be  completely empty with the use of theoretical maximum speed in comparison. This is useless. Using current speed of vehicle in comparison is one of the essentials of this extension.

    Quote
    3. Consider making the required speed difference a percentage (say 5%) of one of the vehicle's speeds instead of a fixed value.  That would make it easier for vehicles to initiate overtaking at lower speeds.
    4. Consider relaxing the requirements for a vehicle to return to the right (slow) lane after overtaking.  Time and again I saw vehicles finish their overtaking maneuver too soon and get caught in a slow moving queue in the right lane.
    Thanks but I'll consider about these later, sorry.
    Title: Re: One-way Two-lane road Fun Patch
    Post by: Andyh on February 11, 2017, 04:36:05 AM
    Hi THLeaderH

    Thanks!  I'm looking forward to seeing the next release!

    I think you may have misunderstood my suggestion 2.  My idea is to compare the current speed of the vehicle in front with the max speed of the vehicle behind. Let's consider the following fact pattern:

    Vehicle in front
    Current speed    40
    Max speed.         100

    Vehicle behind (overtaking vehicle)
    Current speed   44
    Max speed        100

    Under your rule the difference is 4 kmph (44-40) therefore no overtaking is initiated .

    Under my suggestion the difference is 60 (100 - 40) therefore overtaking is initiated.

    I feel this is more realistic because in real life a driver will more likely consider his potential speed not his actual speed when starting to overtake




    Title: Re: One-way Two-lane road Fun Patch
    Post by: THLeaderH on February 11, 2017, 04:38:14 AM
    Oh I misunderstood your suggestion 2! Now I understand. Thanks ;)
    Title: Re: One-way Two-lane road Fun Patch
    Post by: Andyh on February 11, 2017, 04:45:52 AM
    Just an idea.  BTW: thank you so much for working on this.  The overtaking issue has been one of my Simutrans 'pet peeves' for the longest time!
    Title: Re: One-way Two-lane road Fun Patch
    Post by: DrSuperGood on February 11, 2017, 04:46:11 AM
    Quote
    Under my suggestion the difference is 60 (100 - 40) therefore overtaking is initiated.

    I feel this is more realistic because in real life a driver will more likely consider his potential speed not his actual speed when starting to overtake
    Problem is that the vehicle in front might keep accelerating and so reach 100 and the one behind could never overtake. One would have to purposely force the one in front to remain slow to allow for the overtake to happen successfully, which defeats the purpose of overtaking in the first place. In real life one should only overtake slow vehicles that are well below the speed limit.

    Overtaking cars at the speed limit is pointless as it will at most decrease journey time by the distance of vehicles overtaken divided by speed. Over a 15 minute journey this can end up being a matter of seconds, not at all worth the risk of head on collisions.
    Title: Re: One-way Two-lane road Fun Patch
    Post by: jamespetts on February 11, 2017, 11:22:05 AM
    Problem is that the vehicle in front might keep accelerating and so reach 100 and the one behind could never overtake. One would have to purposely force the one in front to remain slow to allow for the overtake to happen successfully, which defeats the purpose of overtaking in the first place. In real life one should only overtake slow vehicles that are well below the speed limit.

    The Highway Code does require drivers to give way to overtaking vehicles.
    Title: Re: One-way Two-lane road Fun Patch
    Post by: THLeaderH on February 11, 2017, 04:30:56 PM
    Quote
    I think simutrans cars know that they are being overtaken, so they can behave politely and not accelerate until the maneuver is finished
    In current release of standard simutrans, cars know that they are being overtaken. However, in this extension, cars don't know that for the complexity of calculation. In simutrans standard, cars are overtaken one by one, but in this patch, cars can be overtaken by more than one cars continually. So, I gave up to calculate whether cars are being overtaken or not. If it can be known that cars are being overtaken, not accelerate until the overtaking finished is very good idea, I think.

    By the way, please take a look at this video :)
    https://youtu.be/fBjXpdrWtO4 (https://youtu.be/fBjXpdrWtO4)
    White bus - 85km/h, Blue bus - 130km/h

    This is my answer for the "slow vehicle blocking problem". When a vehicle is on passing lane and there is a slower vehicle in front of it, the faster vehicle demands that the slower vehicle go to traffic lane. Then, the demanded vehicle asks the car on traffic lane to reduce speed 15km/h to make a room. You can see a bus on traffic lane reduces its speed and restore its speed after overtaking finished.

    I'm still working for the case that a faster vehicle is on traffic lane and is caught by slower vehicles.
    Title: Re: One-way Two-lane road Fun Patch
    Post by: Tjoeker on February 11, 2017, 10:49:56 PM
    first: thank you so much!  :) I've been waiting for this day for years now  :P

    but I think 15 km/h is a bit much...
    I think 5km/h or even 5% slower is better.
    You can see these slow overtakes quite regularly.
    When a truck is overtaking another truck, faster traffic is stuck behind the trucks for a while in real life as well..



    Something related (I know it has been suggested before, but I believe now is the right time to ask again?):
    the truck 'hitting' the back of the truck in front of him, decelerating to 0 km/h, accelerating again just to hit the truck in front of him again.. it's kind of sad to see.
    I think if a truck can't overtake the truck in front (at that moment) it should adjust its speed to the speed of the truck in front.

    Those two patches together would be really awesome :)
    Title: Re: One-way Two-lane road Fun Patch
    Post by: THLeaderH on February 11, 2017, 11:50:41 PM
    Quote
    but I think 15 km/h is a bit much...
    I think 5km/h or even 5% slower is better.
    You can see these slow overtakes quite regularly.
    When a truck is overtaking another truck, faster traffic is stuck behind the trucks for a while in real life as well..

    When I write this code, firstly I tested on 10km/h and it took too much time and distance in the simutrans map scale.
    I know slow overtakes happen regularly in real life, but I also think it is not appropriate in simutrans world that difference speed is only 5km/h or 10km/h. In my test, 15km/h seemed the most natural in simutrans. To realize smooth overtaking, it may too late to start yielding lane after a faster vehicle is stacked behind.

    Quote
    the truck 'hitting' the back of the truck in front of him, decelerating to 0 km/h, accelerating again just to hit the truck in front of him again.. it's kind of sad to see.
    I think if a truck can't overtake the truck in front (at that moment) it should adjust its speed to the speed of the truck in front.
    In current simutrans, a vehicle which is blocked by other vehicle will restart at the 3/4 of current speed. Speed changes suddenly and this may makes you see that the faster car decelerate to 0km/h and accelerate suddenly. Although this issue is not directory related to this overtaking extension, it is worth enough to solve with!
    Title: Re: One-way Two-lane road Fun Patch
    Post by: killwater on February 12, 2017, 12:24:05 AM
    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.
    So in theory it should be possible to fit two vehicles in one direction and two in the other direction on one tile? Then we would need a separate graphics for 2x2 road on one tile, different graphic shift for vehicles and to discard overhead collision check when overtaking on this type of road?
    Title: Re: One-way Two-lane road Fun Patch
    Post by: jamespetts on February 12, 2017, 12:31:32 AM
    I think that you may have misunderstood: I do not mean two vehicles heading in one direction side by side, but rather one in front of the other, as many vehicles occupy only a fraction of a tile's length, yet, at present, no vehicle may enter a tile in which another vehicle is present, even if the vehicle that is in the tile is occupying only a fraction of it.
    Title: Re: One-way Two-lane road Fun Patch
    Post by: THLeaderH on February 12, 2017, 05:51:31 AM
    Here is a new release of One-way Two-lane road patch!
    The patch file is attached as OTRP3.patch.
    For Windows: http://www.filedropper.com/simwinotrp3 (http://www.filedropper.com/simwinotrp3)
    For Mac: http://www.filedropper.com/simmacotrp3 (http://www.filedropper.com/simmacotrp3)

    In this release, I wrote a solution for the "slow vehicle blocking problem". Also I fixed the bug that vehicles are forced to go back to traffic lane when vehicles are on passing lane and blocked by slower vehicles.

    Please try and make a progress in the discussion!


    The following is just for my note.
    Code: [Select]
    Changed files
    simconvoi.cc
    simconvoi.h
    /vehicle/overtaker.h
    /vehicle/simvehicle.cc
    /vehicle/simvehicle.h
    /besch/weg_besch.h
    /besch/reader/way_reader.cc
    /besch/writer/way_writer.cc
    /boden/wege/weg.h
    diff command : diff -u -r sim_original sim_changed > OTRP3.patch
    patch command : patch -u -p1 -d simutrans-win < OTRP3.patch
    Title: Re: One-way Two-lane road Fun Patch
    Post by: killwater on February 12, 2017, 11:03:24 AM
    I think that you may have misunderstood: I do not mean two vehicles heading in one direction side by side, but rather one in front of the other, as many vehicles occupy only a fraction of a tile's length, yet, at present, no vehicle may enter a tile in which another vehicle is present, even if the vehicle that is in the tile is occupying only a fraction of it.
    Then how is it possible to overtake at all?
    Title: Re: One-way Two-lane road Fun Patch
    Post by: Ters on February 12, 2017, 11:47:03 AM
    Then how is it possible to overtake at all?

    It is possible to have two vehicles on the same tile, as long as it is only one in each lane. (I have heard of four vehicles side-by-side on a two-land road, but that was neither legal nor safe. And they were cars, and probably of the smaller kind, not trucks or buses. Simutrans is mostly about trucks and buses.)
    Title: Re: One-way Two-lane road Fun Patch
    Post by: jamespetts on February 12, 2017, 11:55:39 AM
    Then how is it possible to overtake at all?

    I was not referring specifically to overtaking in that context, but rather to other, related possible improvements to vehicle movement.
    Title: Re: One-way Two-lane road Fun Patch
    Post by: killwater on February 12, 2017, 08:38:58 PM
    Ahh that is a shame. I hoped it would be possible to scale down the dual carriageway roads to just one tile wide with only dumping the collision check during overtaking. They wreck the cities and are 2km wide in standard and 250m in experimental. In reality 25-35m. It would compare better to the size of rail infrastructure better as well.

    @THLeaderH
    Could you post a youtube video with the updated mechanics?
    Title: Re: One-way Two-lane road Fun Patch
    Post by: THLeaderH on February 12, 2017, 11:30:37 PM
    Quote
    @THLeaderH
    Could you post a youtube video with the updated mechanics?
    Won't this video do? (I posted this video in a past post.)
    https://youtu.be/fBjXpdrWtO4 (https://youtu.be/fBjXpdrWtO4)

    If you want a video which describes mechanics totally about this extension, I'll do. However, it takes a couple of days because of my schedule :(
    Title: Re: One-way Two-lane road Fun Patch
    Post by: killwater on February 13, 2017, 09:29:35 PM
    I meant one exactly like the one below, but with OTRP3.patch updates included. Maybe with some slower vehicles as well. If it is a lot of work then do not bother.
     
    Title: Re: One-way Two-lane road Fun Patch
    Post by: Tjoeker on February 13, 2017, 10:52:10 PM
    I've been experimenting a little with multiple platforms in a row.
    not that it's a big problem, but something we could think about..

    (http://i599.photobucket.com/albums/tt76/tjoeker/simscr11.png) (http://s599.photobucket.com/user/tjoeker/media/simscr11.png.html)

    The white bus arrived first.
    The grey van has its stop on the third platform. overtaking is no problem.
    But the red bus has to get to the second platform. (it can't overtake because its destination is only one tile ahead of the white bus?)

    Like I said, not a big deal. But if it would be possible to have fully functioning busstations shaped like this (http://www.stedenbeleid.vlaanderen.be/sites/default/files/Aalst%20Station%2005-2013_08%230B16.jpg), that would be really awesome
    Title: Re: One-way Two-lane road Fun Patch
    Post by: THLeaderH on February 14, 2017, 08:19:29 AM
    @killwater

    I made a video.
    https://youtu.be/T_6ne8iIal8 (https://youtu.be/T_6ne8iIal8)
    Title: Re: One-way Two-lane road Fun Patch
    Post by: Mr.Spissky on February 14, 2017, 12:24:53 PM
    Where do I find the files to replace?
    Title: Re: One-way Two-lane road Fun Patch
    Post by: THLeaderH on February 14, 2017, 02:08:33 PM
    @Mr.Spissky

    The code of this extension is distributed as patch file.
    The patch is attached to this message (http://forum.simutrans.com/index.php?topic=16659.msg159197#msg159197)
    Title: Re: One-way Two-lane road Fun Patch
    Post by: An_dz on February 14, 2017, 04:20:33 PM
    I made a video.
    https://youtu.be/T_6ne8iIal8 (https://youtu.be/T_6ne8iIal8)
    There are visible bugs in 0:17~0:27 and ~0:47 in the crossings. Cars on the left lane enter the right roads crossing over vehicles.

    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.
    Crazy, something that in Brazil is more logical than in other places. Here a yellow middle line is for dividing opposite traffic directions, while white is for same direction. It's the same for the neighbouring countries and Canada.
    Title: Re: One-way Two-lane road Fun Patch
    Post by: killwater on February 14, 2017, 11:06:18 PM
    Thanks. Comparing to your 【Simutrans】道路の追い越しの改善 video it looks mega awesome. Good work. I hope the patch will make it at least to the Experim... I mean to the Extended.
    Title: Re: One-way Two-lane road Fun Patch
    Post by: Andyh on February 15, 2017, 01:55:09 AM
    I tested the latest version of the patch last night.  Definitely better (...and way better than current functionality) but still a few issues:

    1. Still a problem with faster vehicles not initiating overtake of slow vehicles. This leads to queues of traffic building up in the right hand lane, even on one way roads.  On numerous occasions a high speed bus would get caught behind a horse and cart in the right hand lane of a one way road and would not overtake.  Traffic flow is improved by using the '80 kmph minimum speed' signs, but realistically you would think that a slower moving vehicle should be easier to overtake.
    2. Overtaking of stationary vehicles at a stop has improved a lot, but sometimes a queue of stationary traffic still forms behind a stopped vehicle.
    3. It appears to be a lot more difficult for a vehicle to initiate overtaking of a City car (especially a slow City car) than a player vehicle.  Is there something in the way City cars are coded that would make them more difficult to overtake?
    4. As noted by An_dz there are some graphical bugs.  To me they seemed to occur most frequently when a vehicle was returning to the right hand lane after overtaking.
    Title: Re: One-way Two-lane road Fun Patch
    Post by: THLeaderH on February 15, 2017, 06:24:51 AM
    Thank you for your helpful advices! I want to list up issues now I have.

    1. Simutrans was updated to 120.2. The current patch cannot be applied to the new version of simutrans standard since the structure of files changed. Although it seems that there is no relations between new features of 120.2 and this extension, codes themselves seems to have been changed because of changes from German to English. So, I cannot simply replaces files. Since generally simutrans version 12X.X.'0' have severe bugs in many cases, I want to wait until the latest stable version is confirmed as a really stable version. Then, I will move the base of this extension to the latest release, but it must take a long time.

    2.
    Quote
    Cars on the left lane enter the right roads crossing over vehicles.
    This is a bug and should be fixed. Vehicles entering road of the opposite side should check before crossing lane. I'm reading the code to search how to fix it.
    In fact, vehicles entering right roads should go back to the right lane before changing their direction and this should be guaranteed when the vehicles start overtaking. However, in this patch, vehicles do not know when they can go back to the right lane and to know this is impossible. So, I think the best way to prevent this collision is to check before crossing lane.

    3.
    Quote
    It appears to be a lot more difficult for a vehicle to initiate overtaking of a City car (especially a slow City car) than a player vehicle.  Is there something in the way City cars are coded that would make them more difficult to overtake?
    In fact, conditions to overtake city cars is not changed yet (still isidoro's condition) ! The new conditions for city cars should be written and I'm planning to do that, sorry.

    4.
    Quote
    Overtaking of stationary vehicles at a stop has improved a lot, but sometimes a queue of stationary traffic still forms behind a stopped vehicle.
    The cause of this is still in research. Maybe one of the causes is the condition of "safe space". This condition makes vehicles confirm that the opposite lane is empty for at least one tile in front and in rear when changing lane, but I think there is another and bigger cause of this problem.

    5. In my editing code, overtaking vehicles which have larger power is now prohibited. (same power is allowed.) This will reduce the blocking by slow vehicles without ruining the aim of this extension.

    One-way Two-lane road fun patch (OTRP) is still on development and there are so many things to be done so that this extension is integrated to simutrans standard or extended. I will continue writing the code until this patch is completed.
    Title: Re: One-way Two-lane road Fun Patch
    Post by: THLeaderH on February 15, 2017, 06:46:41 AM
    Sorry for posting in a row. I forgot to say about the biggest problem now I have.
    Please take a look at the video of this tweet. (https://twitter.com/teamhimeH/status/831677917146918913)

    Horizontal 4-lane road is no problem. On vertical 2-lane road, there are inappropriate overtaking when waiting for a red signal.

    As is in real road, conditions for overtaking is completely different between on 2-lane road and on 4-lane road. On 2-lane road, isidoro's stricter condition is suitable and on 4-lane road my relaxed condition is suitable. I think there is no way to distinguish whether the road is one-way or two-way without using any signs or signals. My conditions of overtaking do not work on two-way road, but conditions of current standard simutrans make (almost) empty lane on one-way road.

    As a solution, I want to use overtaking_info flag of roads. To keep compatibility, only strictly conditioned overtaking is allowed on existing road add-ons. Relaxed overtaking is allowed only on roads made newly as one-way roads. I'm writing a code to realize this.
    Title: Re: One-way Two-lane road Fun Patch
    Post by: Andyh on February 15, 2017, 08:21:24 AM


    3.In fact, conditions to overtake city cars is not changed yet (still isidoro's condition) ! The new conditions for city cars should be written and I'm planning to do that, sorry.




    Ah, that would explain a lot.  I had thought the new rule applied to both City cars and player vehicles.  Actually I think the new behavior is pretty good in the context of player vehicles alone, but I think the real boost in performance/realism will come if you were to extend to City cars too.
    Title: Re: One-way Two-lane road Fun Patch
    Post by: THLeaderH on February 16, 2017, 03:27:13 PM
    Here is a new release of One-way Two-lane road fun patch (OTRP).
    This time, I had a trouble in making a patch file. Diff command wrote all of the source files, not the differences! So, I distribute the source code as a zip file.

    I stopped using File Dropper and started using Google Drive, so you can download the files whenever you want!

    For Windows: https://drive.google.com/open?id=0B_rSte9xAhLDVGJOUk1lRTMwV3M (https://drive.google.com/open?id=0B_rSte9xAhLDVGJOUk1lRTMwV3M)
    For Mac: https://drive.google.com/open?id=0B_rSte9xAhLDekRHWGttMWUwM3M (https://drive.google.com/open?id=0B_rSte9xAhLDekRHWGttMWUwM3M)
    Source: https://drive.google.com/open?id=0B_rSte9xAhLDVWdWLWtpY09SOEU (https://drive.google.com/open?id=0B_rSte9xAhLDVWdWLWtpY09SOEU)

    Note: since this release, the base of this patch is simutrans 120.2.

    In this release, overtaking vehicles which have larger power is prohibited to reduce the blocking by slow vehicles.
    The main purpose of this release is upgrading the version of simutrans. There is no difference in the playing experience between OTPR3.
    Be sure that simutrans 120.1.3 cannot be used for patching.


    The following is just for my note.
    Quote
    Changed files
    simconvoi.cc
    simconvoi.h
    /vehicle/overtaker.h
    /vehicle/simvehicle.cc
    /vehicle/simvehicle.h
    /descriptor/way_desc.h
    /descriptor/reader/way_reader.cc
    /descriptor/writer/way_writer.cc
    /boden/wege/weg.h
    diff command : diff -u -r sim_original sim_changed > OTRP4.patch
    patch command : patch -u -p1 -d simutrans-win < OTRP4.patch
    Title: Re: One-way Two-lane road Fun Patch
    Post by: An_dz on February 16, 2017, 05:38:32 PM
    Use the latest trunk code from SVN. Most SVN clients have everything included, including patch creation. And it can almost always update your code automatically, and even when it can't it generally has a diff viewer that shows the conflicts. You can also use git if you prefer it. http://www.simutrans.com/develop/ for the SVN and Git addresses.

    You just need to tell your SVN client to download revision 8077 - which is version 120.0 (on git it's commit ea08f1e) - then you can replace the files safely and can update to the latest changes with little effort.

    It's also easier for the team to include the code, because you already removed all conflicts with the current code state.
    Title: Re: One-way Two-lane road Fun Patch
    Post by: killwater on February 16, 2017, 10:06:59 PM
    In this release, overtaking vehicles which have larger power is prohibited to reduce the blocking by slow vehicles.

    This sounds like a terrible idea. So a light fast bus will not be able to overtake a heavy lorry?
    Title: Re: One-way Two-lane road Fun Patch
    Post by: THLeaderH on February 17, 2017, 01:20:12 AM
    Quote
    This sounds like a terrible idea. So a light fast bus will not be able to overtake a heavy lorry?
    To say precisely, it's not the "power", but the "max_power_speed", that is the theoretical maximum speed calculated from its power and weight. So, in many cases, a light fast bus can overtake a heavy lorry.
    The effect of this condition is that vehicles which have higher max_power_speed, that means they can accelerate more quickly, have priority in overtaking under the situation that all vehicles have the same speed limit.

    Quote
    Use the latest trunk code from SVN.
    OK, I'll use the latest trunk code when releasing a new version :D
    Title: Re: One-way Two-lane road Fun Patch
    Post by: THLeaderH on February 21, 2017, 02:35:14 PM
    Here is a new release of One-way Two-lane fun patch, OTRP ver5.

    This time, the code patch is simutrans nightly r8112 based, so the patch can be easily integrated to the nightly trunk. However, I made the executable binaries and their base is 120.2 stable. This is just for stability because some users in Japan use this patch for playing purpose. Of course you can make a nightly based binary by compiling the nightly based patch.
    I also started sharing the git repository. https://github.com/teamhimeh/simutrans/tree/OTRP-S (https://github.com/teamhimeh/simutrans/tree/OTRP-S)

    The patch is attached to this post.
    All executable binaries are 120.2 stable based. If you need a nightly based one, please compile by yourself.
    :Simutrans:
    For Windows: https://drive.google.com/open?id=0B_rSte9xAhLDeDVJdnZKSFEzQnM (https://drive.google.com/open?id=0B_rSte9xAhLDeDVJdnZKSFEzQnM)
    For Mac: https://drive.google.com/file/d/0B_rSte9xAhLDd2JmYW84WGNWQ2s/view (https://drive.google.com/file/d/0B_rSte9xAhLDd2JmYW84WGNWQ2s/view)
    :makeobj:
    For Windows: https://drive.google.com/open?id=0B_rSte9xAhLDN3hmUHpQVTZLVEE (https://drive.google.com/open?id=0B_rSte9xAhLDN3hmUHpQVTZLVEE)
    For Mac: https://drive.google.com/file/d/0B_rSte9xAhLDRW51ei05NkUwTW8/view (https://drive.google.com/file/d/0B_rSte9xAhLDRW51ei05NkUwTW8/view)

    The biggest change is that overtaking by the relaxed condition is now available only on roads made for this patch! On conventional roads, only overtaking by the stricter condition is allowed. To enable one-way overtaking, add
    Code: [Select]
    overtaking_info=0to the .dat file.
    Note: Way add-ons made by the makeobj of this extension cannot be used for simutrans standard.
    Roads have a flag, overtaking_info, which indicates the condition of overtaking.

    0 = Condition for one-way road
    1 = Condition for two-way road (similar to the condition of current simutrans. This condition is automatically applied to conventional roads.)
    2 = Overtaking only a stopping vehicle is allowed.
    3 = Overtaking is completely forbidden.

    This change is needed to prevent the inappropriate overtaking I explained in a past post (http://forum.simutrans.com/index.php?topic=16659.msg159340#msg159340). Also, this is for compatibility with current simutrans standard. With only the pakset of simutrans standard, this release makes no difference between simutrans standard.

    The issue list of One-way Two-lane road patch
    • Following the latest code. (solved.)
    • Cars on the left lane enter the right roads crossing over vehicles. (will be solved in the next release.)
    • The new conditions for city cars should be written. (still in working.)
    • Sometimes a queue of stationary traffic still forms behind a stopped vehicle. (still in a research.)
    • On 2-lane road, there are inappropriate overtaking when waiting for a red signal. (solved.)
    • Traffic jam occurs due to lane crossing. (new!)

    In this release, I wrote a partial solution of the crossing over problem. As a result, traffic jam occurs due to lane crossing. (See fig1.jpg.) This is because vehicles do not consider their course when starting overtaking. In real road, drivers consider their course when they choose lane.
    Title: Re: One-way Two-lane road Fun Patch
    Post by: sheldon_cooper on February 21, 2017, 11:18:43 PM
    Hi, I do not know how to compile the patch file and make an exe. Ready to ride. It would be like making it available, just like you with simwin_OTRP3.??
    Thanks in advance for your attention and congratulations to the work.
     :)
    Title: Re: One-way Two-lane road Fun Patch
    Post by: THLeaderH on February 22, 2017, 12:42:38 AM
    @sheldon_cooper

    Welcome to One-way Two-lane road fun patch!

    If you are a Windows or Mac user, you don't have to compile the code to test it. Just download executable binaries from the URLs. Put sim.exe/sim into your simutrans folder. Don't forget to backup all of your pak and sve files before starting the test.
    To test the feature of this extension, roads made for this patch (The flag "overtaking_info" is contained.) are needed. To make them, use the makeobj provided from the URLs.

    If you are Linux or other OS user, you have to compile the code. First, download the r8112 simutrans nightly code and apply the patch to the code using patch command. Then, compile as usual.
    Title: Re: One-way Two-lane road Fun Patch
    Post by: sheldon_cooper on February 22, 2017, 02:49:49 AM
    I did what you mentioned, however is giving an error that I can not fix '' The program can not start because this missing libgcc_s_dw2-1.dll ''  ???
    What I wanted is that you already added sim.exe to download, just like you did here:

    Code: [Select]
    [quote author=THLeaderH link=topic=16659.msg159197#msg159197 date=1486878691]
    Here is a new release of One-way Two-lane road patch!
    The patch file is attached as OTRP3.patch.
    For Windows: [url=http://www.filedropper.com/simwinotrp3]http://www.filedropper.com/simwinotrp3[/url]
    For Mac: [url=http://www.filedropper.com/simmacotrp3]http://www.filedropper.com/simmacotrp3[/url]
    [/quote]
    I know it should give more work and for that I'm sorry, but I would be very grateful!
     :)
    Title: Re: One-way Two-lane road Fun Patch
    Post by: THLeaderH on February 22, 2017, 02:54:05 AM
    Please download libgcc_s_dw2-1.dll from here (https://ja.osdn.net/projects/sfnet_openmarias/downloads/libgcc_s_dw2-1.dll/). Then put the dll at the same directory with sim.exe.
    Generally, when you lack of dll files, you can solve it by putting dlls at the same directory with sim.exe.



    Hey, everyone. SOLUTIONS ARE WANTED!
    https://twitter.com/teamhimeH/status/834335248628359168 (https://twitter.com/teamhimeH/status/834335248628359168)
    Title: Re: One-way Two-lane road Fun Patch
    Post by: sheldon_cooper on February 22, 2017, 11:47:11 PM
    Now it's missing libstdc++-6.dll, where can I find this?
    Title: Re: One-way Two-lane road Fun Patch
    Post by: An_dz on February 23, 2017, 12:10:07 AM
    @THLeaderH
    I think you should recompile with static linking.
    Title: Re: One-way Two-lane road Fun Patch
    Post by: THLeaderH on February 23, 2017, 02:47:05 AM
    Sorry for your inconvenience.
    Dll files can be easily found by just googling. There are web sites which provide dll files one by one.

    Quote
    @THLeaderH
    I think you should recompile with static linking.

    Actually, I compiled with static linking with a configuration in default.in, but this time, I directly wrote
    Code: [Select]
    LDFLAGS += -static -static-libgcc -static-libstdc++into Makefile, and recompiled them.
    I uploaded a recompiled version for Windows. Please try and give me a report if it failed again!

    Simutrans:https://drive.google.com/open?id=0B_rSte9xAhLDeDVJdnZKSFEzQnM (https://drive.google.com/open?id=0B_rSte9xAhLDeDVJdnZKSFEzQnM)
    makeobj:https://drive.google.com/open?id=0B_rSte9xAhLDN3hmUHpQVTZLVEE (https://drive.google.com/open?id=0B_rSte9xAhLDN3hmUHpQVTZLVEE)
    Title: Re: One-way Two-lane road Fun Patch
    Post by: Andyh on February 23, 2017, 05:02:47 AM
    Question: Does the new version patch also apply to city cars or still just to player vehicles?

    Thanks

    Title: Re: One-way Two-lane road Fun Patch
    Post by: THLeaderH on February 23, 2017, 05:05:13 AM
    Quote
    Question: Does the new version patch also apply to city cars or still just to player vehicles?
    still just to player vehicles.
    Title: Re: One-way Two-lane road Fun Patch
    Post by: sheldon_cooper on February 24, 2017, 12:22:40 AM
    I am trying to compile, I do not know if this is correct because I do not understand anything about this subject, no more error appears, however, this appears this:  ???
    (https://s27.postimg.org/omciijhc3/simscr57.png) (https://postimg.org/image/aso5thoqn/)image hosting site (https://postimage.org/)
    Sorry for my doubts, as I said, I do not know how to sim.exe like you did. Thank you for your attention. :)
    Title: Re: One-way Two-lane road Fun Patch
    Post by: THLeaderH on February 24, 2017, 03:14:22 AM
    I think this is correct. Can't you make pak files?
    Title: Re: One-way Two-lane road Fun Patch
    Post by: prissi on February 24, 2017, 05:16:44 AM
    I still think this decision of one way or not needs to come from a wayobj, which at the same time also modifies the road to enforce single direction. Or a ned modified waybuilder, which only build one way ribis on one way roads. But that is probably even more hackisch.
    Title: Re: One-way Two-lane road Fun Patch
    Post by: An_dz on February 24, 2017, 05:57:55 PM
    That's a good idea, this way you don't need to duplicate graphics and gives liberty to use the way as the player wishes.
    Title: Re: One-way Two-lane road Fun Patch
    Post by: Yona-TYT on February 24, 2017, 07:17:58 PM
    I think this should be on "Larger Projects".
    Title: Re: One-way Two-lane road Fun Patch
    Post by: IgorEliezer on February 24, 2017, 09:52:42 PM
    I think this should be on "Larger Projects".
    Done. :)
    Title: Re: One-way Two-lane road Fun Patch
    Post by: THLeaderH on February 25, 2017, 02:16:36 AM
    Quote
    I still think this decision of one way or not needs to come from a wayobj, which at the same time also modifies the road to enforce single direction. Or a ned modified waybuilder, which only build one way ribis on one way roads. But that is probably even more hackisch.
    Dragging like electric wire on road to give one way ribis can be possible. However, I think some problems remains on this way.
    • Players cannot easily see whether the road has one way ribis or not. It is similar to railway signals without any images (completely transparent). If any images are given to one way ribis, it must look ugly. In my code, this difference can be easily seen as the difference of wayobj.
    • In my code, overtaking_info consists of four conditions. Giving ribis solution can only distinguish "One-way" or "Two-way". How can I give roads "Overtake only a loading convoi" or "Overtaking is completely forbidden" conditions?
    Title: Re: One-way Two-lane road Fun Patch
    Post by: Manche on February 25, 2017, 03:14:29 AM
    I think from THLeaderH's post on twitter, I write some idea here.

    1.way-object(ex electric overhead wire)
    I think expression method become narrow.
    way-obj is way-obj. should stop at scope of it. And I don't know how to become graphic is. like cursor on the road?

    2.way addon(ex dat file source)
    I think this is good. but players can't identify, two-lane or not.

    3.roadsign(ex one way sign)
    I think this is so good. two-lane sign is used for two-lane. players can understand 'yes, this is used for two-lane!'.
    if make two-lane roadsign combo with one-way sign, one click and make two-lane and one-way.
    simutrans is much easy to play, isn't it?
    Title: Re: One-way Two-lane road Fun Patch
    Post by: An_dz on February 25, 2017, 03:52:11 AM
    Dragging like electric wire on road to give one way ribis can be possible. However, I think some problems remains on this way.
    • Players cannot easily see whether the road has one way ribis or not. It is similar to railway signals without any images (completely transparent). If any images are given to one way ribis, it must look ugly. In my code, this difference can be easily seen as the difference of wayobj.
    • In my code, overtaking_info consists of four conditions. Giving ribis solution can only distinguish "One-way" or "Two-way". How can I give roads "Overtake only a loading convoi" or "Overtaking is completely forbidden" conditions?
    The ribi solution was one idea, the wayobj was another. You can either have both or only one or none.

    IHMO I like you solution where you don't use ribis, but the wayobj is a good idea. As I said above, this won't require duplicated graphics and will give more liberty to the player.

    Way-objs have the exact same number of images of a way so you can draw anything, like arrows on the ground. Or arrows only in the beginning and end. Or any other overlay you wish to give a visual hint.
    Title: Re: One-way Two-lane road Fun Patch
    Post by: Ters on February 25, 2017, 08:30:55 AM
    3.roadsign(ex one way sign)
    I think this is so good. two-lane sign is used for two-lane. players can understand 'yes, this is used for two-lane!'.
    if make two-lane roadsign combo with one-way sign, one click and make two-lane and one-way.
    simutrans is much easy to play, isn't it?

    Two major problems:
    • Signs only affect the tile they are on. Trying to extend the range of signs can easily become a mess as roads are built, removed and joined.
    • It would be nice to see if a road is one-way without having to find the single sign at the end, or having signs at every tile.
    Title: Re: One-way Two-lane road Fun Patch
    Post by: THLeaderH on February 25, 2017, 10:54:20 AM
    Here is a new release of One-way Two-lane fun patch, OTRP ver6.

    This time, the code patch is simutrans nightly r8117 based, and the patch can be easily integrated to the nightly trunk. Executable binaries are 120.2 stable based for stability - this is same as the previous release. Of course you can make a nightly based binary by compiling the nightly based patch.
    Source code can be seen on git. https://github.com/teamhimeh/simutrans/tree/OTRP-S (https://github.com/teamhimeh/simutrans/tree/OTRP-S)
    branch
    OTRP-S : working branch (120.2 based)
    master-S : nightly-based branch for making patch

    The patch is attached to this post.
    All executable binaries are 120.2 stable based. If you need a nightly based one, please compile by yourself.
    ~Executable Files~
    :Simutrans:
    For Windows: https://drive.google.com/open?id=0B_rSte9xAhLDTlcwV1lNU0dwcTQ (https://drive.google.com/open?id=0B_rSte9xAhLDTlcwV1lNU0dwcTQ)
    For Mac: https://drive.google.com/open?id=0B_rSte9xAhLDWlhOY1pqSHV2alE (https://drive.google.com/open?id=0B_rSte9xAhLDWlhOY1pqSHV2alE)
    :makeobj:(These are same as the previous version, ver5.)
    For Windows: https://drive.google.com/open?id=0B_rSte9xAhLDN3hmUHpQVTZLVEE (https://drive.google.com/open?id=0B_rSte9xAhLDN3hmUHpQVTZLVEE)
    For Mac: https://drive.google.com/file/d/0B_rSte9xAhLDRW51ei05NkUwTW8/view (https://drive.google.com/file/d/0B_rSte9xAhLDRW51ei05NkUwTW8/view)

    <Change List>
    • Traffic jam on lane crossing point was relaxed by changing tile entering control.
    • Vehicles which merge from the passing lane side will go on passing lane to reduce lane crossing. See https://twitter.com/teamhimeH/status/835354673699696641 (https://twitter.com/teamhimeH/status/835354673699696641)
    • The Condition of overtaking can be seen in the way information window.
    • Overtaking_info=4 was implemented. This condition prohibits going on traffic lane and forces to go on passing lane. I don't know why this condition is needed, but this is a request from Japanese simutrans players. According to them, this condition is required to make more realistic highway addon. See https://twitter.com/teamhimeH/status/835398973225488386 (https://twitter.com/teamhimeH/status/835398973225488386)
    There is no change in makeobj.

    The issue list of One-way Two-lane road patch
    • Following the latest code. (solved.)
    • Cars on the left lane enter the right roads crossing over vehicles. (will be solved in the next release. in research.)
    • The new conditions for city cars should be written. (still in working.)
    • Sometimes a queue of stationary traffic still forms behind a stopped vehicle. (still in a research.)
    • On 2-lane road, there are inappropriate overtaking when waiting for a red signal. (solved.)
    • Traffic jam occurs due to lane crossing. (not solved, but relaxed. still in working.)

    Any bug reports and ideas for improvement are welcome!
    Title: Re: One-way Two-lane road Fun Patch
    Post by: sheldon_cooper on February 25, 2017, 04:47:11 PM
    Does not the relaxed overtaking condition apply to conventional roads stop this patch?

    Title: Re: One-way Two-lane road Fun Patch
    Post by: An_dz on February 25, 2017, 05:01:16 PM
    The only problem I could think now about a way-obj for setting the overtaking rules would be the problem of trying to have a one-way road with electrification. You can only have one way-obj at the road.

    Does not the relaxed overtaking condition apply to conventional roads stop this patch?
    No, current road paks use the default stricter rules.
    Title: Re: One-way Two-lane road Fun Patch
    Post by: sheldon_cooper on February 25, 2017, 05:24:57 PM
    But in the OTRP3 patch the overtaking conditions were relaxed for convetional roads, now it seems more rigid.
    Title: Re: One-way Two-lane road Fun Patch
    Post by: An_dz on February 25, 2017, 08:50:46 PM
    Version 3 was a proof of concept to see how the relaxed overtaking can work. V4 has expanded to multiple possibilities and aligned to correct behaviour, so old saves and paksets can still work as they should.
    Title: Re: One-way Two-lane road Fun Patch
    Post by: isidoro on February 26, 2017, 12:46:00 PM
    After sleeping after a good session of mahjong (fun, but the winds weren't in favor), I came to an idea (you know that mind works better while sleeping, which is something that says much about human beings):

    If sometimes the problem is that an overtaking vehicle is stuck by an slower overtaking vehicle in front of it, the question is:
    Quote
    Can a overtaking vehicle overtake another overtaking vehicle?

    Of course that for this to work, the possibility of, say, four, six,... lane roads must exist.  And this is just perhaps killing for this patch.  But the point is, whatever the solution you choose to implement this, keep in mind to choose one that make things easier if this other patch is ever tried.

    Some ideas:
    • If you see the attached picture, one of the problem of multi-lane roads is diagonals.  Tiles B1, C2 and D3 in the picture.  All other configurations are already in the game.
    • Only two such configurations are needed to up and right and to up and left.  Now if you try to do something like that, those configurations are drawn as normal 4-way crossings.
    • The "overtaking status" must depend on the route of the vehicle, not on some properties attached to the specific road tile.  Overtaking_info=4 is a good example of a not so good idea to me.  The vehicles should see that they are going to make a transition and turn left and decide automatically to keep in the overtaking lane and not returning to the right lane for the moment.
    • The blue lines in tile B1 forces us to expand the status of overtaking in a certain tile: 0-not overtaking,  1-normal overtaking,  2-double overtaking,  3-triple overtaking.  When the blue is in state 2 in tile B1 and enters tile B2, it automatically changes to state 0.
    The aesthetic look of this patch is just amazing.  Just imagine what would it be to have multi-lane roads inside cities.
    Title: Re: One-way Two-lane road Fun Patch
    Post by: Yona-TYT on February 26, 2017, 02:32:48 PM
    With this patch is sought to improve diagonal pathways, it hurts that it is never completed.  :-[
    http://forum.simutrans.com/index.php?topic=14275.0
    Title: Re: One-way Two-lane road Fun Patch
    Post by: THLeaderH on February 26, 2017, 03:28:13 PM
    Isidoro's idea is a very important step to realize N-lane road. (N>=3)
    However, there is too many things to consider and interpret to realize multi-lane roads. My spring vacation of the university is till the end of March, which means I only have one month to complete this patch and have this integrated to simutrans standard or extended. From April, I'll be very busy and the patch will never be completed.
    N-lane roads is my dream. And I know that my code will do nothing when multi-lane roads are realized. But I concentrate on making two-lane roads come to simutrans. I want to make this project be at least "it is no problem to integrate to simutrans standard" by the end of this spring vacation.
    Title: Re: One-way Two-lane road Fun Patch
    Post by: thegamer7893 on February 26, 2017, 04:35:29 PM
    Does this patch work in the latest development version of Simutrans Extended? :)
    Title: Re: One-way Two-lane road Fun Patch
    Post by: jamespetts on February 26, 2017, 04:48:11 PM
    Somebody would have to incorporate it into the code - I do not know whether there would be any conflicts.
    Title: Re: One-way Two-lane road Fun Patch
    Post by: thegamer7893 on February 26, 2017, 05:57:20 PM
    Ok.
    Title: Re: One-way Two-lane road Fun Patch
    Post by: sheldon_cooper on February 27, 2017, 12:29:40 AM
    Version 3 was a proof of concept to see how the relaxed overtaking can work. V4 has expanded to multiple possibilities and aligned to correct behaviour, so old saves and paksets can still work as they should.

    I still use simwin_OTRP3 as a more useful way (at least for me) to use conventional roads and help with the locomotion of vehicles, especially in areas where there are more vehicles, as shown in this video:
    Title: Re: One-way Two-lane road Fun Patch
    Post by: THLeaderH on February 27, 2017, 01:37:08 AM
    Quote
    Somebody would have to incorporate it into the code - I do not know whether there would be any conflicts.
    Perhaps I would be able to solve the conflicts.

    Quote
    I still use simwin_OTRP3 as a more useful way (at least for me) to use conventional roads and help with the locomotion of vehicles, especially in areas where there are more vehicles, as shown in this video:
    Adding overtaking_info flag and prohibiting one-way overtaking on conventional roads were inevitable because V3 shows inappropriate overtaking at a crossing of two-way road with signal. Also, it was a solution to keep compatibility with current simutrans standard. Think, once you updated the version, and all vehicles start one-way overtaking. This must brake game balance and this can even brake save data.
    From V5, you can enjoy one-way overtaking just by re-paking road addons. On re-paked roads, vehicles behave same as in V3, no, better than in V3.
    Title: Re: One-way Two-lane road Fun Patch
    Post by: sheldon_cooper on February 27, 2017, 04:24:42 AM
    '' Re-paked roads '' what would it be ?? Are specific roads only for this type of overtaking shown in the video above?
    Title: Re: One-way Two-lane road Fun Patch
    Post by: jamespetts on February 27, 2017, 01:30:44 PM
    Perhaps I would be able to solve the conflicts.

    If you would be interested in integrating your patch into Simutrans-Extended, that would be most worthwhile. I have been watching this topic with some interest, but have been too busy with other things (i.e. finishing rescaling the 'buses and after that fixing bugs) to do anything substantive about it at this stage, and I imagined that it might well be integrated into Standard before long so that I could add it when I merge from Standard in the usual way (these days, manually).
    Title: Re: One-way Two-lane road Fun Patch
    Post by: THLeaderH on March 01, 2017, 01:56:50 PM
    Here is a new release of One-way Two-lane fun patch, OTRP ver7.
    This time, the code patch is simutrans nightly r8125 based, and the patch can be easily integrated to the nightly trunk. Executable binaries are 120.2.1 stable based for stability - base version was upgraded. Of course you can make a nightly based binary by compiling the nightly based patch.
    Source code can be seen on git. https://github.com/teamhimeh/simutrans/tree/OTRP (https://github.com/teamhimeh/simutrans/tree/OTRP)
    branch
    OTRP : working branch (120.2.1 based)
    master-S : nightly-based branch for making patch

    The patch is attached to this post.
    All executable binaries are 120.2.1 stable based. If you need a nightly based one, please compile by yourself.
    ~Executable Files~
    :Simutrans:
    For Windows: https://drive.google.com/open?id=0B_rSte9xAhLDSnFKUHpub21vcDg (https://drive.google.com/open?id=0B_rSte9xAhLDSnFKUHpub21vcDg)
    For Mac: https://drive.google.com/open?id=0B_rSte9xAhLDOURHcHZBQUxjUVU (https://drive.google.com/open?id=0B_rSte9xAhLDOURHcHZBQUxjUVU)
    :makeobj:(These are same as ver5.)
    For Windows: https://drive.google.com/open?id=0B_rSte9xAhLDN3hmUHpQVTZLVEE (https://drive.google.com/open?id=0B_rSte9xAhLDN3hmUHpQVTZLVEE)
    For Mac: https://drive.google.com/file/d/0B_rSte9xAhLDRW51ei05NkUwTW8/view (https://drive.google.com/file/d/0B_rSte9xAhLDRW51ei05NkUwTW8/view)

    <Change List>
    • The base of this patch is now upgraded to 120.2.1.
    • "lane fix sign" was implemented as a extension of single_way sign. This helps to reduce congestion caused by lane crossing.
    • WARNING: OTRP7 finally lost compatibility of sve data with the standard. sve of standard can be read on this patch, but sve of this patch cannot be read on simutrans standard.
    There is no change in makeobj.

    The issue list of One-way Two-lane road patch
    • Cars on the left lane enter the right roads crossing over vehicles. (mostly solved but not perfect.)
    • The new conditions for city cars should be written. (still in working.)
    • Sometimes a queue of stationary traffic still forms behind a stopped vehicle. (still in a research.)
    • Traffic jam occurs due to lane crossing. (relaxed better. Automatic lane yielding is to be implemented.)
    Also I found and fixed a bug which prevents vehicles from overtaking citycars, but it is not clear this will solve problems with citycars.

    Any bug reports and ideas for improvement are welcome!
    Title: Re: One-way Two-lane road Fun Patch
    Post by: Andyh on March 02, 2017, 06:21:08 AM
    Hi THLeaderH - I would like to test v6 of the patch but if I understand correctly the new overtaking conditions only apply to roads that are flagged as 'one-way'; regular two way roads continue to use the old overtaking rules.  If that's the case it's not going to be possible to test the patch with any of the standard pak sets as they contain no 'one way' roads since all legacy roads are by default two way.    Am I correct?  Perhaps you could share, for testing purposes, a pak file for a road with the flag set to 'one way'?  I think more people would be prepared to test the patch if there was a ready made add-on to help them do that.
    Title: Re: One-way Two-lane road Fun Patch
    Post by: prissi on March 02, 2017, 07:29:28 AM
    I can do a wayobj integration, but in that case please stop adding features. Patching and testing needs some time.

    Also the citycars certainly needs to know about the new conditions too.
    Title: Re: One-way Two-lane road Fun Patch
    Post by: Andyh on March 02, 2017, 05:01:11 PM

    Also the citycars certainly needs to know about the new conditions too.

    I agree with Prissi.  Based on what I observed, a lot of the bugs with the patch are a direct consequence of the new overtaking conditions not applying to Citycars.  Fix that gap and I believe a lot of the other problems will go away or be substantially reduced.
    Title: Re: One-way Two-lane road Fun Patch
    Post by: THLeaderH on March 03, 2017, 02:04:34 AM
    Quote
    if I understand correctly the new overtaking conditions only apply to roads that are flagged as 'one-way'; regular two way roads continue to use the old overtaking rules.  If that's the case it's not going to be possible to test the patch with any of the standard pak sets as they contain no 'one way' roads since all legacy roads are by default two way.    Am I correct?
    Yes. You are all correct  ;)

    Quote
    Also the citycars certainly needs to know about the new conditions too.
    Writing conditions for citycars is just now in progress. This takes some time because the routing algorithm of citycars is quite different from that of road vehicles. In next release, this patch will work correctly with citycars!

    Quote
    Perhaps you could share, for testing purposes, a pak file for a road with the flag set to 'one way'?  I think more people would be prepared to test the patch if there was a ready made add-on to help them do that.
    Quote
    I can do a wayobj integration, but in that case please stop adding features. Patching and testing needs some time.
    To answer to these comments, I have to introduce SIS road project.
    SIS, which means Systematic Infrastructure Standard, road project is a project which brings more realistic roads to reproduce various scenes in simutrans. The original aim of this patch is to reproduce highway system using SIS road addons, and that is still same now. I modified the dat files of SIS road addons and am using for testing. So, I want to share the modified SIS road for testing purpose but that needs a permission by the copyright holders. I'm contacting them but it takes some time to distribute. If you know road addons that is suitable for one-way road and that can be re-distributed, please tell me. I'll modify the dat file and share with you.
    This project has very strong connection with SIS road project. I once thought that wayobj should have "overtaking_info" flag. However, wayobj is used as sidewalls. Please take a look at 1.jpg and 2.jpg. These are wayobj. If wayobj had overtaking_info flag, we would have to cut sidewalls at the point where the overtaking rule changes. Wayobj is wayobj, should not be used as a marker of overtaking conditions. A new object like wayobj but specified to overtaking_info flag should be provided to realize flexibility of conditions and avoid re-paking way objects. However, this would be a huge work so I'll think about this again after I finish writing conditions for citycars.

    SIS road project can be seen from http://seesaawiki.jp/sis_simutrans/d/SIS%20Road (http://seesaawiki.jp/sis_simutrans/d/SIS%20Road), but they are all in Japanese. You can download various addons from this page.
    Title: Re: One-way Two-lane road Fun Patch
    Post by: Andyh on March 03, 2017, 06:33:23 AM
    Maybe I wasn't looking in the right place, but I couldn't find any roads on the SIS page mentioned above which had overtaking flag set to one way.  So I just made a simple road myself with a one way flag and the makeobj provided in this thread.   When I tested v6 of the patch with this road, player vehicle behavior was very good, including overtaking of stationery vehicles; however, as expected citycar behavior was not right.  Player vehicles do not appear to overtake citycars in any circumstances.  Citycars, if fast enough, will overtake player vehicles but will not move into the overtaking lane (i.e. rather disconcertingly, they go straight 'through' the player vehicle).
    Title: Re: One-way Two-lane road Fun Patch
    Post by: THLeaderH on March 03, 2017, 07:18:02 AM
    Quote
    Maybe I wasn't looking in the right place, but I couldn't find any roads on the SIS page mentioned above which had overtaking flag set to one way
    SIS project itself doesn't provide one-way flagged roads, sorry.



    I made roads with overtaking_info flag by modifying SIS roads and I got permission to distribute.
    You can download from here. (https://drive.google.com/open?id=0B_rSte9xAhLDOFlfUk9hc3BFcmc)
    SIS_ExpressWay_road_ds.pak is the addon. This can be used only for testing purpose.

    The road of...
    999 km/h maximum : overtaking_info = 0
    80 km/h maximum : overtaking_info = 3
    100 km/h maximum : overtaking_info = 2
    120 km/h maximum : overtaking_info = 4
    Title: Re: One-way Two-lane road Fun Patch
    Post by: jamespetts on March 03, 2017, 11:51:46 AM
    To answer your question of suitable roads to use for testing purposes, Pak128.Britain is open source. The Github repository is here (https://github.com/aburch/simutrans-pak128.britain) for the Standard version, and here (https://github.com/jamespetts/simutrans-pak128.britain) for the Extended version.
    Title: Re: One-way Two-lane road Fun Patch
    Post by: sheldon_cooper on March 04, 2017, 03:32:53 AM
    The patch is running on one-way roads, but why the patch can not run on specific convetional roads?
    Specifies such as:
    (https://s15.postimg.org/6a0ew7xpn/EXE.png) (https://postimg.org/image/5khmjux5z/)img host (https://postimage.org/)

    1=Dual roads, yellow or white track continues in the middle of the track.
    2=Road single hand ''freeway and avenue''
    3=two-way road with solid yellow stripe in the middle of the road
    So we have example 1 and 3, as roads that the patch would not work. And example 2, of convetional roads that the patch could run (in addition to the SIS one-way)
    The idea is that the patch can work on convetional roads with less speed, (50, 60, and 70 km / h) in the city, like an avenue.Well, it's just a suggestion, thank you very much for the attention! :D


    Title: Re: One-way Two-lane road Fun Patch
    Post by: THLeaderH on March 04, 2017, 04:32:08 AM
    Quote
    why the patch can not run on specific conventional roads?
    Do you mean "vehicles cannot overtake on specific conventional roads without flagging?"

    As I explained before, all conventional roads without flagging are interpreted as two-way roads. If you can see overtaking on conventional roads, that is because overtaking happens under the conditions for two-way roads. Be sure that marking by single way road signs does not affect on overtaking conditions.



    <Development information>
    Writing conditions for citycars is now in progress, but it was revealed that this work is huge and quite difficult. I think this takes at least one week :(
    Title: Re: One-way Two-lane road Fun Patch
    Post by: prissi on March 04, 2017, 11:31:51 AM
    A one way marker wayobj that visually indicates the direction is unfourtunately also a little more complex, since it would two directional graphics per tile. Not that other wayobj could not profit from that (it could solve some caternary on wrong side problems), but that will also need some more time to make it properly.
    Title: Re: One-way Two-lane road Fun Patch
    Post by: Tjoeker on March 04, 2017, 01:53:01 PM
    I have a question:

    How would growing cities handle these streets?

    Currently cities 'destroy' highways as they grow. (unless you build elevated ways)

    I'd like this:
    Cities don't have permission to destroy highways, nor build ramps/connect to these highways.
    on the other hand, cities can't build houses along these highways and existing buildings would be destroyed over time unless they are connected to another road.
    The downside is that it would create another border for the city to cross (like railways and rivers).

    (probably another patch: )
    and would cities be able to build one way streets/avenues?
    This seems a bit unachievable to me, but sure it would be a cool gimmick. :p

    edit:
    I don't like a visual indicator on every tile to show direction.
    How about an auto-included sign to show direction at every T- or +-crossing?
    Title: Re: One-way Two-lane road Fun Patch
    Post by: An_dz on March 04, 2017, 02:06:57 PM
    A one way marker wayobj that visually indicates the direction is unfourtunately also a little more complex, since it would two directional graphics per tile. Not that other wayobj could not profit from that (it could solve some caternary on wrong side problems), but that will also need some more time to make it properly.
    Still it seems the best solution.

    Using way-obj prevents you from having an electrified track + one-way overtaking. There would have a need to duplicate way-objs to have both overtaking-only & overtaking+electric. The same would apply to eye-candy wayobj.

    Using roads allows electrified tracks or eye-candy wayobj, but it has lot of drawbacks:
    - The implementation has to be ported to bridges, tunnels and elevated ways. A lot of work and terrible for the user to build. With wayobj it's simple.
    - The pakset needs to duplicate all roads for the multiple possibilities. pak128 already has 17 roads/bridges/etc. If you only want to add the "one-way" overtaking you already double to 34. It's overwhelming.

    Currently cities 'destroy' highways as they grow. (unless you build elevated ways)
    But they don't destroy way_objects ;)
    Title: Re: One-way Two-lane road Fun Patch
    Post by: Tjoeker on March 04, 2017, 02:14:04 PM
    But they don't destroy way_objects ;)

    But they still connect to the highway whenever they want to? ;)
    Still, your idea was a big game changer to me :p

    edit: I tested this, but the city still reduces the speed from 130+ to 50km/h..

    (Sorry, if this gets a bit offtopic, maybe these posts belong in the extension request forum..)
    Title: Re: One-way Two-lane road Fun Patch
    Post by: An_dz on March 04, 2017, 02:37:42 PM
    But they still connect to the highway whenever they want to? ;)
    Still, your idea was a big game changer to me :p

    edit: I tested this, but the city still reduces the speed from 130+ to 50km/h..
    Of course, but they keep being electrified or oneway according to the sings. That was my point of creating a new way-obj.

    (Sorry, if this gets a bit offtopic, maybe these posts belong in the extension request forum..)
    Yes.
    Title: Re: One-way Two-lane road Fun Patch
    Post by: prissi on March 05, 2017, 12:11:09 AM
    Electrification and overtaking do not mix on real life too. I still have to see a trolley box overtaking another trolley bus ...
    Title: Re: One-way Two-lane road Fun Patch
    Post by: jamespetts on March 05, 2017, 12:20:40 AM
    Electrification and overtaking do not mix on real life too. I still have to see a trolley box overtaking another trolley bus ...

    A trolleybus can, of course, overtake a non-electric vehicle.
    Title: Re: One-way Two-lane road Fun Patch
    Post by: THLeaderH on March 05, 2017, 12:47:40 AM
    Some players in Japan reported that network games disconnected very frequently when using this patch. I didn't change the code which is directly related to network games, so I don't know what the cause is. I have to research and fix this problem.
    Generally, what is the main reason for disconnecting of network games?
    Title: Re: One-way Two-lane road Fun Patch
    Post by: sheldon_cooper on March 05, 2017, 02:44:48 AM

    As I explained before, all conventional roads without flagging are interpreted as two-way roads.
    I think I lost this information, ???
    Then does this signaling allow the normal operation of the patch by applying over the convivial roads? What is this signaling?
    Are plates for single hand of roads?
    Title: Re: One-way Two-lane road Fun Patch
    Post by: jamespetts on March 05, 2017, 11:22:36 AM
    Generally, what is the main reason for disconnecting of network games?

    Simutrans uses lockstep networking. That means that the server and each client must remain exactly in sync with one another and do precisely the same things at precisely the same (game) time when running on different computers.

    Desyncs can be caused by not saving data (so that the clients end up with a different game state to the server on loading) or functions with an indeterminate outcome (so that the client and server have a different outcome from a single function). To handle synchronising randomness, the random number generator's seed is sent by the server to all of the clients, so that, when calling simrand(), the "random" number is identical on the server and all the clients. Make sure to use this rather than sim_async_rand() anywhere where it matters vis a vis the game state.

    This sort of problem is, I am afraid, one of the hardest sorts of problems to fix.
    Title: Re: One-way Two-lane road Fun Patch
    Post by: Ters on March 05, 2017, 02:45:04 PM
    A trolleybus can, of course, overtake a non-electric vehicle.

    Not if overtaking causes it to lose power. This can be because the poles are not flexible or long enough or the other vehicle is so tall that it gets in the way of the poles, and the poles can not be disconnected at speed or the trolleybus doesn't have a good enough battery.
    Title: Re: One-way Two-lane road Fun Patch
    Post by: prissi on March 05, 2017, 03:14:49 PM
    If the cars change into overtaking in random order, than that my be the cause. With this new patch, depending on subtle differences in timing, one car or the other may block the second lane or not. That will cause different arrivial times etc. It might have not been a issue so far, since the overtaking was seldom.

    Having said that, I have watched maps with overtaking also as a network and there were no desyncs.

    However, maybe the overtaking state is not saved as complete as it needs to be. Then, upon joining the local save-reload and the server save-reload in the second client would be different.
    Title: Re: One-way Two-lane road Fun Patch
    Post by: jamespetts on March 05, 2017, 04:40:46 PM
    Not if overtaking causes it to lose power. This can be because the poles are not flexible or long enough or the other vehicle is so tall that it gets in the way of the poles, and the poles can not be disconnected at speed or the trolleybus doesn't have a good enough battery.

    It was quite normal for trolleybuses to overtake vehicles such as vans when trolleybuses were commonplace.
    Title: Re: One-way Two-lane road Fun Patch
    Post by: Vladki on March 05, 2017, 06:27:55 PM
    Here in Brno trolleybuses are still common. They normally overtake only stationary or very slow vehicles (bikes). The poles are long enough, but it does not make sense to overtake anything else.Trolleybuses operate in the city so 50 km/h limit applies to them, and they stop often. Also they often have to slow down at crossroads where the trolleybus lines split, or cross with tram line. At terminal stops they sometimes overtake each other - one has to stop and disconnect the poles while the other is overtaking
    Title: Re: One-way Two-lane road Fun Patch
    Post by: An_dz on March 06, 2017, 01:48:07 AM
    Electrification and overtaking do not mix on real life too. I still have to see a trolley box overtaking another trolley bus ...
    A trolleybus can, of course, overtake a non-electric vehicle.
    Who said about trolleybuses? Obviously they don't overtake fast vehicles. I'm talking about non-electric cars. A non-electric car can overtake trolleybuses and other vehicles. Just like a tram can go on a one-way road but is fixed on a track (it can't choose lanes) the same applies to trolleybuses. The bus will stay in the left lane, but other vehicles will be able to use the other lane to overtake.
    Title: Re: One-way Two-lane road Fun Patch
    Post by: THLeaderH on March 10, 2017, 12:29:18 PM
    Here is a new release of One-way Two-lane fun patch, OTRP ver8.
    This time, the code patch is simutrans nightly r8128 based, and the patch can be easily integrated to the nightly trunk. Executable binaries are 120.2.1 stable based for stability as usual. Of course you can make a nightly based binary by compiling the nightly based patch.
    Source code can be seen on git. https://github.com/teamhimeh/simutrans/tree/OTRP (https://github.com/teamhimeh/simutrans/tree/OTRP)

    The patch file became so big that it cannot be attached to the message. So, I uploaded the patch file to Google Drive. You can download it from here. (https://drive.google.com/open?id=0B_rSte9xAhLDQzNzNm10dEItQmM)
    All executable binaries are 120.2.1 stable based. If you need a nightly based one, please compile by yourself.
    ~Executable Files~
    :Simutrans:
    For Windows: https://drive.google.com/open?id=0B_rSte9xAhLDazNFUTR3NXVWUWs (https://drive.google.com/open?id=0B_rSte9xAhLDazNFUTR3NXVWUWs)
    For Mac: https://drive.google.com/open?id=0B_rSte9xAhLDbVN5cUZuajl1Qnc (https://drive.google.com/open?id=0B_rSte9xAhLDbVN5cUZuajl1Qnc)
    :makeobj:(These are same as ver5.)
    For Windows: https://drive.google.com/open?id=0B_rSte9xAhLDN3hmUHpQVTZLVEE (https://drive.google.com/open?id=0B_rSte9xAhLDN3hmUHpQVTZLVEE)
    For Mac: https://drive.google.com/file/d/0B_rSte9xAhLDRW51ei05NkUwTW8/view (https://drive.google.com/file/d/0B_rSte9xAhLDRW51ei05NkUwTW8/view)
    ~Sample road addon with overtaking_info~
    Download from here (testing purpose only) (https://drive.google.com/open?id=0B_rSte9xAhLDOFlfUk9hc3BFcmc)

    <Change List>
    • Overtaking conditions for citycars were finally written! Now buses can overtake citycars, and citycars can overtake other vehicles. There are so many things to be considered to apply the conditions to citycars, so this may contain some minor bugs. Since routing system greatly differs, processing of citycars' overtaking is not same as that of road vehicle.
    • <For Mac> AVFoundation is used to play midi and wav instead of QTKit. Current Mac cannot build sources with QTKit, so I integrated this patch (http://forum.simutrans.com/index.php?topic=16675.0). It works fine.
    There is no change in makeobj.

    Note: This is the last release of 120.2.1 stable based binaries because renaming of variables are rapidly proceeding in the development trunk. I have to keep up with the latest code.

    The issue list of One-way Two-lane road patch
    • The new conditions for city cars should be written. (Done, but some bugs might been contained.)
    • Traffic jam occurs due to lane crossing. (Automatic lane yielding is to be implemented.)
    • Cars on the left lane enter the right roads crossing over vehicles. (mostly solved but not perfect.)
    • Marking overtaking_info by dragging a new kind of object. (Maybe this should be implemented after wayobj 255 project is done.)

    Although the code is not perfect and some features are yet to be implemented, I think this version has enough features and enough stability to be integrated to simutrans standard. I want to set this version as the candidate for integration. Of course I'm willing to fix bugs and add new features if necessary.

    Any bug reports and ideas for improvement are welcome!
    Title: Re: One-way Two-lane road Fun Patch
    Post by: jamespetts on March 10, 2017, 12:33:32 PM
    Splendid! Were you able to fix the network desync issue?
    Title: Re: One-way Two-lane road Fun Patch
    Post by: THLeaderH on March 10, 2017, 12:35:24 PM
    I think the cause of the network desync issue was forgetting initializing a variable, and I fixed it. However, it is not clear whether this issue was completely solved because I haven't tested it yet.
    Title: Re: One-way Two-lane road Fun Patch
    Post by: killwater on March 10, 2017, 03:59:41 PM
    Awesome. Can we get a nice youtube video as before but with city cars?

    (https://s-media-cache-ak0.pinimg.com/564x/79/39/a1/7939a15c9d7df2b075d91c65ecf49775.jpg)
    Title: Re: One-way Two-lane road Fun Patch
    Post by: THLeaderH on March 11, 2017, 11:35:43 AM
    A demo video with citycars was uploaded  ;D

    Also, I made another video which explains how to use OTRP!
    Title: Re: One-way Two-lane road Fun Patch
    Post by: killwater on March 11, 2017, 06:07:05 PM
    Wow. Excellent job. That is a huge step forward for Simutrans. Thanks.
    Title: Re: One-way Two-lane road Fun Patch
    Post by: Isaac.Eiland-Hall on March 12, 2017, 12:10:52 AM
    This really is fantastic. My only complaint is that everyone's driving on the wrong side of the road! (I'm kidding, of course)

    Although seriously - it's amusing to see cars merging from the middle of the highway and crossing lanes to go to the outer lane. hehe

    I really do hope this makes it into Simutrans. I've been hoping for true freeways like this for more than a decade!
    Title: Re: One-way Two-lane road Fun Patch
    Post by: jamespetts on March 12, 2017, 12:39:11 AM
    This does look to be a splendid project.
    Title: Re: One-way Two-lane road Fun Patch
    Post by: THLeaderH on March 12, 2017, 12:43:17 AM
    Thanks :)  Then... who has permission of integration?
    Title: Re: One-way Two-lane road Fun Patch
    Post by: Yona-TYT on March 12, 2017, 04:35:49 AM
    Thanks :)  Then... who has permission of integration?

    Great project!  :thumbsup: :thumbsup:
    We wait for the approval of the great prissi.  ;D
    Title: Re: One-way Two-lane road Fun Patch
    Post by: thegamer7893 on March 12, 2017, 11:29:12 AM
    Will this be available for Simutrans Extended, James?
    Title: Re: One-way Two-lane road Fun Patch
    Post by: jamespetts on March 12, 2017, 11:53:10 AM
    Will this be available for Simutrans Extended, James?

    Please see above (http://forum.simutrans.com/index.php?topic=16659.msg159911#msg159911).
    Title: Re: One-way Two-lane road Fun Patch
    Post by: prissi on March 12, 2017, 09:36:18 PM
    I will review the code; but I am currently on the last few day during move houses (for a family of five to another continent). So no quick action before the end of the month, sorry.
    Title: Re: One-way Two-lane road Fun Patch
    Post by: jamespetts on March 13, 2017, 12:25:36 AM
    I will review the code; but I am currently on the last few day during move houses (for a family of five to another continent). So no quick action before the end of the month, sorry.

    Goodness, that sounds like hard work. Very best wishes for that!
    Title: Re: One-way Two-lane road Fun Patch
    Post by: THLeaderH on March 13, 2017, 01:50:05 AM
    Quote
    I will review the code; but I am currently on the last few day during move houses (for a family of five to another continent). So no quick action before the end of the month, sorry.
    So I have to do refactoring before Prissi reviews my code because Ver8 code is so dirty...
    Actually this project was my first time of modifying a big software :-[
    Is there anything to do as a reviewee?
    Title: Re: One-way Two-lane road Fun Patch
    Post by: Andyh on March 13, 2017, 03:38:43 PM
    Thank you THLeaderH!  I tested this in a number of different scenarios over the weekend.  It really works very well.  Both player vehicles and city cars behave as expected and very realistically.  I'll leave it to smarter people than me to comment on the code, but from a functionality perspective I would definitely support immediate integration into Simutrans standard.
    Title: Re: One-way Two-lane road Fun Patch
    Post by: THLeaderH on March 19, 2017, 11:35:59 AM
    I uploaded a minor update, OTRP ver8.1, on Google Drive. See from here. (https://drive.google.com/open?id=0B_rSte9xAhLDdTFKN2RDWVFZbUU)
    This time, the code patch is simutrans nightly r8141 based, and the patch can be easily integrated to the nightly trunk. Source code can be seen on git. https://github.com/teamhimeh/simutrans/tree/OTRP (https://github.com/teamhimeh/simutrans/tree/OTRP)

    The aim of this update is adaptation for the latest nightly code, fixing code style, and fixing a minor bug. In ver8, vehicles sometimes fail to avoid head-on crash and block the street. I don't make executable binaries this time.

    This version, ver8.1, can read settings.xml and sve data of standard, but cannot read these of past OTRPs. I think this is because there were changes in rdwr methods between r8128 ~ r8141 and that causes conflict. However, I couldn't find the exact reason. Is there any changes in rdwr methods between r8128 ~ r8141?
    Title: Re: One-way Two-lane road Fun Patch
    Post by: An_dz on March 19, 2017, 01:46:25 PM
    Yes, the 16 bit colour patch. r8134
    Title: Re: One-way Two-lane road Fun Patch
    Post by: Commander Noddy on March 20, 2017, 12:40:05 PM
    The mod is good:) However, when I test it when the patch v8, my bus (set by human player) can't overpass the citycar (default citycar). The bus has already changed into the faster lane. However, the bus suddenly stop and then it can't overpass the citycar until it left the highway. I want to know what is the problem, thanks:)
    Title: Re: One-way Two-lane road Fun Patch
    Post by: THLeaderH on March 21, 2017, 12:35:45 PM
    Quote
    The mod is good:) However, when I test it when the patch v8, my bus (set by human player) can't overpass the citycar (default citycar). The bus has already changed into the faster lane. However, the bus suddenly stop and then it can't overpass the citycar until it left the highway. I want to know what is the problem, thanks:)
    I can't reproduce the problem. Could you share a video or sve data with the pakset?
    Title: Re: One-way Two-lane road Fun Patch
    Post by: THLeaderH on March 25, 2017, 12:02:21 PM
    Here is a new release of One-way Two-lane fun patch, OTRP ver9.
    This time, the code patch is simutrans nightly r8151 based, and the patch can be easily integrated to the nightly trunk. Executable binaries are nightly r8128 based for a reason - I'll explain it later. Of course you can make a latest nightly based binary by compiling the nightly based patch.
    Source code can be seen on git. https://github.com/teamhimeh/simutrans/tree/OTRP (https://github.com/teamhimeh/simutrans/tree/OTRP)

    patch:https://drive.google.com/open?id=0B_rSte9xAhLDb1M3U1F5aVk1Zzg (https://drive.google.com/open?id=0B_rSte9xAhLDb1M3U1F5aVk1Zzg)
    ~Executable Files~
    :Simutrans:
    win:https://drive.google.com/open?id=0B_rSte9xAhLDMFVMZ1d2R2Y5SEE (https://drive.google.com/open?id=0B_rSte9xAhLDMFVMZ1d2R2Y5SEE)
    mac:https://drive.google.com/open?id=0B_rSte9xAhLDM291R3pUYWpHdkE (https://drive.google.com/open?id=0B_rSte9xAhLDM291R3pUYWpHdkE)
    :makeobj: (new version!)
    win:https://drive.google.com/open?id=0B_rSte9xAhLDWkhZMTRlQWhrX0E (https://drive.google.com/open?id=0B_rSte9xAhLDWkhZMTRlQWhrX0E)
    mac:https://drive.google.com/open?id=0B_rSte9xAhLDR2pNbkZYVl90WG8 (https://drive.google.com/open?id=0B_rSte9xAhLDR2pNbkZYVl90WG8)

    I uploaded r8128 based binaries because r8151 based binaries cannot load sve data of previous versions of OTRP. This is because r8151 integrated color patch. r8151 based binaries can load data of simutrans standard stable version and r8151 based binaries.

    Since this version, way-obj also has overtaking_info flag. You can rewrite the condition for overtaking by building way-obj with overtaking_info.
    I also integrated decoration way patch (http://forum.simutrans.com/index.php?topic=16824). Overtaking condition can be re-written by wayobj-road and wayobj-255. If both wayobj has the flag that changes overtaking_info, wayobj-255 has priority.
    This feature enables you to enjoy one-way overtaking on conventional roads! You can use conventional road's wayobj by using wayobj-255.

    Making wayobj with overtaking_info is easy. Just add
    Code: [Select]
    overtaking_info=0to the dat file. If you write
    Code: [Select]
    overtaking_info=-1the wayobj does not change overtaking_info.

    To make wayobj-255, set waytype like this.
    Code: [Select]
    waytype=decoration
    own_waytype=decoration

    Sample road addon with overtaking_info can be downloaded from here (https://drive.google.com/open?id=0B_rSte9xAhLDOFlfUk9hc3BFcmc). Also, sample wayobj-255 with overtaking_info can be downloaded from here (https://drive.google.com/open?id=0B_rSte9xAhLDLWRQcUVXUzNtbE0).

    To use wayobj-255, you need to add wayobj(255) in the menuconf.tab so they show in any or some of the menus. For examle, add
    Code: [Select]
    toolbar[6][12]=wayobjs(255)in the menuconf.tab of the pakset.

    I uploaded a demo video on twitter. This video shows that you can rewrite overtaking condition and use one-way overtaking on the conventional road.
    https://twitter.com/himeshi_hob/status/845469009571069952 (https://twitter.com/himeshi_hob/status/845469009571069952)

    Any bug reports and ideas for improvement are welcome!
    Title: Re: One-way Two-lane road Fun Patch
    Post by: An_dz on March 25, 2017, 08:47:57 PM
    Adding other patches will only make your patch worse to be checked, and you'll only create more work when the patch is committed and it creates conflicts.
    Title: Re: One-way Two-lane road Fun Patch
    Post by: THLeaderH on March 26, 2017, 01:14:18 AM
    Quote
    Adding other patches will only make your patch worse to be checked, and you'll only create more work when the patch is committed and it creates conflicts.
    Of course I know that. Adding other patches should be avoided but it was inevitable this time.
    When I firstly thought about the condition changer, I came up with implementing a completely new object, named road-marker. However, it resulted in completely failure because of its complexity. So, I decided to use way-obj as a condition marker.
    However, I had to preserve the role of wayobj of road. I had to implement other kind of wayobj that can be build on road, otherwise it does a huge bad impact on SIS project. Decoration-way patch is the ideal solution for this. Though I can make a new kind of waytype, not any_wt, for wayobj, it will make the conflict worse.
    Perhaps I should have waited until deco_way patch is integrated, but I don't know when the integration is done. So, I decided to integrate the patch to this project. I have to apologize for making a cause of conflict.

    I think solving this conflict is not so hard. When deco patch is integrated, I'm willing to solve the conflict, of course :)
    Title: Re: One-way Two-lane road Fun Patch
    Post by: THLeaderH on March 29, 2017, 04:43:33 AM
    Note: The candidate for integration is still ver8, because ver9 makes a terrible conflict with deco_way patch.
    After the completion of deco_way patch, some lines will be added to weg.h and OTRP should be completed.
    Title: Re: One-way Two-lane road Fun Patch
    Post by: An_dz on March 29, 2017, 11:06:41 PM
    Once I commit the deco_way we can create another wayobj for this patch that should clean up a lot the code, and it will also allow to create a couple wayobjs to be used on any road with any speed.

    Hum, I really need to test the speed limit for both the deco_way and this new one.
    Title: Re: One-way Two-lane road Fun Patch
    Post by: Dwachs on April 03, 2017, 06:24:24 AM
    Why would you need new object and way types for the overtaking patch?

    My idea would be to use a new type of sign, similar to one-way sign: It marks everything behind as one-way and allows for overtaking. Of course, then the book-keeping is much more complicated.
    Title: Re: One-way Two-lane road Fun Patch
    Post by: prissi on April 03, 2017, 08:36:26 AM
    A single way (directional) wayobj would be very useful for other purposes, like sidewalls, catenaries on the correct side etc. beyond marking just roads. So I think it is worth the effort, even if it requires twice the pictures.
    Title: Re: One-way Two-lane road Fun Patch
    Post by: THLeaderH on April 03, 2017, 12:28:24 PM
    Please consider city roads. In city limits, city roads are automatically paved and unexpected intersections might appear. If overtaking conditions are controlled by the signs, players always have to check intersections which were made by automatically paved cityroads. Also, there can be cars which have different overtaking conditions on same road since the overtaking condition depends on its route.
    Title: Re: One-way Two-lane road Fun Patch
    Post by: Isaac.Eiland-Hall on April 05, 2017, 08:55:15 AM
    Maybe one can hope for a way of marking roads as not being able to be connected to or taken over by cities? In the US, freeways do often go through the hearts (or very very near to the hearts) of cities :)

    I would imagine such marked roads would be seen by the city as something like tracks, i.e. not useful for building; left completely alone - like elevated ways. :)
    Title: Re: One-way Two-lane road Fun Patch
    Post by: killwater on April 08, 2017, 09:41:28 AM
    Any news on this awesome patch integration?
    Title: Re: One-way Two-lane road Fun Patch
    Post by: THLeaderH on April 09, 2017, 12:28:01 AM
    We're all waiting for this (http://forum.simutrans.com/index.php?topic=16659.msg160924#msg160924)
    Title: Re: One-way Two-lane road Fun Patch
    Post by: An_dz on April 09, 2017, 09:28:35 PM
    I've been very busy, lot of stuff happening, but I'm working on it. Hopefully I'll finish it today.
    Title: Re: One-way Two-lane road Fun Patch
    Post by: An_dz on April 11, 2017, 04:40:21 AM
    I've been testing this and noticed that the vehicles lose the overtake info at some points.

    The whole way is set to use the passing lane only (British like), but all buses move for a second to the right lane at the curve at the top. The two green buses though only have this on the north road near the tram way. And the two-piece bus does not have this problem.

    (http://i.imgur.com/onJS4wS.gif)
    Title: Re: One-way Two-lane road Fun Patch
    Post by: An_dz on April 17, 2017, 02:48:07 PM
    Me and THLeaderH are starting to work together in the patch, I already added the new waytype and cleaned some pollution that the code had.

    We believe that only wayobjs should have the overtake flags, this will make things much simpler code-wise, dat-wise and user-wise. We will follow this path, but if anyone disagrees you can voice your opinion. I know that some roads will require the wayobj to be built to visually work but this makes things more consistent as the user knows that all roads will be always built as two-way roads.
    Title: Re: One-way Two-lane road Fun Patch
    Post by: jamespetts on April 17, 2017, 03:02:50 PM
    I am not sure that I fully understand the utility of using wayobj for this rather than having this as a parameter of roads: can you elaborate?
    Title: Re: One-way Two-lane road Fun Patch
    Post by: An_dz on April 17, 2017, 04:30:43 PM
    The advantage are that you give more liberty to the user, make it easier to build and reduce the amount of images.

    As I said in a previous post that's buried in this thread, you just need to take into account pak128.

    pak128 has 9 roads, if you only think that the pak128 team decide to only offer both two-way and one-way versions for each road, you already end up with 18 roads, if you wish to add all OTRP possibilities, which are 5, pak128 will have 45 roads. And I'm not including bridges, tunnels and elevated ways, this blows to 150 objects.

    With a wayobj you just need to create 4 wayobjs (one-way, no-overtaking, overtake stopped only, inverse two-way) and the user will be able to change the overtaking rule of any road and not be restricted to those that only the paksets maintainers added support. And it's much easier to build as you are able to change the overtaking rule of a whole road, even if has tunnels, bridges and elevated ways.
    Title: Re: One-way Two-lane road Fun Patch
    Post by: jamespetts on April 17, 2017, 04:58:21 PM
    Ahh, I see.
    Title: Re: One-way Two-lane road Fun Patch
    Post by: Leartin on April 17, 2017, 05:38:54 PM
    A few more ideas (expansions, if you so will)

    First, one should probably be able to build these new 'wayobj' over each other without requiring control (and the according patch), but simply by building it. Thus the user would be truly able to change overtaking rules on the fly.

    Second, I propose a fifth wayobj that normalizes behaviour. Thus, you don't need to use a seperate removal tool, which would work kinda odd (e.g. you already have a one-way road with an intersection. The intersection is not a one-way tile. Thus, deleting the one-way by clicking the ends would not work, since it's seperated. However, building a "normalizing" obj over it would work.)

    Third, directional graphics - if they get implemented for the new object, I'd love to see them for ways and normal wayobj as well, even if they have no functionality except for graphical representation.

    Fourth - what if a way could specify one of these 4 (5) wayobjs, and get buildt with that? You would keep the customization aspect, but at the same time, road graphics could be made with a specific behaviour in mind. For example, an asymetric Autobahn with breakdown lane and noise protection wall to one side would automatically be buildt as a one-way road, while staying customizable for the player to do what he wants.

    Fifth - and now we are in wishful thinking territory - what if the graphic of a way could be changed based on which wayobj is buildt on it? Again, use the Autobahn. If you had an asymmetric Autobahn as described in my fourth suggestion, it would always look rather silly if cars would move both directions on it. So instead, you'd have an additional graphic for Autobahn that uses both directions, with wall and perhaps breakdown lane on both sides. Or you have a wayobj with both no-overtaking and one-way, which means only one lane would be used. The Autobahn could change appearence to be a thinner Autobahn ramp instead.
    Or take the "Bundesstraße" in p192c - it has posts on both sides, with red and white indicators. But if you suddenly go british, those don't make any sense anymore and would need to switch sides. If you forbid overtaking, you could change a broken line in the middle of a road to a solid line. If no specific graphic exists, the basic one is used - much like vehicle loading graphics.

    All in all, making the graphics of a road sensitive to which wayobj is buildt on it would mean that you can have pretty much all benefits from using wayobj AND all benefits you'd have from actually creating those 45 or more roads ;)
    Title: Re: One-way Two-lane road Fun Patch
    Post by: An_dz on April 18, 2017, 01:04:23 AM
    First, one should probably be able to build these new 'wayobj' over each other without requiring control (and the according patch), but simply by building it. Thus the user would be truly able to change overtaking rules on the fly.
    Yes, good idea, maybe we should expand to decoration wayobj.

    Second, I propose a fifth wayobj that normalizes behaviour.
    It can already be done, it's either 0 or 1. Can't remember now

    Fourth - what if a way could specify one of these 4 (5) wayobjs, and get buildt with that? You would keep the customization aspect, but at the same time, road graphics could be made with a specific behaviour in mind. For example, an asymetric Autobahn with breakdown lane and noise protection wall to one side would automatically be buildt as a one-way road, while staying customizable for the player to do what he wants.
    I thought about this. But I think we first need to create the directional wayobj. This can be created as a future patch after integration.

    Fifth - and now we are in wishful thinking territory - what if the graphic of a way could be changed based on which wayobj is buildt on it?
    Can't you just draw the wayobj to paint over those and change them? That's why I thought about wayobjs in the first place, because they can overwrite graphics.
    Title: Re: One-way Two-lane road Fun Patch
    Post by: TurfIt on April 18, 2017, 02:30:51 AM
    I've not been able to spend enough time looking at this, and no time in foreseeable future, so initial thoughts re trunk commitment.

    1) Is it finished? Seems to have TODOs stating things are not appropriate, etc.

    2) Naming.
      overtaking_info - seems more like modes, or flags, definitely not info.
      is_info_changer() - huh?
      lane_fix - are the lanes broken... force, or pinning maybe.
      vehicle_base_t::left_driving - why? settings_t::drive_on_left is source, no need to copy it.

    3) Stowaways? 
      Mac core-audio files - if this is the posted patch to update them, it's missing a replacement for volume control, hence not committed.
      Hajo name corruption.
      /opt/local/... ?  <png.h> is correct, not some local mangling...

    4) Road trains - taking into account the position of trailers (tractor+3 trailers allowed currently) before changing lanes?

    5) Performance - totally unfair test on map with 5000+ busses and overtaking_info forced to 0 for patch even though most roads were actually 2 way. Game becomes unresponsive - need much work here to handle larger maps. More fair testing not really possible yet as no large maps created with this patch already in place exist.

    ---
    As a 'Fun' patch - great, for trunk - wrong approach IMO.
    The intent appears to be to allow travel in multiple lanes in the same direction on one way roads, yet the code mangles up the existing the overtaking on two way road logic to do so. The vehicle movement logic is borderline unmaintainable now, one-way two-lane logic needs to be separate.

    I would suggest implementation of one-way roads as separate waytypes. The construction tools would need an update to handle building and GUI to display the directionality.
    The existing overtaking logic, is_way_free, and no_cars_blocking would remain untouched and used for two-way waytypes. The one-way waytype would have its own vehicle movement code.
    On one-way roads, forbid construction of trams (that would also free up the center position for 3 lane highways in paks with small vehicle graphics), and rail crossings to simplify logic. And no need to consider oncoming traffic.
    In the interim, I'd suggest freeway style only - hence forbid intersections with any roads except a special entry/exit ramp to join the freeway with regular roads. The logic to handle multilane road intersections is beyond daunting with the current way_free and no_cars_blocking routines - requires an overhaul (implementation of previously discussed [>5 years ago?] intersection_t object to traffic cop the flow through the intersection).

    I think that would provide a more flexible and code maintainable one-way roads design.

    ---
    On the wayobj as overtaking_info flagger - adding yet more objects to tiles is not performance friendly at all. Vehicles wading through all the objects in their current movement logic is quite time consuming. Again - wrong approach IMHO.
    Title: Re: One-way Two-lane road Fun Patch
    Post by: Leartin on April 18, 2017, 06:27:14 AM
    Can't you just draw the wayobj to paint over those and change them? That's why I thought about wayobjs in the first place, because they can overwrite graphics.

    Kind of, but not really. For that to work, I'd need to use a barebone Autobahn with no railing, and create directional wayobj specifically for the Autobahn - which I would not want to be used with a dirt road, since a dirt road with an asphalt breakdown lane is kinda silly - I'd need something with a wooden fence or something similar. So I end up with incomplete, barebone roads and tons of wayobj, which I wouldn't want to be combined with the wrong road.
    With this setup, it seems to me the best a pakset creator could do is completely break the system:
    - get rid of all electrified road vehicles
    - make all other road vehicles require electrification
    - have only one "base road" that's pretty much a placeholder, with a speed limit of 999km/h
    - use way-objects for the actual road graphics, complete with actual speed limit and electrification tag.
    Vehicles can't use the placeholder road, they require the way object to work, because of electrification. So essentially, I'd break the system you propose with directional wayobjects instead of directional ways by using wayobjects as ways. Nice to have a system flexible enough to allow such atrocities. Though it makes one wonder if it really is such a good idea to use wayobjects.

    And perhaps the most silly problem (unless there was a change I'm not aware of) - wayobj don't have seasons, not even snow graphics. Even something as simple as a solid middle line for "no_overtaking" becomes a pain, since you would need to make sure all roads are snow-free where the line would be in winter, since otherwise the snow is painted.



    Here is another suggestion:
    Scrap wayobjects and add those flags to the roads.
    Add tools to change the flags in the roads once buildt.
    Add support for multiple road graphics in one road for different occassions, but no requirement.
    Add a "direction overlay", which visualizes the flags used in each tile (like the reserved route overlay for tracks)

    IIRC, ways already store their max-speed on each tile in case you start the game without that way, so it would be replaced with something of similar speed, and to keep network games stable. But if the speed is stored in the tile, it would be possible to alter that value in the tile and have the same way, but with a different speed. The same should be true for overtaking flags, they would need to be stored just like the max speed anyway, in case you start the game without the wayobj/road that was used, so it could be replaced by something of similar properties instead of being lost.
    Instead, just replace the road based on speed, but keep the flag-bits. And use the same flag-bits plus a "direction bit" for one-way to change the appearence of the road, if there are alternate graphics.


    This pretty much allows for all the advantages using wayobj would give you, plus more - even if the wayobj/tool that would allow you to get a one-way road is removed, the behaviour of the roads already buildt would not change, and you would probably be more performant by scraping an extra object and all it's overhead. But that's said by someone who is too dumb to get Simutrans to even compile, so what do I know...
    Title: Re: One-way Two-lane road Fun Patch
    Post by: THLeaderH on April 18, 2017, 02:36:47 PM
    Quote
    We believe that only wayobjs should have the overtake flags, this will make things much simpler code-wise, dat-wise and user-wise.
    Quote
    Fourth - what if a way could specify one of these 4 (5) wayobjs, and get buildt with that? You would keep the customization aspect, but at the same time, road graphics could be made with a specific behaviour in mind. For example, an asymetric Autobahn with breakdown lane and noise protection wall to one side would automatically be buildt as a one-way road, while staying customizable for the player to do what he wants.
    I think that only ways and wayobjs of overtake_wt should have the overtake flags. I mean wayobjs of road_wt or decoration_way should not have the flags. The flags of ways are used as the default condition, and the condition of overtaking can be customized by building wayobjs of overtake_wt. If ways don't have the flags, we have to build the wayobjs every time we build highway with specified roads and that would be silly.

    Quote
    1) Is it finished?
    I once thought that this project was completed when I released OTRP v8. However, it was revealed that there is a lot of things to be done. Thus, I have to say this project is not finished.

    Quote
    2) Naming.
    I'm not familiar to the naming style of simutrans yet. We have to fix inappropriate naming in the code.

    Quote
    Mac core-audio files - if this is the posted patch to update them, it's missing a replacement for volume control, hence not committed.
      Hajo name corruption.
      /opt/local/... ?  <png.h> is correct, not some local mangling...
    These code pollution is partly fixed by An_dz and we have to continue removing the pollution. Code pollution is caused by my lack of skills.

    Quote
    4) Road trains - taking into account the position of trailers (tractor+3 trailers allowed currently) before changing lanes?
    Road trains are taken into account in the overtaking process. Is there any problem with road trains?

    Quote
    The intent appears to be to allow travel in multiple lanes in the same direction on one way roads, yet the code mangles up the existing the overtaking on two way road logic to do so. The vehicle movement logic is borderline unmaintainable now, one-way two-lane logic needs to be separate.
    Actually it needs careful investigation whether separating the movement logic produces no problems.

    I'm currently busy and I'll answer to the rest of suggestions tomorrow.
    Title: Re: One-way Two-lane road Fun Patch
    Post by: prissi on April 19, 2017, 01:25:35 AM
    Well, I think with a wayobj enabling overtaking, the combination with directional road may not be neccessary. Just leave the decision whether this is oneway or twoway to the builder by using signs. The overtaking wayobj could be then just a guardrail.
    Title: Re: One-way Two-lane road Fun Patch
    Post by: killwater on April 28, 2017, 03:18:50 PM
    Is this patch abandoned? Please don't be abandoned...
    Title: Re: One-way Two-lane road Fun Patch
    Post by: THLeaderH on April 29, 2017, 02:34:48 AM
    Still I don't have enough time to engage in this patch but I want to start with the naming issue.
    Since I'm not a native English speaker, I'd like to get your advice about naming.
    • overtaking_info (a variable which holds the condition for overtaking) -> overtaking_condition
    • is_info_changer (a method which tells whether the way_obj overwrites the condition which is set by way.) -> does_overwrite_overtaking_condition
    • lane_fix (a variable which holds the information whether the vehicle keeps running certain lane.) -> lane_pinning

    How do you think about these?
    Title: Re: One-way Two-lane road Fun Patch
    Post by: Andyh on May 25, 2017, 05:07:46 PM
    Have there been any developments as to this patch?  Would be a huge disappointment if this could not be implemented.  The patch worked great in test; is it not essentially ready for integration?  What else still needs to be done?
    Title: Re: One-way Two-lane road Fun Patch
    Post by: killwater on May 25, 2017, 07:34:30 PM
    I support this motion.
    Title: Re: One-way Two-lane road Fun Patch
    Post by: THLeaderH on May 26, 2017, 04:43:53 AM
    The development still continues but it's speed is quite slow since I'm so busy now. The latest commits can be always seen in https://github.com/teamhimeh/simutrans/tree/OTRP (https://github.com/teamhimeh/simutrans/tree/OTRP).
    In a functional perspective, OTRP reached its completion in ver9. However, there is still a lot of issues to be integrated.
    • Only overtake_wt wayobj should change overtaking_mode.
    • The name of variables should be fixed as mentioned before.
    • Confirmation that this patch doesn't have any bad effects on performance and stability is required. Without that, the dev team won't do the integration.
    I'd be very glad if you carry out the performance and stability test! Prepare a large map and put a lot of vehicles. Compare the performance and stability between the patch and the standard under the appropriate condition. And report here. The test should be done with gdb if you can, and please submit the error log of gdb when this patch crashes. Telling me the method to cause any crashes is also very welcome. With your cooperation, the integration of this patch may come earlier ;)
    Title: Re: One-way Two-lane road Fun Patch
    Post by: killwater on May 27, 2017, 08:08:45 AM
    Could it be integrated into Extended nightly builds? I think there are quite a few people playing fresh commits at any time so that would be best way to test it.
    Title: Re: One-way Two-lane road Fun Patch
    Post by: jamespetts on May 27, 2017, 11:56:30 AM
    Could it be integrated into Extended nightly builds? I think there are quite a few people playing fresh commits at any time so that would be best way to test it.

    THLeaderH is more than welcome to try to integrate it into Extended, but, since the codebases diverge somewhat, there may be significant numbers of merge conflicts (which I do not currently have time to resolve as this is not a priority compared to other things on which I am working, but THLeaderH might or might not be inclined to try if he would like this to be integrated into Extended sooner rather than later). It would have to be tested on its own branch of Extended to see that it works and does not cause crashes, anomalous behaviour or network desyncs in multi-player mode before being integrated into the master branch, although this preliminary testing need not be exhaustive as players using the feature might be left to find the less critical, more obscure bugs.

    I should note, however, that, if this were to be a feature primarily on Extended, my own preference is for the property of a one way road being a property of the way rather than a separate way object: that would make it far easier for players to use (no need to drag a separate tool on the way to make it one way), far easier for players to understand (why should one have to drag a separate thing which has no physical presence over a road to make it one way?), and easier to balance (a motorway would then not be able to be used in single carriageway format as is possible now, thus restricting single carriageway roads to a lower speed limit). It would also prevent the somewhat absurd restriction of not being able to have trolley wires or tram wires on one way roads.
    Title: Re: One-way Two-lane road Fun Patch
    Post by: Leartin on May 27, 2017, 04:25:59 PM
    my own preference is for the property of a one way road being a property of the way rather than a separate way object

    How feasable would it be for the property to be part of the way, but saved on each tile, much like speed limit. Therefore, a way could come with it's own property, but it could be changed with seperate tools (much like citys can change the speed limit) - I know I suggested that before, but I did not get any feedback on whether that's even possible.
    Title: Re: One-way Two-lane road Fun Patch
    Post by: Andyh on May 27, 2017, 04:27:50 PM
    I've nothing against the one way flag being attached to a way object, but if it's strictly an either/or I would favor attaching it to the way for the reasons given by jamespetts
    Title: Re: One-way Two-lane road Fun Patch
    Post by: Ters on May 27, 2017, 05:29:04 PM
    I must say I've lost track of what is being implemented, as well as the pros and cons of the various suggested approaches.
    Title: Re: One-way Two-lane road Fun Patch
    Post by: An_dz on May 29, 2017, 09:39:41 PM
    On ways

    Pros:
    • Less objects for the engine to take care of
      might give better performance and/or cause less problems
    • User can build one-way roads right away
      no need to later add the one-way wayboj

    Cons:
    • User is restricted on which roads are one-way
      only those the pakset offers or the user creates - bad for closed source objects or those who don't like to fiddle with maekobj
    • Multiple duplicated tools
      if the pakset wants to offer one road both as one-way and two-way it has to duplicate the road, the tunnel, the bridge and the elevated road
    • More images loaded/duplicated
      because of the above

    On wayobjs

    Pros:
    • All roads can be made one-way
      one wayobj and it changes all and any roads
    • Less images loaded/duplicated
      because of the above
    • Wayobjs can be dragged across a whole road no matter if there are bridges, elevated ways or tunnels along it
      allows to change the one-way flag with a single tool

    Cons:
    • More objects in a single tile
      can reduce performance and/or cause problems or be against some programming ideal
    • User needs to place another object after building the road
      the user needs to build the wayobj to transform the road as one-way after it has been built

    Anyway, last time I tried this I ended up in some problems, This was one of them (https://forum.simutrans.com/index.php?topic=16659.msg161555#msg161555). The others was in case I've built a one-way road but allowed cars entrance from both sides, cars could get stuck. They could also get stuck if I made part of a road become "British lane" and cars came from both sides, it would work for a while, cars would change lanes and move nicely, but eventually they would get stuck as well.
    Title: Re: One-way Two-lane road Fun Patch
    Post by: THLeaderH on May 30, 2017, 09:14:41 AM
    I think both way and overtake_wt wayobj should be able to have overtaking_mode. If overtake_wt wayobj exists, simutrans uses the flag of wayobj. Without wayobj, it uses the flag of way. Wayobj has priority. This enables user to build one-way roads without adding one-way wayobj. Also, overtaking_mode of all roads can be easily changed by building overtake_wt wayobj. The pakset does not have to offer duplicated roads.

    However, there is one problem. When simutrans cannot find required the way add-ons while loading a saved game, it uses default roads defined in simuconf.tab. If ways has the one-way flag, we have to set default roads for all kinds of overtaking_mode to replace missing roads correctly. I cannot find the solution for this problem. ??? Should I abolish the one way flag of way to solve this issue? Or should I ignore the overtaking_mode flag when replacing the missing roads?

    Quote
    Anyway, last time I tried this I ended up in some problems, This was one of them. The others was in case I've built a one-way road but allowed cars entrance from both sides, cars could get stuck. They could also get stuck if I made part of a road become "British lane" and cars came from both sides, it would work for a while, cars would change lanes and move nicely, but eventually they would get stuck as well.
    I have to deal with these issues later. In fact, one way flags ought to restrict the direction but this requires some modifications on wayobj.
    Title: Re: One-way Two-lane road Fun Patch
    Post by: jamespetts on May 30, 2017, 10:34:17 AM
    I think both way and overtake_wt wayobj should be able to have overtaking_mode. If overtake_wt wayobj exists, simutrans uses the flag of wayobj. Without wayobj, it uses the flag of way. Wayobj has priority. This enables user to build one-way roads without adding one-way wayobj. Also, overtaking_mode of all roads can be easily changed by building overtake_wt wayobj. The pakset does not have to offer duplicated roads.

    This seems to be a sensible solution, which would allow pakset authors and/or users to define their preferred behaviour.

    Quote
    However, there is one problem. When simutrans cannot find required the way add-ons while loading a saved game, it uses default roads defined in simuconf.tab. If ways has the one-way flag, we have to set default roads for all kinds of overtaking_mode to replace missing roads correctly. I cannot find the solution for this problem. ??? Should I abolish the one way flag of way to solve this issue? Or should I ignore the overtaking_mode flag when replacing the missing roads?

    I suggest as follows: if a specific way with the one way flag cannot be found when loading a saved game, the game should try to find another way with a one way flag. If it cannot find any way with a one way flag at all, it should look for any way, even without a one way flag defined. If players try to load a saved game in which one way roads have been defined with a pakset that does not support one way roads, it is not unreasonable to expect that the one way roads will not work as such.
    Title: Re: One-way Two-lane road Fun Patch
    Post by: THLeaderH on July 01, 2017, 02:25:39 AM
    Here is a new release of One-way Two-lane fun patch, OTRP ver10.
    This time, the patch file and the executable binaries are simutrans nightly r8250 based, and the patch can be easily integrated to the nightly trunk.
    Source code can be seen on git. https://github.com/teamhimeh/simutrans/tree/OTRP

    patch:https://drive.google.com/open?id=0B_rSte9xAhLDNUE4OUxZcHd2TU0 (https://drive.google.com/open?id=0B_rSte9xAhLDNUE4OUxZcHd2TU0)
    ~Executable Files~
    :simutrans:
    win:https://drive.google.com/open?id=0B_rSte9xAhLDUGp4X1Rvc0ptVlk (https://drive.google.com/open?id=0B_rSte9xAhLDUGp4X1Rvc0ptVlk)
    mac:https://drive.google.com/open?id=0B_rSte9xAhLDVmIzcGpraWNIakU (https://drive.google.com/open?id=0B_rSte9xAhLDVmIzcGpraWNIakU)
    :makeobj: (new version!)
    win:https://drive.google.com/open?id=0B_rSte9xAhLDX1pfT1gtSWFRQW8 (https://drive.google.com/open?id=0B_rSte9xAhLDX1pfT1gtSWFRQW8)
    mac:https://drive.google.com/open?id=0B_rSte9xAhLDT1p2a3NhSjB6dzQ (https://drive.google.com/open?id=0B_rSte9xAhLDT1p2a3NhSjB6dzQ)

    This version is the first step to the integration. OTRP reached its functional completion in v9, but it has various problems for the integration. Ver.10 has the improvements.
    • Variables naming problem: overtaking_info is renamed overtaking_mode.
    • The overtaking_mode in ways was abolished. Ways no longer have overtaking_mode. Only wayobjs of overtake_wt define overtaking_mode. Wayobjs of any_wt is no longer used for that. Overtake_wt is the waytype which is specially defined for overtaking_mode and can be used only in wayobj.
    • Rewriting the code using enum is in progress. The enum is declared in simtypes.h. This makes the code more readable.

    Here is a sample dat of overtake_wt wayobj below.

    Code: [Select]
    obj=way-object
    copyright=THLeaderH
    name=ot_oneway
    waytype=overtaking_mode
    own_waytype=road
    overtaking_mode=oneway
    cost=0
    maintenance=0
    intro_year=1930
    intro_month=1
    retire_year=3000
    retire_month=12
    # Image definition code below...

    The value of "overtaking_mode" can be
    • oneway
    • twoway
    • loading_convoy_only
    • prohibited
    • passing_lane_only
    If this parameter is omitted, "twoway" is automatically applied.

    To use wayobjs of overtake_wt, you need to add
    Code: [Select]
    toolbar[6][12]=wayobjs(9) #Adding wayobjs of overtake_wt
    toolbar[6][13]=general_tool[33],,o,9 "Adding remover
    in the menuconf.tab of the pakset.

    This version cannot load sve data of OTRP v9. Sve data of original simutrans can be loaded.
    An_dz changed SIM_SAVE_MINOR to 5 but I returned it to 6. Many rdwr methods use SIM_SAVE_MINOR and we have to care for those when we change SIM_SAVE_MINOR to avoid problems. I set SIM_SAVE_MINOR 6 so that OTRP can load sve data of original simutrans.

    There are still some tasks for the integration.
    • Renaming of variables. "lane_fix" have to be changed into a nice name.
    • The bug which An_dz reported here (http://forum.simutrans.com/index.php?topic=16659.msg161555#msg161555)
    • Rewriting numbers of overtaking_mode to enum is still in progress. I haven't done that in simvehicle.cc, simconvoi.cc, and simroadtraffic.cc yet.
    • Hajo name corruption. I don't know why this occures, but maybe, Atom, an editor I'm using for coding, does some harmful things.
    • Getting overtaking_mode have to be done with less calculation. Ways should store overtaking_mode internally, not searching overtake_wt wayobj every time.

    Any bug reports and ideas for improvement are welcome!
    Title: Re: One-way Two-lane road Fun Patch
    Post by: sheldon_cooper on July 01, 2017, 02:53:30 AM
    Hello! I'm not used to these code nomenclatures, can you tell me what is '' overtaking_mode ''?
    And '' any_wt ''? And "simtypes"? (Remembering that I use google translate, and some words can be obvious more sometimes, google translates wrong)
    And what does that version change in the game on the move?
    Thanks for the update! :)
    Title: Re: One-way Two-lane road Fun Patch
    Post by: jamespetts on July 01, 2017, 09:26:47 AM
    I thought that you had written that both ways and wayobjs should have overtaking modes?
    Title: Re: One-way Two-lane road Fun Patch
    Post by: THLeaderH on July 01, 2017, 09:51:13 AM
    Quote
    I thought that you had written that both ways and wayobjs should have overtaking modes?
    Yes. However, if ways have overtaking_mode, we have to consider overtaking_mode when we replace missing ways. I haven't come up with a good algorithm, so I decided to abolish overtaking_mode of ways. If overtaking_mode with ways is required for the integration, we can implement it with a method which makes up missing paks with ways which have appropriate overtaking_mode.
    Title: Re: One-way Two-lane road Fun Patch
    Post by: jamespetts on July 01, 2017, 09:55:36 AM
    That is an interesting idea - it does seem worthwhile. It would be silly if one could not have one way roads with trolley wires, for instance, or for players to have to drag twice for each section of motorway.
    Title: Re: One-way Two-lane road Fun Patch
    Post by: THLeaderH on July 01, 2017, 10:06:45 AM
    Abolition of the flags of ways is just because of a technical reason. Ideally, both ways and wayobjs should have overtaking_mode.

    Quote
    what is '' overtaking_mode ''?
    OTRP supports 5 conditions for overtaking. Overtaking_mode is the parameter that defines which condition is imposed.

    Quote
    any_wt?
    any_wt means decoration_way. In ver9, I used decoration_way as a marker of overtaking_mode, but this should be used only for decoration purpose. So I stopped using this way type for overtaking_mode.

    Quote
    simtypes?
    It's a source file which defines various constants, simtypes.h. Enum of overtaking_mode is declared in this file.
    Title: Re: One-way Two-lane road Fun Patch
    Post by: sheldon_cooper on July 01, 2017, 11:42:55 PM
    thank you! :)

    I have a problem, when I try to run Sim.exe, and open the game, gives this error. What can it be?
    (https://s13.postimg.org/w2y7de9nb/kuma_975_09sdf.jpg) (https://postimg.org/image/4flhzaogj/)
    Title: Re: One-way Two-lane road Fun Patch
    Post by: jamespetts on July 02, 2017, 12:10:33 AM
    This usually means that you have an incompatible settings.xml file. If you delete this and try to run the game again, it should work, although you will lose your preferences (e.g. whether you had disabled MIDI, etc.).
    Title: Re: One-way Two-lane road Fun Patch
    Post by: An_dz on July 03, 2017, 03:37:06 AM
    I have one question, why one-way is zero and two-way is one?
    Title: Re: One-way Two-lane road Fun Patch
    Post by: THLeaderH on July 04, 2017, 07:01:36 AM
    It's just for compatibility. In previous versions of OTRP, I used number 0 for oneway_mode, and 1 for twoway_mode. I haven't finished rewriting of overtaking_mode yet. So, I used these numbers so that the current code works.
    Title: Re: One-way Two-lane road Fun Patch
    Post by: An_dz on July 04, 2017, 09:08:26 PM
    I developed a new approach to using the overtaking functions, instead of creating new objects, cluttering the UI and making things harder to the user (ways with different overtaking and wayobjs possibly changing them).

    First I moved all overtaking flags inside the way itself (the weg class), every way always have this flag just like the other flags or ribis. This should make calculation faster as you are sure every and any way has the flag, no need to check for wayobj or some other parameter first, just return the overtaking data.

    The usage is simple, when the user clicks on a road way, elevated way, tunnel or bridge five buttons show up, each button define an overtaking option. The chosen option will define the overtaking flag automatically, in case of building one-way roads ribis are also set according to the dragged direction, if you drag the road N->S the way will be one-way N->S.

    This patch is partial, the backfront code needed for the OTRP patch is complete as far as I can see but it has bugs and is incomplete on the forefront. So far the following is planned and incomplete:

    • (Bug)(one-way) Masked ribis not being set for one-way bridges and tunnels
    • (Bug)(one-way) Masked ribis being lost on load
    • (Bug)(one-way) Masked ribis being lost when building object on the road (signals/intersections)
    • (Bug)(one-way) Masked ribis not being reset when changing overtake mode
    • (Feature) Graphics for buttons to select overtake mode
    • (Feature) Graphics to overlay on all roads
    • (Feature) Graphics to overlay on specific roads

    Advantages:

    • Simple
      User just has to drag once, changing the flag can be done by re-dragging.
    • Fluid
      The last active overtaking option is kept so while building a one-way road the one-way option is kept until you choose a new option.
    • No new ways and/or wayobjs
      Ways and wayobjs are unchanged, the game automatically affects all road ways. No duplicated objects.
    • No pakset change required
      All paksets are automatically affected, the only thing is that no visual hint will be present by default.
    • Faster
      Data is saved on the way as ribis are, no need to check for wayobj, just return value.

    Here's a recording of how it works:
    (http://i.imgur.com/YcBeaRL.gif)

    PS: Two-way is index 0 so it's the first option on the toolbar.
    Title: Re: One-way Two-lane road Fun Patch
    Post by: THLeaderH on July 04, 2017, 11:42:33 PM
    This is an awesome approach and I'd like to follow An_dz's method!
    Is this code uploaded on the repository of GitHub?
    Title: Re: One-way Two-lane road Fun Patch
    Post by: An_dz on July 05, 2017, 01:55:16 AM
    Is this code uploaded on the repository of GitHub?
    Not yet. And this code does not contain the OTRP patch yet, only the interface and the flags.
    Title: Re: One-way Two-lane road Fun Patch
    Post by: Leartin on July 05, 2017, 04:58:09 AM
    I really like this concept, but I need to point out it does not follow the UI-implementation of other existing Simutrans functions, and it would be nice to have those streamlined.

    I'm talking about stuff like the signal-distance-menu or the extension-building-rotation-menu. Both of those are very similar to one-way options, in that they are
    • not required to be able to play the game
    • altering the exact result of what a button does
    • independent of the pakset



    So for the sake of consistency, it would make a lot of sense if using control-click on roads, bridges and tunnels opens a window with radio buttons, and the five different options written as plain text.
    Otherwise, clicking on an extension building or a signal should automatically open a sub-menu to set up distance or rotation, rather than a window.

    Or perhaps it would make sense to have both windows that come up at control-click and buttons in menu that do the same thing.
    Your five buttons that control overtaking behaviour would be available for pak-developers to put in the menuconfig if they have icons for them (because really, which icons are used if the pakset doesn't specify them?) It stays open and works globally, that is once you set 'one-way', even if you change which road tool you use it will stay at one-way. It's not shown by your example, but I guess once you change tools your submenu disappears and resets when it reappears?
    Similarly, there would be a menu-button that shows the global signal distance, and any signal you drag will be buildt with that global distance. Buttons to Increase or Decrease the global signal distance varible. Five buttons to make extension buildings face north, east, south, west or random.

    I'm not certain myself which option would be best, but I really think there should be a streamlined, consistent way across all similar options.
    Title: Re: One-way Two-lane road Fun Patch
    Post by: jamespetts on July 05, 2017, 10:58:00 AM
    An interesting discussion. Some observations: firstly, if I have understood this correctly, I agree with Leartin, in that clicking on a road tile in the menu should not always force a user to navigate a menu about overtaking. Only occasionally will users want to have one way roads: most of the time, they will just want to build roads and not worry about one way.

    Secondly, it would make sense if there were an option in each way's .dat file to allow pakset designers to specify whether the way is allowed to be (1) one way; or (2) two way.

    This is useful, as it makes very little sense to have one way dirt roads, but also, if a pakset has a special road, with a higher speed limit, intended to be a motorway/autobahn/freeway (etc.), it does not make any sense to allow this road, with its higher speed limit that in real life depends on being a dual carriageway, able to be built as a two way, single carriageway road. This can make a real difference to pakset balancing if players are allowed to get the advantages of a fast road without the cost of building both carriageways.
    Title: Re: One-way Two-lane road Fun Patch
    Post by: Leartin on July 05, 2017, 11:46:59 AM
    An interesting discussion. Some observations: firstly, if I have understood this correctly, I agree with Leartin, in that clicking on a road tile in the menu should not always force a user to navigate a menu about overtaking. Only occasionally will users want to have one way roads: most of the time, they will just want to build roads and not worry about one way.

    I don't think navigation is an issue, it appears to me that the overtaking-submenu appears, but does not need to be used, and it appears on the left edge of the screen, where it could hardly obstruct anything. That is, by itself, a rather elegant solution. My point is simply about consistency in context with the rest of the game, so either this should work like the stuff we already have, or the stuff we already have should be updated to work like this, or both.
    Title: Re: One-way Two-lane road Fun Patch
    Post by: jamespetts on July 05, 2017, 12:10:18 PM
    Ahh, yes, I see. I agree in any event that consistency is to be aimed for wherever possible, although CTRL+click is often not transparent to users.
    Title: Re: One-way Two-lane road Fun Patch
    Post by: An_dz on July 05, 2017, 01:25:07 PM
    Similarly, there would be a menu-button that shows the global signal distance, and any signal you drag will be buildt with that global distance. Buttons to Increase or Decrease the global signal distance varible.
    I think that each signal needs a different value, as it is, as I think depending the signal type one might need to have different distances, but we can move it to be global as well, it's not hard, just duplicate code.

    Your five buttons that control overtaking behaviour would be available for pak-developers to put in the menuconfig if they have icons for them
    That's why I've set them as toolbar buttons, if you want to place them somewhere else as well you can. I have not coded that yet, but the default icons will be images in the SimpleTools menu pak.

    (because really, which icons are used if the pakset doesn't specify them?)
    As you can see in the bug list I have not coded that part yet, but I'll probably use the vehicle list icon or the road toolbar icon.

    It stays open and works globally, that is once you set 'one-way', even if you change which road tool you use it will stay at one-way. It's not shown by your example, but I guess once you change tools your submenu disappears and resets when it reappears?
    No, it's totally global and persistent. It will only reset when you reload Simutrans.

    I really like this concept, but I need to point out it does not follow the UI-implementation of other existing Simutrans functions, and it would be nice to have those streamlined.

    I'm talking about stuff like the signal-distance-menu or the extension-building-rotation-menu. Both of those are very similar to one-way options, in that they are
    • not required to be able to play the game
    • altering the exact result of what a button does
    • independent of the pakset
    An interesting discussion. Some observations: firstly, if I have understood this correctly, I agree with Leartin, in that clicking on a road tile in the menu should not always force a user to navigate a menu about overtaking. Only occasionally will users want to have one way roads: most of the time, they will just want to build roads and not worry about one way.
    Well, (1) the extension rotation is totally eye candy, no game functionality is affected, it's completely irrelevant unless for scenario builders (like myself) and (2) the signal spacing is important to change only once, after you have set a default on your session you are done.

    On the other hand setting the road "rules" is more common (that's why NAM on SimCity exists), and it's important for the user to get a visual hint of which "rule" is currently set. Or users would be really pissed if they went on building a new road to then find out they just built a road forbidding overtaking.

    I forgot to add that in the bug list, but the menu should go away when you deselect a road tool.

    Secondly, it would make sense if there were an option in each way's .dat file to allow pakset designers to specify whether the way is allowed to be (1) one way; or (2) two way.

    This is useful, as it makes very little sense to have one way dirt roads, but also, if a pakset has a special road, with a higher speed limit, intended to be a motorway/autobahn/freeway (etc.), it does not make any sense to allow this road, with its higher speed limit that in real life depends on being a dual carriageway, able to be built as a two way, single carriageway road. This can make a real difference to pakset balancing if players are allowed to get the advantages of a fast road without the cost of building both carriageways.
    Tell me the difference with the current behaviour.

    Anyone who plays online can explain how people build roads on network games?

    And why make things complicated to the user? And with the code? The user is building a one-way road, but then selects one that is not allowed to be one-way, and has to find out which can be built one-way. You would need to go back and fourth finding which combines with what. Games are built to please gamers, not designers, my personal opinion.
    Title: Re: One-way Two-lane road Fun Patch
    Post by: jamespetts on July 05, 2017, 02:10:00 PM
    I am not sure that I fully understand the questions relating to my comment regarding pakset balancing and one way roads. In particular, are you referring to the "current behaviour" being the behaviour in the game as it is now without the patch, with the patch in its current state as written by you, or with the patch in the state written by The Leader H?

    The point in general terms is that it is common for dual carriageway roads to have higher speed limits than single carriageway roads because they are dual carriageway roads. This could have a significant effect on pakset balance for the reasons given in my previous post. The only way of enforcing this with the system as you have written it is to add the options as I suggest.

    As to simplicity, it should be easy for a player to understand that some roads with higher speed limits should be dual carriageways. The system as you have written it is actually more complex (albeit with the benefit of greater flexibility) than a system in which every type of road is either one way or two way and this cannot be changed by the player. Allowing the player the ability to change types of roads between one and two way on the fly is the thing that adds the complexity; it does not add significant further complexity to add what is necessary for balance, viz. a feature allowing pakset authors to specify which roads may be made one way or two way.

    As to the interface, it should be simple to communicate through the sub-menu (for example, by greying out) what options are not available.
    Title: Re: One-way Two-lane road Fun Patch
    Post by: Leartin on July 05, 2017, 03:02:02 PM
    Well, (1) the extension rotation is totally eye candy, no game functionality is affected, it's completely irrelevant unless for scenario builders (like myself) and (2) the signal spacing is important to change only once, after you have set a default on your session you are done.
    Sure, rotating those extensions is just eye candy, and while I disagree with your assessment about signals spacing (if you really care, you would change it more often when your trains get longer or shorter over time; If you don't care, you never change it at all), I understand that those functionalities are less important then one-way-roads, and definitelly not worth spending too much time on in their own right. I'm not even saying you personally should change anything about them - rather, I think WE, the community, should come to some common concensus about how Simutrans menus should work, which can then be implemented by whoever happens to have enough time. Which I realize would likely be noone, but still.

    I think the way you designed your menu has implication you don't yet realize. The revolutionary thing about it is that up until now, we had buttons to call menus, we had buttons to call windows, we (rarely) had buttons to toggle something, and we had buttons that called a cursortool; you change all road icons to do both, call a menu AND call a cursortool. Once you do this, why not do it more often?
    For example, p192c has a demolish-tool and a demolish-menu, currently two icons, which could very well merge into one without any loss in functionality either way. Same (perhaps to a lesser degree) for the view-tool and the view-toolbar. And perhaps it would even be rather easy to implement with a simple boolean flag in every icon that calls a menu, which would indicate that the first tool of that menu is auto-selected - quite straightforward.
    If that would be done, you could eg. create sub-menus for each type of signal - since you always call the first signal, you can always build a signal with the function you wish for, or you first select one that looks different. Since you said it's persistent, that would be true for such sub-menus as well, so once you choose one, the main-icon will call that one next time. And because of that, you could even use it for stuff like tracks... so essentially, your menu would consist of "build a way", "build a tunnel", "build a bridge", "build electrification", "build a block signal" to "build an end of choose signal", "build goods station", "build pax station", "build station extension", "build depot". I don't think that would be too bad, and if it would be done, I wouldn't mind at all. It's just very different to the current behaviour.

    If, instead, you would just add those five icons but NOT show them automatically whenever you call any road tool, the functionality would be largely the same; if they are in the road menu nothing would change at all. The user would perhaps need one more click over the course of the whole session, the one to call those tools to put them in some corner - if they are not part of the road tools anyway - so essentially nothing. However, since you don't mix up menu-calling with tool-calling, there is no reason to do it with anything else either, it would have no resemblance to all the control-click-options, and therefore it would fit in the canon of how Simutrans works a bit better.


    Yes, I'm fully aware that you might say it's a slippery slope arguement, but the problem is that the slippery slope would be the better option over plain design inconsistency. That's why I think it's important to talk about this in general, not just in relation to this function.
    Title: Re: One-way Two-lane road Fun Patch
    Post by: Ters on July 05, 2017, 03:41:50 PM
    This is useful, as it makes very little sense to have one way dirt roads, but also, if a pakset has a special road, with a higher speed limit, intended to be a motorway/autobahn/freeway (etc.), it does not make any sense to allow this road, with its higher speed limit that in real life depends on being a dual carriageway, able to be built as a two way, single carriageway road. This can make a real difference to pakset balancing if players are allowed to get the advantages of a fast road without the cost of building both carriageways.

    I think this is an issue from a few pages back: whether one-way roads should be separate road, which means that pak sets and add-ons must be modified to enable this feature, or some sort of overlay (not necessarily in a visual sense) on any road, which means that players can use the feature immediately without having to wait for new paks from authors who might not even be around anymore.

    I certainly can see use for one-way dirt roads, but probably not with overtaking. In those situations, signs and/or waypoints should be adequate, though.
    Title: Re: One-way Two-lane road Fun Patch
    Post by: An_dz on July 05, 2017, 04:13:49 PM
    I am not sure that I fully understand the questions relating to my comment regarding pakset balancing and one way roads. In particular, are you referring to the "current behaviour" being the behaviour in the game as it is now without the patch, with the patch in its current state as written by you, or with the patch in the state written by The Leader H?
    The current behaviour without any patches, default Simutrans or Simutrans Extended.

    Many paksets have roads with pretty high speeds for two-way roads, yet they offer it.

    The system as you have written it is actually more complex (albeit with the benefit of greater flexibility) than a system in which every type of road is either one way or two way and this cannot be changed by the player. Allowing the player the ability to change types of roads between one and two way on the fly is the thing that adds the complexity
    Yes, but it's less complex than both at the same time.

    Yes, I'm fully aware that you might say it's a slippery slope arguement, but the problem is that the slippery slope would be the better option over plain design inconsistency. That's why I think it's important to talk about this in general, not just in relation to this function.
    No, I agree, actually I always wanted something more a la SimCity.
    Title: Re: One-way Two-lane road Fun Patch
    Post by: jamespetts on July 05, 2017, 05:04:48 PM
    The current behaviour without any patches, default Simutrans or Simutrans Extended.

    Many paksets have roads with pretty high speeds for two-way roads, yet they offer it.

    I can only speak for Pak128.Britain-Ex, but I suspect that it may well be the same for the other paksets; the pakset has such a road precisely and only because it is not possible to require that it be built only as a one way road, and there is no other way of having a motorway in the pakset but by having a road that allows motorway speeds as a single carriageway road, even though this would never be permissible in reality.
    Title: Re: One-way Two-lane road Fun Patch
    Post by: Leartin on July 05, 2017, 05:53:43 PM
    I can only speak for Pak128.Britain-Ex, but I suspect that it may well be the same for the other paksets; the pakset has such a road precisely and only because it is not possible to require that it be built only as a one way road, and there is no other way of having a motorway in the pakset but by having a road that allows motorway speeds as a single carriageway road, even though this would never be permissible in reality.
    Essentially the same for p192c. If the option would have existed, high-speed roads would be one-way only. It's a bit like saying every way had steep slopes before half slopes were introduced, therefore an option to disable those would not be required.
    Title: Re: One-way Two-lane road Fun Patch
    Post by: An_dz on July 06, 2017, 04:37:45 PM
    Ok, fair point, but no implementation for now.

    And about the UX, can we go with it?
    Title: Re: One-way Two-lane road Fun Patch
    Post by: sheldon_cooper on July 15, 2017, 08:26:23 PM
    Good afternoon, or good day, or night, I do not know!  ;D
    I wanted a more detailed explanation of the five options for creating existing roads in the future OTRP Patch update.
    I still have not played with version 10, due to compatibility problems of my saved game.
    Title: Re: One-way Two-lane road Fun Patch
    Post by: THLeaderH on July 16, 2017, 08:47:10 AM
    https://twitter.com/himeshi_hob/status/886043618695303169 (https://twitter.com/himeshi_hob/status/886043618695303169)
    How do you think about this video?
    In the next release, overtaking_mode can be set in a window and oneway_mode road becomes genuine oneway. No special addons are needed.

    Quote
    I wanted a more detailed explanation of the five options for creating existing roads in the future OTRP Patch update.
    I'll make a video which explains the detail of this patch in a few weeks.
    Title: Re: One-way Two-lane road Fun Patch
    Post by: sheldon_cooper on July 16, 2017, 12:49:49 PM
    thank you! :)
    I use OTRP Patch V.8.0, with the special add-on to be able to use on the roads, with the new update, do I have to exclude this special add-on so there will be no problems? Or is it not necessary?
    Title: Re: One-way Two-lane road Fun Patch
    Post by: THLeaderH on July 16, 2017, 01:07:29 PM
    It's necessary. And unfortunately, v10 cannot load the v8's data.
    Title: Re: One-way Two-lane road Fun Patch
    Post by: prissi on July 16, 2017, 03:15:24 PM
    You should be able to downgrade the version (in the settings option dialogue show with new world window). If properly coded, then the info will not be written in a slightly older savegame version.
    Title: Re: One-way Two-lane road Fun Patch
    Post by: THLeaderH on July 16, 2017, 03:30:56 PM
    Quote
    You should be able to downgrade the version (in the settings option dialogue show with new world window). If properly coded, then the info will not be written in a slightly older savegame version.
    It's already done. Current nightly code set savegame version 120005 and I use version 120006 for OTRP. If version >= 120006 then rdwr methods read and write data such as overtaking_mode.

    <EDIT>
    Oops, this was an advice for sheldon_cooper! Yes, you can downgrade the version and downgraded data can be read on v10 or v11, which are going to be released in a few weeks.
    Title: Re: One-way Two-lane road Fun Patch
    Post by: sheldon_cooper on July 16, 2017, 11:21:05 PM
    Would it be this?
    (https://s1.postimg.org/eqdci56e7/kuma_975_04q.png) (https://postimg.org/image/jp0uwoa6z/)

    Title: Re: One-way Two-lane road Fun Patch
    Post by: An_dz on July 16, 2017, 11:24:06 PM
    @THLeaderH I've pushed my overtaking menu patch on GitHub (https://github.com/An-dz/simutrans/tree/overtaking-menu), I decided to keep my patch clear of yours to focus on the features I'm building, this might facilitate you merging my changes as well.
    Title: Re: One-way Two-lane road Fun Patch
    Post by: THLeaderH on July 17, 2017, 01:53:58 AM
    Quote
    Would it be this?
    Yes, maybe the latest one is fine.
    Title: Re: One-way Two-lane road Fun Patch
    Post by: THLeaderH on July 28, 2017, 06:42:28 AM
    Here is a new release of One-way Two-lane Road Patch, OTRP ver11.
    This time, the patch file and the executable binaries are simutrans nightly r8275 based, and the patch can be easily integrated to the nightly trunk.
    Source code can be seen on git. https://github.com/teamhimeh/simutrans/tree/OTRP (https://github.com/teamhimeh/simutrans/tree/OTRP)

    patch:https://drive.google.com/open?id=0B_rSte9xAhLDY0tCTWdHSnBUQ2c (https://drive.google.com/open?id=0B_rSte9xAhLDY0tCTWdHSnBUQ2c)
    ~Executable Files~
    :simutrans:
    win:https://drive.google.com/open?id=0B_rSte9xAhLDMDNuakoya19xbHc (https://drive.google.com/open?id=0B_rSte9xAhLDMDNuakoya19xbHc)
    mac:https://drive.google.com/open?id=0B_rSte9xAhLDa2FWRTVjdGdMRFU (https://drive.google.com/open?id=0B_rSte9xAhLDa2FWRTVjdGdMRFU)
    :makeobj:
    There is no special makeobj. Please use the makeobj of simutrans standard!

    Be sure that this version cannot load sve data of previous versions of OTRP.
    I made a video which explains how to use this version. The video is spoken in Japanese, but English subtitle is available.

    ~The features of this version~
    • Rewriting numbers of overtaking_mode to enum reached its completion. This makes the code much easier to read.
    • No special addons are needed! Players choose overtaking_mode when they build roads. Please see the tutorial video for the detail.
    • Oneway_mode roads become automatically oneway. The direction in which vehicles can go depends on the direction in which players build the road. This solves various problems that happens on oneway road, such as facing traffic, placing so many oneway signs, and sudden turn of city cars. Also see the tutorial video for the detail.

    I made a support patch that visualizes the ribi of way so that players can easily recognize the tile whose ribi is set incorrectly. This makes construction of oneway road much confortable. See here for the detail. (http://forum.simutrans.com/index.php?topic=17273.msg164530#msg164530)
    Patches and executable files listed on this pages do not contain the ribi patch.

    I set this version as a candidate version for integration again. I would like great developers of this forum to do code review.

    Any bug reports and ideas for improvement are welcome!


    As I make this patch, I found that some more projects are neccesary for father improvement of two lane road transportation. OTRP is already so a huge project, thus these should be discussed as different topics.
    • Improvement of routing algorithm of citycars. Current citycar's routing algorithm that decides its course randomly when it reaches at intersections is too rough. Since we can know the position of only two tiles ahead, sensitive controls such as lane pinning cannot be applied to city cars. Also, current city cars behaves so stupid in intersections. City cars often turn more than 180 degrees and that corrupts traffic. Also acceleration of city cars seems so unnatural.
      I think that city cars should have their destinations and route. Also, city cars should have power and weight parameter, which enables more accurate motion simulation of city cars. I've heard that these are realized in simutrans extended, but I don't know about that in detail.
    • Intersection object is needed to realize more sophisticated intersection control. For example, we cannot set right turn lane or left turn lane under the current intersection system. Also, traffic signal for multiple lanes should be discussed.
    Without these ideas, OTRP does work as it is and is already revolution for road traffic of simutrans. However, If a father improvement is desired, these concepts should be discussed.
    Title: Re: One-way Two-lane road Fun Patch
    Post by: jamespetts on July 28, 2017, 10:28:10 AM
    ...
    • Improvement of routing algorithm of citycars. Current citycar's routing algorithm that decides its course randomly when it reaches at intersections is too rough. Since we can know the position of only two tiles ahead, sensitive controls such as lane pinning cannot be applied to city cars. Also, current city cars behaves so stupid in intersections. City cars often turn more than 180 degrees and that corrupts traffic. Also acceleration of city cars seems so unnatural.
      I think that city cars should have their destinations and route. Also, city cars should have power and weight parameter, which enables more accurate motion simulation of city cars. I've heard that these are realized in simutrans extended, but I don't know about that in detail.
    • Intersection object is needed to realize more sophisticated intersection control. For example, we cannot set right turn lane or left turn lane under the current intersection system. Also, traffic signal for multiple lanes should be discussed.
    Without these ideas, OTRP does work as it is and is already revolution for road traffic of simutrans. However, If a father improvement is desired, these concepts should be discussed.

    Full routing for private cars is a problem because of the computational load that it exerts in a very large map. I did once try, many years ago, implementing actual routing for city cars in the same way as player vehicles, but the game became completely unresponsive.

    In Extended, the actual private car objects behave in the same way as they do in Standard, but there is a very approximate, high-level means of simulating private car journeys so as to simulate competition between private cars and player transport.
    Title: Re: One-way Two-lane road Fun Patch
    Post by: Isaac.Eiland-Hall on July 28, 2017, 05:29:48 PM
    I just wanted to say that I loved the cloverleaf in the video! <3
    Title: Re: One-way Two-lane road Fun Patch
    Post by: Leartin on July 28, 2017, 08:45:41 PM
    Full routing for private cars is a problem because of the computational load that it exerts in a very large map. I did once try, many years ago, implementing actual routing for city cars in the same way as player vehicles, but the game became completely unresponsive.

    Was that a unique route for each vehicle? What if every now and then, a "citycar-route" was precalculated by picking two semirandom spots and routing a connection once, than saving it in a list of possible citycar-routes, and each citycar that spawns just needs to pick a route and follow it - thus no individual routing. If a citycar gets 'stuck' because a piece of road is missing, it simply disappears and marks the route it was on as invalid. There would be a lot less of actual routing, and never time sensitive, so if Simutrans is aware of how much ressources are used, it could be done whenever there is time, possibly even in pause mode.
    Title: Re: One-way Two-lane road Fun Patch
    Post by: jamespetts on July 28, 2017, 10:12:04 PM
    Was that a unique route for each vehicle? What if every now and then, a "citycar-route" was precalculated by picking two semirandom spots and routing a connection once, than saving it in a list of possible citycar-routes, and each citycar that spawns just needs to pick a route and follow it - thus no individual routing. If a citycar gets 'stuck' because a piece of road is missing, it simply disappears and marks the route it was on as invalid. There would be a lot less of actual routing, and never time sensitive, so if Simutrans is aware of how much ressources are used, it could be done whenever there is time, possibly even in pause mode.

    It was indeed a unique route for each vehicle - it was a simple implementation derived directly from the system used to route player vehicles. This was before I learnt how to profile the code, so there is a possibility that performance could have been improved even within that model, although it was so bad (the game being indistinguishable from frozen on a moderately sized map) that it seems unlikely that ordinary optimisation would have made enough of a difference.

    Multi-threading, which should be readily possible, might help a little, but I suspect that more than four cores would be needed to get reasonable performance using this method. Multi-threading is already used in Extended for the private car route finding system there, and that involves only finding one route between each townhall and each other townhall, and even that workload has to be spread over quite some time so as not to impair responsiveness.

    I did consider some years ago when I first had this problem a fragmentary route system, not quite the one that you suggested, but a different one, in which routes within towns were treated separately to routes between towns: the idea is that there would be stored routes between each town exit point and each town entry point, and then between each building and exit/entry point in a town (possibly created only on demand), and, in journeys between buildings in different towns, three routes (from origin to exit point, from exit point to entry point, and from entry point to destination) would be concatenated to produce the final route.

    That was never progressed as I considered it too much work at the time in light of other priorities, and the very basic system worked well enough.
    Title: Re: One-way Two-lane road Fun Patch
    Post by: sheldon_cooper on July 29, 2017, 12:33:57 AM
      Also, traffic signal for multiple lanes should be discussed.
      [/list]

      I do not know if you are referring to these traffic signs, but taking advantage of that, this pak is for multiple lane, different crossing situations, I think it can be very useful for this patch. (Pak128)

      (https://s3.postimg.org/r57yzk9fn/simscr96.png) (https://postimg.org/image/9rxokpe4f/)

      >>> https://www.dropbox.com/s/4dkwndtazs3v0z6/Sem%C3%A1foro%20moderno.rar?dl=0 <<<
      If you can not download through this link, just let me know and I'll try to solve it.

      (Credit: Filipe Jucélio)

      Title: Re: One-way Two-lane road Fun Patch
      Post by: IgorEliezer on July 29, 2017, 01:42:58 AM
      The traffic signal is an issue of its own. The main problem is, when you place traffic signals next to each other, at least 2 signals at their "sharing" sides overlap causing traffic jams.

      Further discussion:
      • http://forum.simutrans.com/index.php?topic=2566.0 (http://forum.simutrans.com/index.php?topic=2566.0)
      • http://forum.simutrans.com/index.php?topic=14782.0 (http://forum.simutrans.com/index.php?topic=14782.0)
      EDIT: Merged both threads.
      Title: Re: One-way Two-lane road Fun Patch
      Post by: THLeaderH on July 29, 2017, 01:48:37 AM
      Quote
      I do not know if you are referring to these traffic signs, but taking advantage of that, this pak is for multiple lane, different crossing situations, I think it can be very useful for this patch. (Pak128)
      Think about this situation. Note that vehicles drive on left. There is 4 signals in this 2×2 intersection. You are on tile 1.
      (http://simutrans-germany.com/files/upload/%E3%82%B9%E3%82%AF%E3%83%AA%E3%83%BC%E3%83%B3%E3%82%B7%E3%83%A7%E3%83%83%E3%83%88_2017-07-29_%E5%8D%88%E5%89%8D10.21.35.png)
      However, there is two problems.
      • When the vehicle turns right, it will go 1→2→3→4→5. The signal on tile 2 shows blue and the vehicle starts. However, signal on tile 4 blocks the vehicle and it cannot turn right immediately. The vehicle must wait until signal light changes even when there is no facing traffic! Of course this makes traffic jam.
      • When the vehicle goes straight, it will go 1→2→3→6. In the case that the traffic light changes from blue to red suddenly when the vehicle is on tile 2, this vehicle must wait until the traffic light changes again. So, this vehicle blocks north and south traffic!
      these problems on a 2×2 intersection can be solved by putting signals like this. (Signals are put on "S" tiles.)
      (http://simutrans-germany.com/files/upload/%E3%82%B9%E3%82%AF%E3%83%AA%E3%83%BC%E3%83%B3%E3%82%B7%E3%83%A7%E3%83%83%E3%83%88_2017-07-29_%E5%8D%88%E5%89%8D10.22.56.png)

      However, even with this solution, you'll find that you cannot solve the second problem on a intersection like this. North and south traffic will be suffered from the problem 2.
      (http://simutrans-germany.com/files/upload/%E3%82%B9%E3%82%AF%E3%83%AA%E3%83%BC%E3%83%B3%E3%82%B7%E3%83%A7%E3%83%83%E3%83%88_2017-07-29_%E5%8D%88%E5%89%8D10.43.59.png)

      So I think that we should think about intersection object that enables more sophisticated intersection control.


      EDIT
      Quote
      Further discussion:
      http://forum.simutrans.com/index.php?topic=2566.0
      http://forum.simutrans.com/index.php?topic=14782.0
      Yes, I think this issue should be discussed in the either topic.
      Title: Re: One-way Two-lane road Fun Patch
      Post by: THLeaderH on July 30, 2017, 01:19:50 AM
      For code reviewers, code related to oneway road feature is written in
      • weg.h, weg.cc
      • brueckenbauer.h, brueckenbauer.cc
      • tunnelbauer.h, tunnelbauer.cc
      • wegbauer.h, wegbauer.cc
      • simtool.h, simtool.cc

      This version is a candidate version for integration. Though I believe that this version has enough quality to be integrated, please let me know if there are bugs or code that requires fixing.
      Title: Re: One-way Two-lane road Fun Patch
      Post by: TurfIt on July 30, 2017, 04:53:51 AM
      Overtaking mode selection does not work in multiplayer.
      Mode selections being per object is not friendly. Makes more sense for a global selection that applies for all constructions.
      Way builder route search needs to take directionality into account before merging new construction with existing.
      Still indications of incompletion:
      Code: [Select]
      + //TODO: This initialization of "tiles" should be considered again. 2 is not appropriate considering LC patch.
      + //Warning: diff_speed == 0 is acceptable. We must consider the case diff_speed == 0.
      + //Whether this code is safe is not clear!!(can ignore cars on the other lane?)
      + // !It is not clear whether we should consider opposite lane in this case!
      Title: Re: One-way Two-lane road Fun Patch
      Post by: THLeaderH on July 30, 2017, 06:34:12 AM
      Quote
      Overtaking mode selection does not work in multiplayer.
      This seems to work correctly in multiplayer for me. Please describe the issue in more detail.

      Quote
      Mode selections being per object is not friendly. Makes more sense for a global selection that applies for all constructions.
      I don't think so. When you are building trunk road and narrower road, you will use two types of road. Trunk road should be oneway_mode and the narrower should be twoway_mode. So, with mode selections being per object, you have to select overtaking mode only twice. With a global selection, you have to select overtaking mode every time you change the type of road and that is unfriendly, I think.

      I'll answer to the other two indications later.
      Title: Re: One-way Two-lane road Fun Patch
      Post by: TurfIt on July 30, 2017, 05:12:15 PM
      I don't think so. When you are building trunk road and narrower road, you will use two types of road. Trunk road should be oneway_mode and the narrower should be twoway_mode. So, with mode selections being per object, you have to select overtaking mode only twice. With a global selection, you have to select overtaking mode every time you change the type of road and that is unfriendly, I think.
      Start building a oneway road. Run into a river. Build a bridge - oops it's two way.  With global selection, you can build an entire oneway road with bridges, tunnels, all without having to change for every object.


      This seems to work correctly in multiplayer for me. Please describe the issue in more detail.
      Start as server. Attempt building a oneway road. Observe twoway road built instead.

      I don't know how to respond to this claim of it working for you. From the code, there is 0% chance of this working. Ever. At all. In the slightest. Zero.
      (commanded tool instances don't persist  -  try set_default_param)
      Title: Re: One-way Two-lane road Fun Patch
      Post by: An_dz on July 30, 2017, 09:40:06 PM
      Start building a oneway road. Run into a river. Build a bridge - oops it's two way.  With global selection, you can build an entire oneway road with bridges, tunnels, all without having to change for every object.

      That's why my patch with the toolbar was global per player.
      Title: Re: One-way Two-lane road Fun Patch
      Post by: jamespetts on July 30, 2017, 10:20:22 PM
      Start building a oneway road. Run into a river. Build a bridge - oops it's two way.  With global selection, you can build an entire oneway road with bridges, tunnels, all without having to change for every object.

      Of course, this would also not be a problem if the system of having bridges separate from their underlying way as used in Extended were adopted.
      Title: Re: One-way Two-lane road Fun Patch
      Post by: Leartin on July 31, 2017, 05:29:16 AM
      Start building a oneway road. Run into a river. Build a bridge - oops it's two way.  With global selection, you can build an entire oneway road with bridges, tunnels, all without having to change for every object.

      But also: Start building a road. Run into a river. Build a bridge? - oops, you have to change tools. Pretty sure I'm not the only one who instead continues the road on the other side of the river to fill in bridges later, since changing tools is inconvenient. Additionally changing the direction of the tool you need to select does not add much inconvenience, since your way-building workflow already got interrupted.

      I don't think either option is better than the other, since it much depends on the players style and the options of the pakset. There are players who will always pick the same road, thus always have to switch, so it's better if it's global, to save 2/3 of the switching. But there are players who will always pick different roads depending on the directions settings if the pakset/addons offer roads that lean themself towards a certain use graphically such as a motorway (one-way with overtaking) or a motorway access (one-way without overtaking), while having the same costs, and for those, it's better to have it per-object and even preset by the pack. It's simply a clash of interest between different player demographics.

      Perhaps if it was more consequent, per-pak-settings would not be required. The settings were introduced such that any way could have any direction and we would not need multiple versions of each way. But those who play for looks want ways to look different based on their directions. If the same way does not look different based on directions, they will get different ways - which means one reason to do it with settings rather than different ways is gone and you need per-object settings. But if you could completely change the look based on directions within one way, there is no need to have multiple versions and players would instead switch directions within the same way, making a global setting more useful.
      Title: Re: One-way Two-lane road Fun Patch
      Post by: IgorEliezer on July 31, 2017, 05:50:51 AM
      My workflow would be:
      1. Build roads, bridges, tunnels, whatever. (default = two-ways, I would prefer to lay out the ways and decide about the flow later on)
      2. Paint and install the signaling. (by using a tool to apply/change directions or flow control of the ways)
      3. Then I check if I missed any bit. (by using a visualizer (http://forum.simutrans.com/index.php?topic=17273.0)).
      4. I'm done. If I change my mind on something, I can use the flow control tool to change the directions and tweak a bit.

      Probably this is not intuitive for players, they may want to build a one-way road right off the bat. I'm speaking as someone who works with urban infrastructure. :>
      Title: Re: One-way Two-lane road Fun Patch
      Post by: THLeaderH on July 31, 2017, 08:36:08 AM
      So I should provide a configuration so that the selection can be both global or local.
      I'm still dealing with the indicated issues. I'll add the configuration after solving those.
      Title: Re: One-way Two-lane road Fun Patch
      Post by: TurfIt on August 01, 2017, 03:10:01 AM
      The one-way roadsign lane fixing thingy also cannot work in multiplayer. The selection needs to be syncronized across clients. You'll need to add a tool_change_roadsign_t (see the traffic light tool for an example).

      Actually I can't make this sign work in singleplayer either. Convois freely still enter the other lane after passing the sign despite turning at the next intersection. Can you provide an example save showing this working? Maybe I'm not setting things up right... lane_fix == 0 always on my convois.

      Why the existing ribi_maske and added ribi_mask_oneway?  Can't these be combined?

      Since overtaking applies only to roads, wouldn't the variables make more sense in strasse_t instead of weg_t?

      When a stopped convoi changes lanes immediately upon starting to move, it's graphic is left behind as a glitch in it's former lane. The marking dirty mechanisms for moving objects is quite a hack, but this patch is introducing some new behaviours that the hack isn't handling, so needs changes.

      Also noticed with stopped convois changing lanes immediately upon starting is trailers in tiles behind aren't being accounted for. i.e. A two tile long road train will sideswipe a convoi alongside when it changes lanes.


      Intersection object is needed to realize more sophisticated intersection control. For example, we cannot set right turn lane or left turn lane under the current intersection system. Also, traffic signal for multiple lanes should be discussed.
      There was some discussion about this is one of the last big discussions about multilane roads: http://forum.simutrans.com/index.php?topic=8906.0 (http://forum.simutrans.com/index.php?topic=8906.0)
      It is something required to make the logic work in town with avenues. Extending the current ist_weg_frei and no_cars_blocking for multilane intersections would be a nightmare.


      Improvement of routing algorithm of citycars. Current citycar's routing algorithm that decides its course randomly when it reaches at intersections is too rough. Since we can know the position of only two tiles ahead, sensitive controls such as lane pinning cannot be applied to city cars. Also, current city cars behaves so stupid in intersections. City cars often turn more than 180 degrees and that corrupts traffic. Also acceleration of city cars seems so unnatural.
      I think that city cars should have their destinations and route. Also, city cars should have power and weight parameter, which enables more accurate motion simulation of city cars. I've heard that these are realized in simutrans extended, but I don't know about that in detail.
      I don't think they need destinations and a full route. But, the route does need to be determined for several tiles for them to properly navigate intersections, and lane_fixing as you mention.
      After I finished the overhaul of convoi movements through intersections, I was burned out from dealing with that section of code, so the planned work to bring the citycars up to the same standard never happened. Putting the controls into an intersection_t with path reservations through the intersection would make the task much easier IMO.
      The current citycar movement behaviour has the advantage of them atleast trying to get out of the way in a traffic jam rather than making it worse by sticking to a preplanned route. Any changes should try to preserve that as much as possible IMHO.
      Title: Re: One-way Two-lane road Fun Patch
      Post by: THLeaderH on August 02, 2017, 05:00:12 AM
      Quote
      (commanded tool instances don't persist  -  try set_default_param)
      So, using default_param as a key, should I use static hash table to store selected overtaking_mode?

      EDIT:
      Quote
      Since overtaking applies only to roads, wouldn't the variables make more sense in strasse_t instead of weg_t?
      Yes, overtaking_mode and ribi_mask_oneway should be in strasse_t and I'll do so.
      Quote
      Why the existing ribi_maske and added ribi_mask_oneway?  Can't these be combined?
      They can be combined. However, if these are combined, we have to consider the effect of roadsigns or etc when we change ribi_mask_oneway every time. Separating these makes code more simple and robust.
      Title: Re: One-way Two-lane road Fun Patch
      Post by: TurfIt on August 02, 2017, 06:25:01 PM
      So, using default_param as a key, should I use static hash table to store selected overtaking_mode?
      I'd think you just pass the overtaking mode directly in the param., and make sure the bauers all use that passed param rather than some local globals.


      They can be combined. However, if these are combined, we have to consider the effect of roadsigns or etc when we change ribi_mask_oneway every time. Separating these makes code more simple and robust.
      IMHO, since they're performing the same function, they should be merged.
      Keeping these datastructures as small a possible helps the game to support huge maps at reasonable performance. ( I'd go so far as to kill the overtaking mode enum too - 32bits for that - 28 wasted!  [old] c++ annoying at times...)



      Why are the overtaking mode selections per player? Just because I change from human to public to tricky transport, I can't see why I'd what the overtaking mode I've already selected to change.

      For lane fixing, how about renaming to lane affinity?
      Title: Re: One-way Two-lane road Fun Patch
      Post by: THLeaderH on August 05, 2017, 04:34:34 AM
      I'm dealing with default_param for network game but I'm pretty confused with default_param. In tool_build_way_t, I edited get_default_param so that default_param contains overtaking mode and it succeeded. However, I did the same thing in tool_build_bridge_t, wrote get_desc() function to replace "bridge_builder_t::get_desc(default_param)" to "get_desc()", and built a bridge. Then I got the following error.
      Code: [Select]
      Process 30152 stopped
      * thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x6f7c6b5b000a)
          frame #0: 0x000000010000b9bb sim`image_list_t::get_image(this=0x00006f7c6b5b0002, i=18) const at image_list.h:34
         31 
         32  uint16 get_count() const { return count; }
         33 
      -> 34  image_t const* get_image(uint16 i) const { return i < count ? get_child<image_t>(i) : 0; }
         35 
         36  image_id get_image_id(uint16 i) const {
         37  const image_t *image = get_image(i);
      (lldb) bt
      error: brueckenbauer.o DWARF DW_TAG_array_type DIE at 0x000078ca has a class/union/struct element type DIE 0x000078c5 that is a forward declaration, not a complete definition.
      Try compiling the source file with -fno-limit-debug-info or disable -gmodule
      * thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x6f7c6b5b000a)
        * frame #0: 0x000000010000b9bb sim`image_list_t::get_image(this=0x00006f7c6b5b0002, i=18) const at image_list.h:34
          frame #1: 0x0000000100047604 sim`bridge_desc_t::get_background(this=0x00000001230c0000, img=N_Ramp2, season='\0') const at bridge_desc.h:69
          frame #2: 0x0000000100047d70 sim`bridge_desc_t::has_double_ramp(this=0x00000001230c0000) const at bridge_desc.cc:129
          frame #3: 0x000000010000457e sim`bridge_builder_t::find_end_pos(player=0x000000010dbee8f0, pos=(x = 151, y = 222, z = '\x03'), zv=(x = 0, y = -1), desc=0x00000001230c0000, error_msg=0x00007fff5fbfb0d8, bridge_height=0x00007fff5fbfb0e7, ai_bridge=false, min_length=5, high_bridge=false) at brueckenbauer.cc:334
          frame #4: 0x000000010045a80a sim`tool_build_bridge_t::do_work(this=0x00000001280799e0, player=0x000000010dbee8f0, start=0x0000000128079a15, end=0x00007fff5fbfb220) at simtool.cc:2705
          frame #5: 0x000000010043b889 sim`two_click_tool_t::work(this=0x00000001280799e0, player=0x000000010dbee8f0, pos=(x = 151, y = 217, z = '\x03')) at simmenu.cc:1008
          frame #6: 0x000000010023ac16 sim`nwc_tool_t::do_command(this=0x000000012807e5f0, welt=0x000000012d5e3400) at network_cmd_ingame.cc:1196
          frame #7: 0x00000001004a3156 sim`karte_t::do_network_world_command(this=0x000000012d5e3400, nwc=0x000000012807e5f0) at simworld.cc:6482
          frame #8: 0x00000001004a2c00 sim`karte_t::process_network_commands(this=0x000000012d5e3400, ms_difference=0x00007fff5fbfb92c) at simworld.cc:6431
          frame #9: 0x00000001004a373f sim`karte_t::interactive(this=0x000000012d5e3400, quit_month=2147483647) at simworld.cc:6585
          frame #10: 0x0000000100431f7d sim`simu_main(argc=2, argv=0x00007fff5fbffb00) at simmain.cc:1342
          frame #11: 0x000000010044b29d sim`sysmain(argc=2, argv=0x00007fff5fbffb00) at simsys.cc:827
          frame #12: 0x00000001004da422 sim`main(argc=2, argv=0x00007fff5fbffb00) at simsys_s2.cc:793
          frame #13: 0x00007fffe8d4d235 libdyld.dylib`start + 1

      What's wrong?


      Quote
      For lane fixing, how about renaming to lane affinity?
      IMHO, The nuance of "affinity" is weak. How about lane instruction of lane pinning?
      Quote
      When a stopped convoi changes lanes immediately upon starting to move, it's graphic is left behind as a glitch in it's former lane. The marking dirty mechanisms for moving objects is quite a hack, but this patch is introducing some new behaviours that the hack isn't handling, so needs changes.
      Where is the process related to this hack written?
      Title: Re: One-way Two-lane road Fun Patch
      Post by: THLeaderH on August 10, 2017, 12:15:18 PM
      I tried to fix some issues suggested by TurfIt. The new patch file can be downloaded from here. (https://drive.google.com/open?id=0B_rSte9xAhLDb0RkV0xRSThMaUU)
      The solved issues are
      • Overtaking mode selection of way does work in multiplayer.
      • Dealing with indications of incompletion.
      • The one-way roadsign lane fixing works in multiplayer. The selection is now synchronized across clients.
      • Overtaking_mode and ribi_mask_oneway were moved from weg_t to strasse_t.
      Renaming of lane_fix is undone. I still can't determine what is a proper name for that.

      And I couldn't solve these issues :(
      • Overtaking mode selection of bridge and tunnel does not work in multiplayer. I tried to use default_param to handle overtaking_mode but it resulted in out-of-range access and the cause is unknown.
         See also. (http://forum.simutrans.com/index.php?topic=16659.msg164685#msg164685)
      • When a stopped convoi changes lanes immediately upon starting to move, it's graphic is left behind as a glitch in it's former lane. I couldn't find where to edit to change marking dirty mechanisms.
      Since I cannot deal with these problems by myself, I have to wait for somebody who solves these or gives me an additional information.
      Title: Re: One-way Two-lane road Fun Patch
      Post by: Dwachs on August 31, 2017, 09:30:01 PM
      The crash report with bridge building seems to be strange. The desc pointer is not NULL but the data of the desc structure seems to be corrupt somehow.

      You can send the overtaking mode information with the help of tool_build_bridge_t::rdwr_custom_data(memory_rw_t *packet), and implement it for roads/tunnel tools as well.
      Title: Re: One-way Two-lane road Fun Patch
      Post by: TurfIt on August 31, 2017, 11:29:48 PM
      From what I'd seen, there were several places where the extra information added to default param wasn't stripped back out before it was used to find the desc resulting in weird descs.
      But, great timing,  I literally just finished changing the patch to use the rdwr_custom_data to pass the info instead of default param - much simpler! I'll post the patch for that once I get git to stop producing stupid patches...

      EDIT:
      GIT still deserves a place in the trash bin.... How hard is it to sensibly handle LF vs CRLF? sheesh.

      Attached a patch that should be for ontop of  38dd8065 in your github branch.
      Note: the v11_2.patch you posted on the 10th is bad - stowaway junk. Would've been easier had that worked...

      Issues remaining as I see it:
      Minor - lane fixing wording -> I still think affinity is the correct / sensible word here. See setting a processes' processor affinity to 'pin' to a particular CPU as an example or precedent usage.
      Medium - stopped convoi changing lanes on restarting graphics glitch. -> will look at giving you a pointer to the many places this is hacked in.
      Major - convoi changing lanes overlapping with vehicle in the other lane due to not taking into account trailers in tiles behind.
      Major - lane fixing appears completely non-functional. See the previous post on this - I never seen a response.
      Medium - building only a tunnel portal (i.e. With CTRL held) results in overtaking mode selection dialog opening.
      Major - requires the show ribi patch too IMO for usability. See comments in that thread from a month ago...
      Disagreement - merging of ribi_mask with ribi_mask_oneway. -> I still think the latter is redundant - two things doing the same thing... Require third party mediator!
      Title: Re: One-way Two-lane road Fun Patch
      Post by: Dwachs on September 01, 2017, 08:06:46 AM
      Quote
      Disagreement - merging of ribi_mask with ribi_mask_oneway. -> I still think the latter is redundant - two things doing the same thing... Require third party mediator!
      I also do not like this. In particular, as this patch also makes the trivial method weg_t::get_ribi virtual. Why not merging all masking into the existing member variable ribi_mask?
      Title: Re: One-way Two-lane road Fun Patch
      Post by: THLeaderH on September 02, 2017, 10:17:08 AM
      Thank you, TurfIt. Your patch is now applied on my OTRP brunch and that can be seen here (https://github.com/teamhimeh/simutrans/commit/390e54f574e82a1efa9bc76ff97249be3d90b513). It worked fine.

      Quote
      Minor - lane fixing wording -> I still think affinity is the correct / sensible word here. See setting a processes' processor affinity to 'pin' to a particular CPU as an example or precedent usage.
      OK, I'll start the renaming of this.

      Quote
      Medium - stopped convoi changing lanes on restarting graphics glitch. -> will look at giving you a pointer to the many places this is hacked in.
      Amm... I haven't found how to solve this yet :( I'll be so glad if someone deals with this issue.

      Quote
      Major - convoi changing lanes overlapping with vehicle in the other lane due to not taking into account trailers in tiles behind.
      I'll start solving this issue.

      Quote
      Major - lane fixing appears completely non-functional. See the previous post on this - I never seen a response.
      This bug is fixed in this commit (https://github.com/teamhimeh/simutrans/commit/87cfdcda48d2ed7a6ac60fb66e6d0baaef3be568). I confirmed that the lane affinity works fine on a local game and network game. Please tell me if any problems remain on the latest version on GitHub.

      Quote
      Medium - building only a tunnel portal (i.e. With CTRL held) results in overtaking mode selection dialog opening.
      I'll deal with this issue too.

      Quote
      Major - requires the show ribi patch too IMO for usability. See comments in that thread from a month ago...
      I'll answer to this in that thread. I'm still thinking about it.

      Quote
      Disagreement - merging of ribi_mask with ribi_mask_oneway. -> I still think the latter is redundant - two things doing the same thing... Require third party mediator!
      If ribi_mask and ribi_mask_oneway are combined, a way cannot distinguish whether the change of ribi_mask is caused by a road sign or rewriting of oneway road. This becomes a problem when we remove a oneway road sign because we cannot correctly assume how to set ribi_mask.
      Of course, it would be far better without ribi_mask_oneway. If you succeeded in implemeting without ribi_mask_oneway, please notify me and I'll integrate that.
      Title: Re: One-way Two-lane road Fun Patch
      Post by: THLeaderH on September 07, 2017, 05:58:57 AM
      I'm implementing overtaking logic for a road train, but I meet a question.
      Should a road train be allowed to overtake other vehicle?

      Definition: a road train is a convoy whose length is more than one tile.
      Title: Re: One-way Two-lane road Fun Patch
      Post by: Leartin on September 07, 2017, 09:14:34 AM
      Since this might be forgotten when thinking of road trains: In early times, you might have carriages with two sets of horses to be faster than a carriage with one set of horses, just a horse, or even an ox. You would expect the faster, longer carriages to overtake shorter, slower carriages, even if they are over a tile long.
      Title: Re: One-way Two-lane road Fun Patch
      Post by: Ters on September 07, 2017, 03:29:06 PM
      I don't think Simutrans needs or should make a distinction between vehicles made up of two parts and those made up of more than that. Vehicles that is just a truck and trailer do overtake slower vehicles, especially when there are multiple lanes in the same direction.
      Title: Re: One-way Two-lane road Fun Patch
      Post by: Andyh on September 10, 2017, 05:26:54 PM
      I don't think Simutrans needs or should make a distinction between vehicles made up of two parts and those made up of more than that. Vehicles that is just a truck and trailer do overtake slower vehicles, especially when there are multiple lanes in the same direction.

      I agree.  I think that's an unnecessary distinction.  Unless the coding becomes orders of magnitude harder, I think the new overtaking behavior should apply to all road convoys regardless of length.
      Title: Re: One-way Two-lane road Fun Patch
      Post by: Isaac.Eiland-Hall on September 10, 2017, 06:39:07 PM
      I have watched television programs about road trains where they are most common: Australia. Road trains most certainly pass slow-moving cars, or even moderately moving cars.
      Title: Re: One-way Two-lane road Fun Patch
      Post by: THLeaderH on September 14, 2017, 09:15:46 AM
      There is a theoretical problem.

      (https://pbs.twimg.com/media/DJqaji7V4AAsm4_.jpg)

      When a car turns right and another car goes straight, these two cars often cause head on crash and get stuck.
      This is because the tiles of the intersection is oneway mode. Generally a vehicle on passing lane move to traffic lane at the point that overtaking mode changes from oneway to twoway.  The car that is turning right is on passing lane in the intersection, then causes this head on crash.

      (https://pbs.twimg.com/media/DJqaksXUMAAIV-n.jpg)

      Seeing real intersections, tiles of a intersection should be treated as oneway mode when a vehicle enters there from oneway mode road and leaves for oneway mode road. Otherwise the tiles should be treated as twoway mode. However, we cannot apply this rule to OTRP.
      Consider the exit of highway. If this rule were applied, the divergent point is treated as twoway mode for vehicles that get off highway at this exit, but it's inappropriate because the vehicle suddenly moves to traffic lane in spite of the fact that the exit exists on the passing lane side. This also requires that traffic lane is empty though the vehicle does not need the traffic lane.

      (http://simutrans-germany.com/files/upload/%E3%82%B9%E3%82%AF%E3%83%AA%E3%83%BC%E3%83%B3%E3%82%B7%E3%83%A7%E3%83%83%E3%83%88_2017-09-14_%E5%8D%88%E5%BE%8C5.48.31.png)

      How can we deal with this problem?
      Title: Re: One-way Two-lane road Fun Patch
      Post by: Leartin on September 14, 2017, 11:05:27 AM
      Do I understand correctly that problems arise only on highway exits on the side of the overtaking lane? I'm sure there are highway exits on both sides in some countries, especially if you can also overtake on both sides, but if there is a slower lane and a faster lane and only one side you are allowed to overtake on - as it would be in Simutrans - exits are usually always on the slower side. Makes sense - sometimes Trucks are even forbidden to use the faster lane, so they could never exit on that side. So perhaps it's okay if players have to build their exits on the slow side as well?
      Title: Re: One-way Two-lane road Fun Patch
      Post by: THLeaderH on September 14, 2017, 12:09:10 PM
      It's not reasonable to prohibit players to build an exit on the faster lane side because there are many examples that a exit exists on the faster lane side. Even if we tried to do so, it's so difficult because simutrans cannot distinguish through traffic and an exit.
      Quote
      Do I understand correctly that problems arise only on highway exits on the side of the overtaking lane?
      This is what I recognized. There can be more situation that becomes a problem.
      Title: Re: One-way Two-lane road Fun Patch
      Post by: Leartin on September 14, 2017, 01:22:00 PM
      It's not reasonable to prohibit players to build an exit on the faster lane side because there are many examples that a exit exists on the faster lane side. Even if we tried to do so, it's so difficult because simutrans cannot distinguish through traffic and an exit.This is what I recognized. There can be more situation that becomes a problem.
      In Germany, there are four exits on the left, unintentional, so I wouldn't think of it as an unreasonable rule in the game, even if it does not hold true for the whole world - rarely anything ever does. But I'm not saying it should be artificially prohibited, just that I would accept it as an internal game oddity that exits on the wrong side are quirky.

      Though, you stated if a vehicle both enters and exits to one-way-mode, the intersection would be one-way as well, otherwise it's two-way to avoid colission like in the first screen. But with an highway exit, everything is one-way anyway, so there is no reason to make the intersection two-way?
      Title: Re: One-way Two-lane road Fun Patch
      Post by: THLeaderH on September 14, 2017, 02:50:38 PM
      Quote
      Though, you stated if a vehicle both enters and exits to one-way-mode, the intersection would be one-way as well, otherwise it's two-way to avoid colission like in the first screen. But with an highway exit, everything is one-way anyway, so there is no reason to make the intersection two-way?
      Yes, there is no reason to make the intersection of highway two-way. However, simutrans cannot know whether the road is a highway or a local street.
      Title: Re: One-way Two-lane road Fun Patch
      Post by: Ters on September 14, 2017, 06:22:53 PM
      As it currently seems to be implemented, all one-way roads seems to be highways with a slow land and a fast lane. Local streets that have two or more lanes in the same direction in real life (as I have experienced it), doesn't so much have a fast lane and a slow lane as turn-left lanes and turn-right lanes. Those going straight ahead may have dedicated lanes for that, or they may overlap with either or both of the turn lanes.
      Title: Re: One-way Two-lane road Fun Patch
      Post by: Leartin on September 15, 2017, 05:40:36 AM
      Local streets that have two or more lanes in the same direction in real life (as I have experienced it), doesn't so much have a fast lane and a slow lane as turn-left lanes and turn-right lanes. Those going straight ahead may have dedicated lanes for that, or they may overlap with either or both of the turn lanes.
      In Austria, you have free choice of lanes in cities, while on all roads outside cities you have to drive on the rightmost lane unless you are overtaking. However, even in cities people generally use the right lane as the slower lane (trucks, old men with hat) and the left lane as the faster lane (BMW, Audi,...) as long as they are going straight. I don't think turn-lanes (as in cities skylines?) would make much sense in Simutrans, since it would require all cars to know where they will go at the next intersection that is not straight - at least for citycars, that's not true.

      Quote
      Yes, there is no reason to make the intersection of highway two-way. However, simutrans cannot know whether the road is a highway or a local street.
      As long as there is only one direction cars can enter the intersection OR one direction cars can leave the intersection, it's impossible for traffic to get stuck anyway, so there is no need for cars to switch lanes on the intersection. If there are more than one entry and more then one exit, the intersection needs to be Two-way in order to always allow traffic to move both directions.


      Title: Re: One-way Two-lane road Fun Patch
      Post by: isidoro on September 15, 2017, 10:42:02 PM
      [..]
      I don't think turn-lanes (as in cities skylines?) would make much sense in Simutrans, since it would require all cars to know where they will go at the next intersection that is not straight - at least for citycars, that's not true.
      [...]

      That wouldn't pose a difficult question.  Citycars could make their decision in advance, whichever method they use now, write it in a variable and use it when reaching the intersection, couldn't they?
      Title: Re: One-way Two-lane road Fun Patch
      Post by: Ters on September 15, 2017, 10:48:52 PM
      Citycars could make their decision in advance, whichever method they use now, write it in a variable and use it when reaching the intersection, couldn't they?

      Not really. City cars don't have any idea of where they are going beyond the tile they are in. So they can't make any decision on which turn to make in an upcoming intersection, because they don't know that there is an intersection until they more or less are in it. Giving city cars some idea of where they are going has been shot down several times before as causing a too high increase in memory, CPU or both for something that has no relevance to the gameplay (except getting in the way).
      Title: Re: One-way Two-lane road Fun Patch
      Post by: isidoro on September 16, 2017, 10:05:00 PM
      Then, perhaps, they can choose a lane at random and, when reaching an intersection, only do what is possible from the lane they are in.

      They can even change lanes from time to time randomly, as well.
      Title: Re: One-way Two-lane road Fun Patch
      Post by: Leartin on September 17, 2017, 08:52:18 AM
      The whole point of two lanes is that faster vehicles can overtake slower vehicles, though. If citycars choose lanes at random, with just two cars you already have a 50% chance that they are on both lanes, blocking the road for any faster vehicles. If they would move away from the left lane for vehicles coming from behind, player vehicles would influence where a citycar goes - and that should not be the case, as the player should think they have a specific destination.
      Title: Re: One-way Two-lane road Fun Patch
      Post by: Ters on September 17, 2017, 10:56:35 AM
      In other words, every two-lane way is a highway, not a local street.
      Title: Re: One-way Two-lane road Fun Patch
      Post by: THLeaderH on September 22, 2017, 01:57:02 PM
      Here is a new release of One-way Two-lane Road Patch, OTRP ver12.
      This time, the patch file and the executable binaries are simutrans nightly r8293 based, and the patch can be easily integrated to the nightly trunk.
      Source code can be seen on git. https://github.com/teamhimeh/simutrans/tree/OTRP (https://github.com/teamhimeh/simutrans/tree/OTRP)

      patch:https://drive.google.com/file/d/0B_rSte9xAhLDTlBSMnBQb2cxQTQ/view?usp=sharing (https://drive.google.com/file/d/0B_rSte9xAhLDTlBSMnBQb2cxQTQ/view?usp=sharing)
      ~Executable Files~
      :simutrans: (The executable binaries include Ribi-arrow patch. Ribi-arrow pak is required. Please download from here (https://drive.google.com/open?id=0B_rSte9xAhLDanhta1ZsSVcwdzg) and put it into your pakset.)
      win:https://drive.google.com/file/d/0B_rSte9xAhLDTkhfVS1jLV9fVm8/view?usp=sharing (https://drive.google.com/file/d/0B_rSte9xAhLDTkhfVS1jLV9fVm8/view?usp=sharing)
      mac:https://drive.google.com/open?id=0B_rSte9xAhLDS2l3cTMwa0N1S2s (https://drive.google.com/open?id=0B_rSte9xAhLDS2l3cTMwa0N1S2s)
      :makeobj:
      There is no special makeobj. Please use the makeobj of simutrans standard!

      Be sure that this version cannot load sve data of previous versions of OTRP.
      Information for Japanese is available here. 日本語の情報はこちら。 (https://github.com/himeshi-hob/simutrans/blob/seminar/documentation/OTRP_v12_information.md)

      ~Issue list~ (Also see this post (http://forum.simutrans.com/index.php?topic=16659.msg165286#msg165286).)
      • The problem that the construction of road does not work in online game is fixed.
      • The problem that a stopping convoy causes graphic glitch when changing its lane is not fixed. A solution is still wanted.
      • The overtaking algorithm now covers long convoy.
      • Word "lane fixing" is changed to "lane affinity".
      • The problem that building only a tunnel portal (i.e. With CTRL held) results in overtaking mode selection dialog opening is not fixed. I have certainly saw this phenomenon, but I couldn't reproduce this issue. Please tell me how to reproduce this if there is anyone who knows about this issue.

      The last major problem for the integration is the graphic glitch. If there are any major problems to be solved, please notify me.

      Any bug reports and ideas for improvement are welcome!
      Title: Re: One-way Two-lane road Fun Patch
      Post by: Junna on September 22, 2017, 02:55:40 PM
      Where do I get those fancy road dat/pak though? ABNA is down and ebi deleted the git downloads?
      Title: Re: One-way Two-lane road Fun Patch
      Post by: IgorEliezer on September 22, 2017, 08:08:38 PM
      :simutrans: (The executable binaries include Ribi-arrow patch.)
      Crashed. It's missing RibiArrow pakfile. Intended?

      ----

      Where do I get those fancy road dat/pak though? ABNA is down and ebi deleted the git downloads?
      Here: http://forum.simutrans.com/index.php?topic=17273.0. There's a download link in the 2nd paragraph.

      I installed the pakfile, it's working now.
      Title: Re: One-way Two-lane road Fun Patch
      Post by: THLeaderH on September 22, 2017, 11:50:23 PM
      Crashed. It's missing RibiArrow pakfile. Intended?
      Oops, I forgot to write about it. Yes, this binary requires RibiArrow pakfile. Of course, the code does not contain RibiArrow patch.
      Title: Re: One-way Two-lane road Fun Patch
      Post by: Junna on September 23, 2017, 12:12:13 AM

      Here: http://forum.simutrans.com/index.php?topic=17273.0. There's a download link in the 2nd paragraph.

      I was referring to the motorway graphics as seen


      (http://simutrans-germany.com/files/upload/%E3%82%B9%E3%82%AF%E3%83%AA%E3%83%BC%E3%83%B3%E3%82%B7%E3%83%A7%E3%83%83%E3%83%88_2017-09-14_%E5%8D%88%E5%BE%8C5.48.31.png)

      in the above post. I have an ancient version of this that doesn't work right--where's the new fancy one from?
      Title: Re: One-way Two-lane road Fun Patch
      Post by: THLeaderH on September 23, 2017, 01:16:55 AM
      Though v12 lost compatibility with v11 in a save data, I made a special binary which enables us to upgrade data of v11 to that of v12. This method can be applied only to a data of v11.
      • With the upgrade binary, load a data of v11 and save immediately.
      • With OTRP v12, load the data which you saved before and save immediately.
      windows: https://drive.google.com/file/d/0B_rSte9xAhLDb3hhWERUUWpidEU/view?usp=sharing (https://drive.google.com/file/d/0B_rSte9xAhLDb3hhWERUUWpidEU/view?usp=sharing)
      code: https://github.com/teamhimeh/simutrans/tree/OTRP-upgrade11-12 (https://github.com/teamhimeh/simutrans/tree/OTRP-upgrade11-12)
      Title: Re: One-way Two-lane road Fun Patch
      Post by: THLeaderH on September 24, 2017, 09:42:34 AM
      I fixed a bug that a convoy moves to traffic lane when it stops on inverted mode roads. It is already pushed to GitHub.
      Title: Re: One-way Two-lane road Fun Patch
      Post by: franc055 on September 28, 2017, 12:53:23 AM
      I think they should make a video tutorial on how to install this patch because I really do not understand how to install it in my simutrans I am new and I would like them to make a short video of how to place the files in their respective places for the patch to work.

      PD: I am Mexican and I am using the Google Translator that my English is bad.

      Mod note: please avoid the use of text formatting (http://forum.simutrans.com/index.php?topic=4529.0#post_item4g) (like colors, bold, CAPS LOCK and font size) when it makes the reading difficult or when it is not necessary.
      ~IgorEliezer
      Title: Re: One-way Two-lane road Fun Patch
      Post by: Ters on September 28, 2017, 05:24:23 AM
      That does not excuse shouting.
      Title: Re: One-way Two-lane road Fun Patch
      Post by: danivenk on September 29, 2017, 07:00:03 PM
      Though v12 lost compatibility with v11 in a save data, I made a special binary which enables us to upgrade data of v11 to that of v12. This method can be applied only to a data of v11.
      • With the upgrade binary, load a data of v11 and save immediately.
      • With OTRP v12, load the data which you saved before and save immediately.
      windows: https://drive.google.com/file/d/0B_rSte9xAhLDb3hhWERUUWpidEU/view?usp=sharing (https://drive.google.com/file/d/0B_rSte9xAhLDb3hhWERUUWpidEU/view?usp=sharing)
      code: https://github.com/teamhimeh/simutrans/tree/OTRP-upgrade11-12 (https://github.com/teamhimeh/simutrans/tree/OTRP-upgrade11-12)
      About this converter, I used this on a big map in which I use the OTR-patch. Unfortunately it removed all (and I mean literally) overtake roads (oneways, which I only used). Is there any possible way to convert to v12 without having to remake ALL oneways in the whole map...?

      EDIT: Also the Patch seems to lag a lot...
      Title: Re: One-way Two-lane road Fun Patch
      Post by: THLeaderH on September 30, 2017, 04:02:56 AM
      The converter can process only v11 data. Is your data that of v11?
      Another method you can take is using
      http://forum.simutrans.com/index.php?topic=16659.msg164233#msg164233 (http://forum.simutrans.com/index.php?topic=16659.msg164233#msg164233)
      and
      http://forum.simutrans.com/index.php?topic=16659.msg164245#msg164245 (http://forum.simutrans.com/index.php?topic=16659.msg164245#msg164245)

      EDIT: Also the Patch seems to lag a lot...
      Performance issue is important for OTRP. Could you explain it more? Comparison with simutrans standard is appreciated.
      Title: Re: One-way Two-lane road Fun Patch
      Post by: danivenk on September 30, 2017, 04:49:16 PM
      Performance issue is important for OTRP. Could you explain it more? Comparison with simutrans standard is appreciated.
      Well my save data is indeed v11. Especially when I try creating roads/rails the game just freezes for a few seconds and then continues after that...

      Title: Re: One-way Two-lane road Fun Patch
      Post by: THLeaderH on October 01, 2017, 07:15:54 AM
      This is a minor update of One-way Two-lane Road Patch, OTRP ver12_2.
      This time, the patch file and the executable binaries are simutrans nightly r8297 based, and the patch can be easily integrated to the nightly trunk.
      Source code can be seen on git. https://github.com/teamhimeh/simutrans/tree/OTRP (https://github.com/teamhimeh/simutrans/tree/OTRP)

      patch:https://drive.google.com/open?id=0B_rSte9xAhLDZHc4REwxYWJZenM (https://drive.google.com/open?id=0B_rSte9xAhLDZHc4REwxYWJZenM)
      ~Executable Files~
      :simutrans: (The executable binaries include Ribi-arrow patch. Ribi-arrow pak is required. Please download from here (https://drive.google.com/open?id=0B_rSte9xAhLDanhta1ZsSVcwdzg) and put it into your pakset.)
      win:https://drive.google.com/open?id=0B_rSte9xAhLDMEZ0OEFfWkZYTWc (https://drive.google.com/open?id=0B_rSte9xAhLDMEZ0OEFfWkZYTWc)
      mac:https://drive.google.com/open?id=0B_rSte9xAhLDVmNQaVpKNXhGWWM (https://drive.google.com/open?id=0B_rSte9xAhLDVmNQaVpKNXhGWWM)

      To use ribi-arrow, add
      Code: [Select]
      simple_tool[37]=,:into menuconf.tab.
      This version can read a save data of ver12.
      Information for Japanese is available here. 日本語の情報はこちら。 (https://github.com/himeshi-hob/simutrans/blob/seminar/documentation/OTRP_v12_information.md)

      ~How to use this patch~
      • Download ribi-arrow pak and put it into your pakset.
      • Assign an appropriate key to simple tool 37. Add simple_tool[37]=,: into menuconf.tab and you can use ribi-arrow using the colon key.
      • Download an executable file and put it in the directory where simutrans.exe exists.
      • Execute the OTRP file. Please do not overwrite your save data of simutrans standard.

      On this version,
      • The graphic glitch problem is solved! If a glitch still happens in this version, please notify me.
      • The bug that a vehicle on inverted mode road moves to traffic lane when stopping at a halt is fixed.

      I think all major bugs are solved. Is there a major bug needed to be solved for integration?

      Any bug reports and ideas for improvement are welcome!
      Title: Re: One-way Two-lane road Fun Patch
      Post by: THLeaderH on October 05, 2017, 04:48:12 AM
      I fixed the bug that the direction does not set correctly when you build a bridge. And I'm dealing with the last bug I know, the issue that overtaking mode setting window often appears when ctrl key is pressed.
      The reason of the bug is obvious. two_click_tool_t calls init() when the cursor is on the start position. Please see here. (https://github.com/teamhimeh/simutrans/blob/OTRP/simmenu.cc#L1025-L1027) Removing these lines solves this bug. However, why does two_click_tool_t call init() when the cursor is on the start position?
      Title: Re: One-way Two-lane road Fun Patch
      Post by: thegamer7893 on October 06, 2017, 03:21:51 PM
      Honestly, I just want to know when it will be available for use in the pak128.britain pakset and on the extended version of simutrans but that sounds good. :)
      Title: Re: One-way Two-lane road Fun Patch
      Post by: jamespetts on October 06, 2017, 03:36:47 PM
      Implementation in Extended is likely to come after it has been fully integrated into Standard. Quite how long after is hard to say: that will depend on how much work that it will take to integrate, which will, in turn, depend on how much that this code affects code in Extended that differs from Standard, which I do not know at this stage, as well as how busy that I am at the relevant time and whether anyone else is willing and able to assist with integration. I am certainly keen in principle for this to be integrated.
      Title: Re: One-way Two-lane road Fun Patch
      Post by: thegamer7893 on October 06, 2017, 09:02:13 PM
      Nice. Ok.
      Title: Re: One-way Two-lane road Fun Patch
      Post by: THLeaderH on October 11, 2017, 02:06:29 PM
      This is a minor update of One-way Two-lane Road Patch, OTRP ver12_3.
      This time, the patch file and the executable binaries are simutrans nightly r8301 based, and the patch can be easily integrated to the nightly trunk.
      Source code can be seen on git. https://github.com/teamhimeh/simutrans/tree/OTRP (https://github.com/teamhimeh/simutrans/tree/OTRP)

      patch:https://drive.google.com/open?id=0B_rSte9xAhLDampoVkdsdE45NFE (https://drive.google.com/open?id=0B_rSte9xAhLDampoVkdsdE45NFE) (This does not include Ribi-Arrow patch.)
      ~Executable Files~
      :simutrans: (The executable binaries include Ribi-arrow patch. Ribi-arrow pak is required. Please download from here (https://drive.google.com/open?id=0B_rSte9xAhLDanhta1ZsSVcwdzg) and put it into your pakset.)
      win:https://drive.google.com/open?id=0B_rSte9xAhLDTnFFanBNeDMzVmM (https://drive.google.com/open?id=0B_rSte9xAhLDTnFFanBNeDMzVmM)

      To use ribi-arrow, add
      Code: [Select]
      simple_tool[37]=,:into menuconf.tab.
      This version can read a save data of ver12.

      ~How to use this patch~
      • Download ribi-arrow pak and put it into your pakset.
      • Assign an appropriate key to simple tool 37. Add simple_tool[37]=,: into menuconf.tab and you can use ribi-arrow using the colon key.
      • Download an executable file and put it in the directory where simutrans.exe exists.
      • Execute the OTRP file. Please do not overwrite your save data of simutrans standard.

      On this version,
      • I did some more fix of the graphic glitch problem.
      • Some duplicated declaration of methods are removed.
      • The issue that overtaking mode selection window sometimes appears is fixed.

      I think all bugs I know is now removed. So, I set this version as a candidate for the integration again!
      Any bug reports and ideas for improvement are welcome!
      Title: Re: One-way Two-lane road Fun Patch
      Post by: THLeaderH on October 14, 2017, 02:14:42 PM
      I found a small but a severe bug - the issue that simutrans often stops by SEGV while loading a game - and fixed it. These are the fixed code and binary.
      patch:https://drive.google.com/open?id=0B_rSte9xAhLDNElXMmY4LUFGVXM (https://drive.google.com/open?id=0B_rSte9xAhLDNElXMmY4LUFGVXM)
      binary for windows: https://drive.google.com/open?id=0B_rSte9xAhLDc09PT1phTXphS0U (https://drive.google.com/open?id=0B_rSte9xAhLDc09PT1phTXphS0U)
      CHG: simconvoi.cc::L4039

      By the way, is anyone doing a code review or something?
      Title: Re: One-way Two-lane road Fun Patch
      Post by: TurfIt on October 15, 2017, 09:16:41 PM
      I think all bugs I know is now removed. So, I set this version as a candidate for the integration again!
      Given issues brought up in April are still left unaddressed - hardly...
      Logic incomplete and even flagged with TODO's, yet still left.
      Road trains driving right through each other.

      And then direct request from July ignored - lane fixing/affinity that doesn't seem to do anything at all. Still no example demonstrating correct behavior.

      I'd spent 4 weeks with the v11 code. Intended to setup some simple test cases, but got completely bogged in the code instead - can't create a test case for things that make absolutely no sense.
      My notes on suspicious code devolve from simply huh's to stuff not fit to post as the WTF'ery factor increases the deeper one looks.  3 weeks later and my mood has not improved.

      Since past lists of specific issues were take too literal, no more detailed specifics. I'd suggest reading through the patch file, and the resultant code. Make sure it's complete. Make sure comments make sense, especially after cut'n' paste jobs. Make sure logical conditions make sense, not testing for things already tested for (I even found one testing the same condition in the same if()!). No state changes in query functions (likely the source of my lane fix/affinity issues). Maybe try using this new fangled keyword called 'else'. if(a), if(!a) yeesh. Avoid revenue being affected by traffic conditions - hint lane yielding.

      And a quick peek at v12 - refleshing. what? I can't even...



      Title: Re: One-way Two-lane road Fun Patch
      Post by: THLeaderH on October 17, 2017, 03:26:00 AM
      TurfIt, I appreciate your spending of 4 weeks for the code review.
      You claimed that
      • Lane fixing/affinity that doesn't seem to do anything at all. Still NO example demonstrating correct behavior.
      • Road trains driving right through each other.
      but I have never seen these phenomena as long as I use otrp v12_3. I made a demonstrating video.

      As you insisted, I'll read through the whole patch file again. Also, I'll deal with the issues you listed here. However, unfortunately, writing on this forum scatters the issue reports in many messages and thread. Even your great advice will be surely buried by other many many posts on this topic. So I enabled the issues feature of GitHub. With the issues feature of GitHub, you can point out exactly where of the code is problem. Also you can always work with the latest code.
      You spent no less than 4 weeks to do such a sensitive code inspection. Please write about  anything you doubt, anything you say huh about, anything you find incomplete, and anything you feel wrong as the issues on GitHub instead of scattering bug reports, writing something ironical, posting a vague indication on the forum, and keeping a great amount of your analysis in your private note, even though you think Git should be in a trash bin. Please make your issue posts as concrete as possible. For example of if ~ else, please point out at least 1 line that is malformed.
      Please also use pull requests if you need.

      The OTRP repository on GitHub is here (https://github.com/teamhimeh/simutrans/tree/OTRP). Thank you for your cooperation.
      Title: Re: One-way Two-lane road Fun Patch
      Post by: Andyh on November 07, 2017, 03:21:03 AM
      Possible to get this patch implemented, or are we at a complete impasse?  It's a huge improvement over the existing functionality so would hate to see this fail.  I hope we are not making 'the perfect the enemy of the good'.
      Title: Re: One-way Two-lane road Fun Patch
      Post by: Ters on November 07, 2017, 06:03:35 AM
      It doesn't look like TurfIt is asking for perfection, just saying that applying this patch now will introduce severe bugs and reduce the quality of the code (which in turn affects others people ability or willingness to work with it).
      Title: Re: One-way Two-lane road Fun Patch
      Post by: THLeaderH on November 07, 2017, 06:16:27 AM
      There is still no issues posted...
      (http://simutrans-germany.com/files/upload/hoh.png)
      Title: Re: One-way Two-lane road Fun Patch
      Post by: Ters on November 07, 2017, 06:31:23 AM
      Simutrans development coordination happens on this forum. We don't use issue trackers.
      Title: Re: One-way Two-lane road Fun Patch
      Post by: TurfIt on November 07, 2017, 05:33:58 PM
      • Lane fixing/affinity that doesn't seem to do anything at all. Still NO example demonstrating correct behavior.
      Yes, I can have a vehicle forced into the passing lane for a while as your latest video shows. As a player, why would I want to do this? And why shouldn't the truck do it itself if required?

      In your previous video, I took from a different purpose for this roadsign when selected to the driving lane. I thought the intent of the sign was to prevent a vehicle that's going to exit a highway at the next exit from entering the passing lane and getting stuck there. I can't make this work, but again, why as a player do I have to manually do this?

      And, looking at the relevant variables in debug as a vehicle passes a oneway sign with the driving lane selected, absolutely nothing happens. Hence my claim of something broken, or me not understanding what this is actually supposed to be doing. So, thus far I still consider no example of correct behaviour having been provided.


      • Road trains driving right through each other.
      but I have never seen these phenomena as long as I use otrp v12_3. I made a demonstrating video.

      Example video showing truck driving right through a roadtrain's trailers: https://drive.google.com/open?id=15UnG71GBj8Of7vneVmF3V5pPoVZQ6H9f (https://drive.google.com/open?id=15UnG71GBj8Of7vneVmF3V5pPoVZQ6H9f)
      Quite easy to create many many anomalies whenever intersections are involved; Also when overtaking mode changes along a vehicles path - the logic just doesn't handle anything but the most simplistic road.
      Title: Re: One-way Two-lane road Fun Patch
      Post by: danivenk on November 09, 2017, 09:01:23 PM
      Today I found out that my OTR simutrans crashes when using R (Rotate). Also my simutrans runs really slow, I don't know if it is the fault of my big map (pak128+addons, 1024x1024\ about 500 convois) or it is the fault of the patch... I use OTR v12.3.2
      Title: Re: One-way Two-lane road Fun Patch
      Post by: THLeaderH on November 25, 2017, 03:28:14 PM
      This patch has not been updated for over a month, and I decided to suspend the development.
      Still I continue to distribute the binaries and follow the changes of the master brunch, but I cannot go further.
      If there is someone who want this feature in simutrans standard, it's someone in this forum that completes this patch, not me.
      Title: Re: One-way Two-lane road Fun Patch
      Post by: jamespetts on November 25, 2017, 03:30:22 PM
      This patch has not been updated for over a month, and I decided to suspend the development.
      Still I continue to distribute the binaries and follow the changes of the master brunch, but I cannot go further.
      If there is someone who want this feature in simutrans standard, it's someone in this forum that completes this patch, not me.

      That is rather a shame. I should be happy to have this in Extended with perhaps a few minor adjustments if you would like to work on that.
      Title: Re: One-way Two-lane road Fun Patch
      Post by: sheldon_cooper on November 26, 2017, 01:24:25 PM
      This patch has not been updated for over a month, and I decided to suspend the development.
      Still I continue to distribute the binaries and follow the changes of the master brunch, but I cannot go further.
      If there is someone who want this feature in simutrans standard, it's someone in this forum that completes this patch, not me.

      I'm sad about it, but thanks for developing such a wonderful and fantastic Patch. Thank you!
      Title: Re: One-way Two-lane road Fun Patch
      Post by: Andyh on December 10, 2017, 02:20:48 AM
      I'm sad about it, but thanks for developing such a wonderful and fantastic Patch. Thank you!


      I agree, but at least we can all now go back to the important things like expunging German from the Simutrans code.
      Title: Re: One-way Two-lane road Fun Patch
      Post by: THLeaderH on December 10, 2017, 07:10:49 AM
      Today I followed the commit of the master brunch and the binary for windows is available.
      The repository is r8346 based now.
      https://drive.google.com/open?id=15L3AY3wZ_bZuczHZQbRrBPXT2l_4S59E (https://drive.google.com/open?id=15L3AY3wZ_bZuczHZQbRrBPXT2l_4S59E)

      To understand how to use this patch, please see this post (https://forum.simutrans.com/index.php?topic=16659.msg166222#msg166222).
      Title: Re: One-way Two-lane road Fun Patch
      Post by: THLeaderH on January 11, 2018, 08:35:12 AM
      This is a small update of OTRP. I dealt with a bug that vehicles on the passing lane cannot restart when the crossing road is congested.
      The repository is r8365 based now. The binary for windows and mac is available.

      windows: https://drive.google.com/open?id=1O0YS4HvyBUgkv1m6jnpNMKJ8Qp76WVCd (https://drive.google.com/open?id=1O0YS4HvyBUgkv1m6jnpNMKJ8Qp76WVCd)
      mac: https://drive.google.com/open?id=1qQXHfgVybAPvE5AM7WMqLDl6qgtTAIVh (https://drive.google.com/open?id=1qQXHfgVybAPvE5AM7WMqLDl6qgtTAIVh)

      To understand how to use this patch, please see this post (https://forum.simutrans.com/index.php?topic=16659.msg166222#msg166222).
      Title: Re: One-way Two-lane road Fun Patch
      Post by: THLeaderH on March 25, 2018, 09:01:02 AM
      OTRP ver.13 was released.
      The commits of the master brunch were followed and this patch (https://forum.simutrans.com/index.php?topic=18016.msg171550;topicseen#msg171550) was included to the OTRP binary.
      v13 can load the data of v12.

      windows: https://drive.google.com/open?id=1BbZiIlxHeKO20Nq6tY_aeDI0CSM0LuqG (https://drive.google.com/open?id=1BbZiIlxHeKO20Nq6tY_aeDI0CSM0LuqG)
      mac: https://drive.google.com/open?id=1q_bf8UforE9-j_0eW6ySow2lxtGiYdCr (https://drive.google.com/open?id=1q_bf8UforE9-j_0eW6ySow2lxtGiYdCr)
      source to compile: https://github.com/teamhimeh/simutrans/tree/OTRP-distribute (https://github.com/teamhimeh/simutrans/tree/OTRP-distribute)

      To understand how to use this patch, please see this post (https://forum.simutrans.com/index.php?topic=16659.msg166222#msg166222).
      Title: Re: One-way Two-lane road Fun Patch
      Post by: prissi on March 27, 2018, 07:47:00 AM
      I have finally more free time ahead, and would like to see into the patch (and the performance issues). Although from what I saw that this endevour had become maybe a little too complex (like five overtaking modi and hidden flags by special tools) for the normal casual player.

      It may as well that a simpler approach to relaxed overtaking is needed, especially for performance. Anyway, in order to start looking into this, which is actually the current state. I see five active branches, which one I should check?

      (Also the patch files of github seems uneccessary large since a lot of identical lines (maybe with whitespaces) are contained within.)
      Title: Re: One-way Two-lane road Fun Patch
      Post by: THLeaderH on March 27, 2018, 08:20:36 AM
      Thank you for being interested in. "OTRP" branch is always the latest pure OTRP branch. "OTRP-distribute" branch is the branch for distribution, which contains ribi-arrow patch and signal open direction control patch. The others are obsolete.
      Title: Re: One-way Two-lane road Fun Patch
      Post by: sheldon_cooper on March 30, 2018, 06:08:26 PM
      Thanks for the new update! :D
      I do not understand how implementations of Patch files work in the simutrans game. So, I wonder if it is possible to add other Patch in this update, is it possible? If so, how should I do this?
      Title: Re: One-way Two-lane road Fun Patch
      Post by: THLeaderH on May 02, 2018, 11:59:45 AM
      OTRP ver.13_2 was released.
      The commits of the master brunch were followed and this version is r8424 based.
      v13_2 can load the data of v12 and v13.

      OTRP v13_2 was replaced by v13_21 because of a bug. Please see the post below to download.
      windows: https://drive.google.com/open?id=1YU_5fvANPZ4s6yj0gcan-325VDGm-KH3
      mac: https://drive.google.com/open?id=1q_bf8UforE9-j_0eW6ySow2lxtGiYdCr
      source to compile: https://github.com/teamhimeh/simutrans/tree/OTRP-distribute (https://github.com/teamhimeh/simutrans/tree/OTRP-distribute)

      In this version, a new overtaking_mode, halt mode, is introduced. The behavior of a vehicle in halt mode is basically same as oneway mode, but halt mode enables a vehicle to stop on the passing lane at a halt.

      To understand how to use this patch, please see this post (https://forum.simutrans.com/index.php/topic,16659.msg166222.html#msg166222).

      Bringing the modification of this version to simutrans extended takes some more time.
      Title: Re: One-way Two-lane road Fun Patch
      Post by: jamespetts on May 02, 2018, 05:51:02 PM
      This seems to be an interesting development - do I understand that this allows vehicles to overtake road vehicles waiting at stops even if the underlying road type is not the special one way road? If so, this would be extremely useful, both for Standard and Extended.
      Title: Re: One-way Two-lane road Fun Patch
      Post by: THLeaderH on May 03, 2018, 12:05:17 AM
      halt mode is one of the overtaking modes, that is listed as fig1.png.
      Even with oneway mode, a vehicle must go on the traffic lane when it stops at a halt to load passengers or cargo. However, with halt mode, a vehicle can stop on the passing lane to load passengers or cargo.
      The video in this tweet (https://twitter.com/himeshi_hob/status/991575671397695488) describes what is happening. Please note that the limitation in this video that a vehicle needs one clearance tile before the halt tile is already fixed.
      Title: Re: One-way Two-lane road Fun Patch
      Post by: jamespetts on May 03, 2018, 09:31:02 AM
      Interesting. Is there any reason for not making "halt mode" the default? Indeed, is there any reason for retaining "twoway" separately from "halt mode" - in other words, is there ever a reason for a player not to want halt mode enabled on a two way road?
      Title: Re: One-way Two-lane road Fun Patch
      Post by: THLeaderH on May 03, 2018, 10:08:12 AM
      Stopping on the passing lane for a long time is not good for traffic, regardless of overtaking_mode. On a twoway mode road, stopping on the passing lane totally blocks the facing traffic. On a normal twoway road, a bus usually won't go on the passing lane to load passengers even if there is a stopping vehicle in front of the bus. Halt mode should be used only for the dedicated places, such as a bus terminal, otherwise, stopping on the passing lane gives a bad effect for the traffic. This is why halt mode is not the default.

      Somebody may claim that halt mode should be used with twoway mode too because a bus terminal can consist of twoway roads. However, there is a technical issue to support both twoway mode and allowing to stop on the passing lane at once. On a halt tile whose road is twoway mode, a vehicle can make a turn. When making a turn, a vehicle moves from the lane to the another. If we allow a vehicle to stop on the passing lane, a vehicle that want to make a turn cannot make a turn because of the stopping vehicle on the other lane, or overlaps on the vehicle on the other lane and this should not happen. In my implementation, halt mode is an extension of oneway mode and a vehicle cannot make a turn on a halt mode tile. This avoids deadlocking and overlapping of vehicles.

      Therefore, halt mode is implemented as an extension of oneway mode, and stopping on the passing lane to load passengers cannot be supported on twoway roads. Players should use oneway mode or twoway mode for a halt on a normal street. Halt mode should be used on a dedicated place such as a bus terminal, where through traffic does not exist.
      Title: Re: One-way Two-lane road Fun Patch
      Post by: THLeaderH on May 04, 2018, 09:15:20 AM
      In OTRP v13_2, a bug that a vehicle was stuck before a choose sign was found. This bug was already fixed and released as v13_21. You can download the executable files from the links below.

      windows: https://drive.google.com/open?id=1Ypv05zz5Kpz1jNxKfNL35AkRCj_1RS4U (https://drive.google.com/open?id=1Ypv05zz5Kpz1jNxKfNL35AkRCj_1RS4U)
      mac: https://drive.google.com/open?id=17VdFzhilB_rEn9D3pt3hnLou0fA6Qw-k (https://drive.google.com/open?id=17VdFzhilB_rEn9D3pt3hnLou0fA6Qw-k)

      I already fixed this bug for ex-OTRP too.
      Title: [QUESTION] One-way Two-lane road Fun Patch
      Post by: thegamer7893 on May 04, 2018, 04:07:09 PM
      When will this be extended compliant James?
      Title: Re: One-way Two-lane road Fun Patch
      Post by: jamespetts on May 04, 2018, 09:36:38 PM
      THLeaderH - thank you - that is most helpful.

      Fam622 - it is not easy accurately to predict this, as it depends on how long that it takes me to do all higher priority work such as fixing bugs, and the amount of time that it takes to fix any given bug is inherently unknowable until the cause of the bug has been identified, which identification is often ~75% of the work in bug fixing.
      Title: Re: One-way Two-lane road Fun Patch
      Post by: THLeaderH on June 23, 2018, 03:22:17 AM
      Thank you for your support for OTRP project.
      OTRP was updated to ver14_2. Also, I made an English version of the users document. The download link and some more useful information are available on the web page below.
      https://github.com/teamhimeh/simutrans/blob/OTRP-distribute/documentation/OTRP_information_en.md (https://github.com/teamhimeh/simutrans/blob/OTRP-distribute/documentation/OTRP_information_en.md)

      Since there is no hope for the integration due to madness of the code, I introduced the separated version management of save data from the simutrans standard. This enables me to follow up new features in simutrans standard without a sacrifice of data compatibility. However, this change means that OTRP is no longer integrable into simutrans standard. Also, the meaning was lost that I maintain the two branches, OTRP and OTRP-distribute, separately. I haven't decided yet how to treat these two branches, but at this moment, only OTRP-distribute branch contains the latest improvement of this project. OTRP branch is not updated, preserving the code of version 13.

      Anyway, the changes of version 14 are as follows.
      • v14 is based on simutrans standard 120.3. Both data of 120.3 and that of OTRP v12 and 13 can be loaded, although a simple setting is required to load the data of OTRP v12 and 13. Please check the compatibility section of the document for this topic.
      • Vehicles stops before an intersection without a traffic light under certain conditions. This realizes more realistic behavior of motor vehicles and gives incentive for players to put a traffic light. This feature can be disabled with settings.
      • Simutrans standard 120.3 has a problem that the depot window can freeze when there are so many vehicle add-ons. OTRP v14 contains a solution for this problem. (I'll post a patch for this problem of the standard in another thread.)
      • Ribi-Arrow is showed only for street.

      Enjoy your OTRP life :)
      Title: Re: One-way Two-lane road Fun Patch
      Post by: THLeaderH on June 28, 2018, 02:04:43 PM
      OTRP was updated to ver14_4. To download the latest executable files, visit https://github.com/teamhimeh/simutrans/blob/OTRP-distribute/documentation/OTRP_information_en.md (https://github.com/teamhimeh/simutrans/blob/OTRP-distribute/documentation/OTRP_information_en.md)

      <updates for 14_3>
      a bug fix for the depot frame only.

      <updates for 14_4>
      • Some bugs related to OTRP vehicle control are fixed.
      • The maximum height of the world is now 64.
      • The changes of simutrans nightly were followed and OTRP is now r8525 based.
      Title: Re: One-way Two-lane road Fun Patch
      Post by: THLeaderH on July 16, 2018, 08:59:06 AM
      OTRP was updated to ver15. To download the latest executable files, visit https://github.com/teamhimeh/simutrans/blob/OTRP-distribute/documentation/OTRP_information_en.md (https://github.com/teamhimeh/simutrans/blob/OTRP-distribute/documentation/OTRP_information_en.md)

      <updates for 15>
      • Incorporate latest changes of simutrans standard nightly trunk
      • Thanks to the tile reservation system, the possibility of being dead-locked in a big intersection was greatly reduced.
      • Ribi-Arrow feature is now available through the display settings.
      • "Avoid becoming cityroad" option is implemented.
      Title: Re: One-way Two-lane road Fun Patch
      Post by: THLeaderH on July 25, 2018, 02:00:28 PM
      OTRP was updated to ver16. To download the latest executable files, visit
      https://github.com/teamhimeh/simutrans/blob/OTRP-distribute/documentation/OTRP_information_en.md (https://github.com/teamhimeh/simutrans/blob/OTRP-distribute/documentation/OTRP_information_en.md)
      ↑ a document written in English :D

      <updates for 16>
      • The movement of citycars are greatly improved. Now citycars support lane yielding, lane affinity sign, and tile reservation. Acceleration of citycars are now more realistic than that of the standard. Citycars choose their direction wisely, considering road traffic, sharp turn and road spec.
      • "Citycars do not enter" option is available for roads.
      • Regional mass construction of buildings. This feature was implemented by @shingoushori (https://twitter.com/shingoushori).

      Sorry for being late in the transplantation of new OTRP features to simutrans extended...
      Title: Re: One-way Two-lane road Fun Patch
      Post by: Andyh on August 01, 2018, 06:47:07 AM
      Thank you!  I like the new features (including the mass building feature, even though it's rather unrelated to the one-way theme... makes building modern-looking more homogeneous cities a lot easier)
      Title: Re: One-way Two-lane road Fun Patch
      Post by: THLeaderH on August 01, 2018, 06:53:47 AM
      OTRP was updated to ver17. To download the latest executable files, visit
      https://github.com/teamhimeh/simutrans/blob/OTRP-distribute/documentation/OTRP_information_en.md (https://github.com/teamhimeh/simutrans/blob/OTRP-distribute/documentation/OTRP_information_en.md)

      <updates since v16>
      • Various bug fixes around citycars.
      • Fix for map rotating.
      • Regional land raise/lower tool, removal tool, and building platform tool. These tools are regional when used with ctrl key. This feature was implemented by @shingoushori (https://twitter.com/shingoushori)

      Sorry for being late in the transplantation of new OTRP features to simutrans extended. It seems that transplantation is conducted by the end of September...
      Title: Re: One-way Two-lane road Fun Patch
      Post by: THLeaderH on August 05, 2018, 01:22:46 PM
      A cool logo of OTRP by 128Na (https://twitter.com/128na)!
      (https://raw.githubusercontent.com/teamhimeh/simutrans/OTRP/documentation/logo/OTRP_logo.png)

      Since OTRP is now a forked version of simutrans standard rather than a patch proposal, the official name of OTRP is One way Two lanes Road Project!
      Title: Re: One-way Two-lane road Fun Patch
      Post by: danivenk on August 05, 2018, 02:39:51 PM
      I see the logo has been updated slightly  ;)
      Title: Re: One-way Two-lane road Fun Patch
      Post by: THLeaderH on September 05, 2018, 02:08:30 PM
      OTRP was updated to ver17_5. To download the latest executable files, visit
      https://github.com/teamhimeh/simutrans/blob/OTRP-distribute/documentation/OTRP_information_en.md (https://github.com/teamhimeh/simutrans/blob/OTRP-distribute/documentation/OTRP_information_en.md)

      <updates since v17>
      • Some fixes for vehicle movements.
      • wayobj spacing
      • Cityroads do not connect to roads that is set "avoid becoming cityroad".
      • Height offset for the construction of elevated way. It's useful when you build way at very high altitude.

      Thank you for your support for OTRP. The number of amazing videos that use OTRP is gradually increasing. Check those videos  ;D
      http://www.nicovideo.jp/watch/sm33616512 (http://www.nicovideo.jp/watch/sm33616512)
      http://www.nicovideo.jp/watch/sm33452710 (http://www.nicovideo.jp/watch/sm33452710)
      http://www.nicovideo.jp/watch/sm33515994 (http://www.nicovideo.jp/watch/sm33515994)