The International Simutrans Forum

 

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

0 Members and 1 Guest are viewing this topic.

Offline THLeaderH jp

  • Coder/patcher
  • Devotee
  • *
  • Posts: 317
  • Languages: JP,EN
Re: One-way Two-lane road Fun Patch
« Reply #245 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. 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. 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.

Offline THLeaderH jp

  • Coder/patcher
  • Devotee
  • *
  • Posts: 317
  • Languages: JP,EN
Re: One-way Two-lane road Fun Patch
« Reply #246 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.

Online Leartin at

  • Devotee
  • *
  • Posts: 1224
  • PAK-DEV P192C
  • Languages: DE, EN
Re: One-way Two-lane road Fun Patch
« Reply #247 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.

Offline Ters

  • Coder/patcher
  • Devotee
  • *
  • Posts: 5495
  • Languages: EN, NO
Re: One-way Two-lane road Fun Patch
« Reply #248 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.

Offline Andyh

  • *
  • Posts: 74
Re: One-way Two-lane road Fun Patch
« Reply #249 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.

Offline Isaac.Eiland-Hall us

  • Benevolent Dictator
  • Administrator
  • *
  • Posts: 3651
  • PanamaCityPC.com/support/
    • Facebook Profile
  • Languages: EN
Re: One-way Two-lane road Fun Patch
« Reply #250 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.

Offline THLeaderH jp

  • Coder/patcher
  • Devotee
  • *
  • Posts: 317
  • Languages: JP,EN
Re: One-way Two-lane road Fun Patch
« Reply #251 on: September 14, 2017, 09:15:46 AM »
There is a theoretical problem.



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.



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.



How can we deal with this problem?

Online Leartin at

  • Devotee
  • *
  • Posts: 1224
  • PAK-DEV P192C
  • Languages: DE, EN
Re: One-way Two-lane road Fun Patch
« Reply #252 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?

Offline THLeaderH jp

  • Coder/patcher
  • Devotee
  • *
  • Posts: 317
  • Languages: JP,EN
Re: One-way Two-lane road Fun Patch
« Reply #253 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.
« Last Edit: September 14, 2017, 12:20:27 PM by THLeaderH »

Online Leartin at

  • Devotee
  • *
  • Posts: 1224
  • PAK-DEV P192C
  • Languages: DE, EN
Re: One-way Two-lane road Fun Patch
« Reply #254 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?

Offline THLeaderH jp

  • Coder/patcher
  • Devotee
  • *
  • Posts: 317
  • Languages: JP,EN
Re: One-way Two-lane road Fun Patch
« Reply #255 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.

Offline Ters

  • Coder/patcher
  • Devotee
  • *
  • Posts: 5495
  • Languages: EN, NO
Re: One-way Two-lane road Fun Patch
« Reply #256 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.

Online Leartin at

  • Devotee
  • *
  • Posts: 1224
  • PAK-DEV P192C
  • Languages: DE, EN
Re: One-way Two-lane road Fun Patch
« Reply #257 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.



Offline isidoro

  • Devotee
  • *
  • Posts: 1129
Re: One-way Two-lane road Fun Patch
« Reply #258 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?

Offline Ters

  • Coder/patcher
  • Devotee
  • *
  • Posts: 5495
  • Languages: EN, NO
Re: One-way Two-lane road Fun Patch
« Reply #259 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).

Offline isidoro

  • Devotee
  • *
  • Posts: 1129
Re: One-way Two-lane road Fun Patch
« Reply #260 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.

Online Leartin at

  • Devotee
  • *
  • Posts: 1224
  • PAK-DEV P192C
  • Languages: DE, EN
Re: One-way Two-lane road Fun Patch
« Reply #261 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.

Offline Ters

  • Coder/patcher
  • Devotee
  • *
  • Posts: 5495
  • Languages: EN, NO
Re: One-way Two-lane road Fun Patch
« Reply #262 on: September 17, 2017, 10:56:35 AM »
In other words, every two-lane way is a highway, not a local street.

Offline THLeaderH jp

  • Coder/patcher
  • Devotee
  • *
  • Posts: 317
  • Languages: JP,EN
Re: One-way Two-lane road Fun Patch
« Reply #263 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

patch: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 and put it into your pakset.)
win:https://drive.google.com/file/d/0B_rSte9xAhLDTkhfVS1jLV9fVm8/view?usp=sharing
mac: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. 日本語の情報はこちら。

