News:

The Forum Rules and Guidelines
Our forum has Rules and Guidelines. Please, be kind and read them ;).

One-way Two-lane road Fun Patch

Started by THLeaderH, February 06, 2017, 02:04:26 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

THLeaderH

Thank you, TurfIt. Your patch is now applied on my OTRP brunch and that can be seen here. It worked fine.

QuoteMinor - 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.

QuoteMedium - 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.

QuoteMajor - 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.

QuoteMajor - 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.

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

QuoteMajor - 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.

QuoteDisagreement - 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.

THLeaderH

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.

Leartin

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.

Ters

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.

Andyh

Quote from: 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.

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.

Isaac Eiland-Hall

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.

THLeaderH

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?

Leartin

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?

THLeaderH

#253
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.
QuoteDo 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.

Leartin

Quote from: 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.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?

THLeaderH

QuoteThough, 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.

Ters

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.

Leartin

Quote from: Ters on September 14, 2017, 06:22:53 PM
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.

QuoteYes, 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.



isidoro

Quote from: Leartin on September 15, 2017, 05:40:36 AM
[..]
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?

Ters

Quote from: isidoro on September 15, 2017, 10:42:02 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).

isidoro

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.

Leartin

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.

Ters

In other words, every two-lane way is a highway, not a local street.

THLeaderH

#263
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!

Junna

Where do I get those fancy road dat/pak though? ABNA is down and ebi deleted the git downloads?

IgorEliezer

#265
Quote from: THLeaderH on September 22, 2017, 01:57:02 PM
:simutrans: (The executable binaries include Ribi-arrow patch.)
Crashed. It's missing RibiArrow pakfile. Intended?

----

Quote from: 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?
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.

THLeaderH

Quote from: IgorEliezer on September 22, 2017, 08:08:38 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.

Junna

Quote from: IgorEliezer on September 22, 2017, 08:08:38 PM

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

Quote from: THLeaderH on September 14, 2017, 09:15:46 AM



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

THLeaderH

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

THLeaderH

I fixed a bug that a convoy moves to traffic lane when it stops on inverted mode roads. It is already pushed to GitHub.

franc055

#270
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

Ters


danivenk

#272
Quote from: 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
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...

THLeaderH

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

Quote from: danivenk on September 29, 2017, 07:00:03 PM
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.

danivenk

Quote from: THLeaderH on September 30, 2017, 04:02:56 AM
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...


THLeaderH

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

THLeaderH

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?

fam621

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. :)

jamespetts

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.
Download Simutrans-Extended.

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

Follow Simutrans-Extended on Facebook.