~Issue list~ (Also see this post.)
  • 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!
« Last Edit: September 22, 2017, 11:47:59 PM by THLeaderH »

Offline Junna

  • Devotee
  • *
  • Posts: 1081
Re: One-way Two-lane road Fun Patch
« Reply #264 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?

Offline IgorEliezer br

  • Devotee
  • Administrator
  • *
  • Posts: 4084
  • Cake recipes are cool... REALLY!
    • Igor Eliezer Architect and Urban Planner/Arquiteto e Urbanista
  • Languages: PT, EN, AutoLISP, Python
Re: One-way Two-lane road Fun Patch
« Reply #265 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.
« Last Edit: September 22, 2017, 09:12:26 PM by IgorEliezer »

Offline THLeaderH jp

  • Coder/patcher
  • Devotee
  • *
  • Posts: 317
  • Languages: JP,EN
Re: One-way Two-lane road Fun Patch
« Reply #266 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.

Offline Junna

  • Devotee
  • *
  • Posts: 1081
Re: One-way Two-lane road Fun Patch
« Reply #267 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




in the above post. I have an ancient version of this that doesn't work right--where's the new fancy one from?

Offline THLeaderH jp

  • Coder/patcher
  • Devotee
  • *
  • Posts: 317
  • Languages: JP,EN
Re: One-way Two-lane road Fun Patch
« Reply #268 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
code: https://github.com/teamhimeh/simutrans/tree/OTRP-upgrade11-12

Offline THLeaderH jp

  • Coder/patcher
  • Devotee
  • *
  • Posts: 317
  • Languages: JP,EN
Re: One-way Two-lane road Fun Patch
« Reply #269 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.

Offline franc055

  • *
  • Posts: 4
  • Languages: ES
Re: One-way Two-lane road Fun Patch
« Reply #270 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 (like colors, bold, CAPS LOCK and font size) when it makes the reading difficult or when it is not necessary.
~IgorEliezer
« Last Edit: September 28, 2017, 05:49:34 AM by IgorEliezer »

Offline Ters

  • Coder/patcher
  • Devotee
  • *
  • Posts: 5495
  • Languages: EN, NO
Re: One-way Two-lane road Fun Patch
« Reply #271 on: September 28, 2017, 05:24:23 AM »
That does not excuse shouting.

Offline danivenk

  • *
  • Posts: 92
  • Languages: EN, NL, JP
Re: One-way Two-lane road Fun Patch
« Reply #272 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
code: 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...
« Last Edit: September 29, 2017, 07:17:22 PM by danivenk »

Offline THLeaderH jp

  • Coder/patcher
  • Devotee
  • *
  • Posts: 317
  • Languages: JP,EN
Re: One-way Two-lane road Fun Patch
« Reply #273 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
and
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.

Offline danivenk

  • *
  • Posts: 92
  • Languages: EN, NL, JP
Re: One-way Two-lane road Fun Patch
« Reply #274 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...


Offline THLeaderH jp

  • Coder/patcher
  • Devotee
  • *
  • Posts: 317
  • Languages: JP,EN
Re: One-way Two-lane road Fun Patch
« Reply #275 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

patch: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 and put it into your pakset.)
win:https://drive.google.com/open?id=0B_rSte9xAhLDMEZ0OEFfWkZYTWc
mac: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. 日本語の情報はこちら。

~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!

Offline THLeaderH jp

  • Coder/patcher
  • Devotee
  • *
  • Posts: 317
  • Languages: JP,EN
Re: One-way Two-lane road Fun Patch
« Reply #276 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. Removing these lines solves this bug. However, why does two_click_tool_t call init() when the cursor is on the start position?

Offline thegamer7893 england

  • *
  • Posts: 780
  • Languages: EN
Re: One-way Two-lane road Fun Patch
« Reply #277 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. :)

Offline jamespetts gb

  • Simutrans-Extended project coordinator
  • Devotee
  • *
  • Posts: 18617
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: One-way Two-lane road Fun Patch
« Reply #278 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.

Offline thegamer7893 england

  • *
  • Posts: 780
  • Languages: EN
Re: One-way Two-lane road Fun Patch
« Reply #279 on: October 06, 2017, 09:02:13 PM »
Nice. Ok.