News:

Simutrans Tools
Know our tools that can help you to create add-ons, install and customize Simutrans.

Oneway Twoway Road Patch for the Extended

Started by THLeaderH, April 07, 2018, 09:23:26 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

THLeaderH

OTRP has come to simutrans extended world ;D OTRP is the patch in that both 2 lanes of road are fully used when traffic is separated like Highway system. I'll call this patch "ex-OTRP" to distinguish this from OTRP for the standard.

<for players>
※Japanese Information is available here. ←日本語の情報はこちら
Downloads
windows: https://drive.google.com/open?id=1oC8cADnJmKOtxoRH47rlU9aaUnZ6gLvG
mac: https://drive.google.com/open?id=1T19F_re1hnP8r-LSHJF07O6BCXww1b94
source to compile: https://github.com/teamhimeh/simutrans/tree/ex-OTRP-distribute
Also, misc.RibiArrow.pak is required. Please download from here.

Get Started

  • Put misc.RibiArrow.pak 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-extended.exe exists.
  • Execute the OTRP file. Please do not overwrite your save data of simutrans standard.

How to use
Select a road icon with ctrl key and you can choose the overtaking mode.

  • oneway: the mode in that the road is oneway. When you use this mode, please confirm the connected direction of roads by pressing colon( : ) key.
  • twoway: the mode in that a vehicle behaves as in the conventional simutrans.
  • only loading convoy: the mode in that a vehicle overtakes only a stopping convoy.
  • prohibited: the mode in that a vehicle can overtake no vehicle.
  • inverted: the mode in that a vehicle goes on the alternative side of the lane.

You can control the open direction of a traffic light. You can see the selection buttons of the open directions when you open a traffic light dialogue. For more information, please refer this topic.

Data Compatibility
You can use any paksets and addons made for simutrans extended on ex-OTRP.
Save data of simutrans extended before revision b9030aa can be loaded on ex-OTRP. Once you save the data with ex-OTRP, the data cannot be loaded with the official simutrans extended.



<For Jamespetts and coders>

In OTRP for standard, Ribi_Arrow patch is separated from OTRP-core, but it is inseparably included in ex-OTRP. ex-OTRP-distribute branch includes the road traffic light direction patch for users' convenience. ex-OTRP branch is always the latest pure ex-OTRP branch.

URLs of branchs
ex-OTRP: https://github.com/teamhimeh/simutrans/tree/ex-OTRP
ex-OTRP-distribute: https://github.com/teamhimeh/simutrans/tree/ex-OTRP-distribute

In ex-OTRP, the version is incremented to EX_VERSION_MAJOR=14 and EX_VERSION_MINOR=0. Please check simversion.h.

OTRP is a huge and complicated patch. The transplantation from simutrans standard took a long time because the patch command didn't work and I had to bring it by hand while checking that algorithms work on simutrans extended. This patch modifies 29 files and adds 4 files.
Only a minimum test was conducted on ex-OTRP. Thus, it is unclear that this ex-OTRP is safe for players. Also, OTRP itself has many issues - performance, functional and aesthetic issues - in its code as indicated on the topic of OTRP for the standard. ex-OTRP is too risky to be integrated immediately into the extended master brunch. However, making OTRP perfect is so hard to achieve, and unfortunately I don't have enough technical and time resource to do that.
So ex-OTRP should be distributed as the separated version of simutrans extended at least for three months, and after it is confirmed that ex-OTRP is good enough for a practical use, it's time to consider the integration.

I hope many people enjoy OTRP with simutrans extended.


EDIT: I added base-texts-OTRP.dat for simutranslator in my repository but git didn't recognize it. So I attached the file on this message.

Phystam

Can I update the existing over-taking-mode status, without upgrading the existing road?

THLeaderH

Quote from: Phystam on April 08, 2018, 03:13:07 PM
Can I update the existing over-taking-mode status, without upgrading the existing road?


Oh, this needs to be fixed.

Phystam

I confirmed the behavior of overwriting. When existing road is one-way, I can change the direction. However when existing road is two-way, I cannot change to one-way.

jamespetts

Thank you very much for this - this is most helpful. I have been quite busy recently, and I have not had a chance to look into this yet. I should be grateful for any feedback from testing for anyone who has used this.

Can I check whether the bug that Phystam has reported has been fixed yet? It would seem sensible for me to begin testing this after that has been fixed.
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.

Phystam

I have made sure that way direction can be updated by overwriting.
Okay, I will try it!

THLeaderH

#6
Quote from: jamespetts on April 09, 2018, 10:26:25 PM
Can I check whether the bug that Phystam has reported has been fixed yet? It would seem sensible for me to begin testing this after that has been fixed.

The issue that Phystam reported was fixed in this commit.




I have a request for Jamespetts.
Could you distribute ex-OTRP with your nightly build system? I do not have an infrastructure to build the code automatically every night and distribute, and that means it's difficult to catch up with the latest simutrans extended features everyday. It's better for players to test ex-OTRP with the latest simutrans extended features.

Phystam

In order to use the OTRP-distribute branch, we must have ribi-Arrow add-on in pakset.
So, we have to make a branch for OTRP in pak128.Britain-ex pakset with ribi-Arrow...
Can you create a new branch in pak128.Britain-ex?

Phystam

Sometimes city road is downgraded with low-axle-load road, so many "no route" messages are displayed on the window.
I think that the issue cannot happen at non-OTRP Extended version. Did you change the code about road renovation?

Phystam

I found another bug about building roads.
When I selected the road builder tool using "s" shortcut key, the "oneway" mode was ignored and the road was built with "twoway" mode.
(This issue cannot be seen when I clicked the road icons.)

jamespetts

Thank you very much, THLeaderH, for your work on this: this is most useful. The plan is not to produce a separate nightly build for this patch, but rather to integrate it into the master branch when it is ready.

Thanks to Phystam for the useful testing. THLeaderH - I should be grateful if you could let me know when the bugs that Phystam has identified have been fixed so that I can begin further testing in preparation to incorporate this.
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.

THLeaderH

#11
Quote from: Phystam on April 18, 2018, 04:06:11 PM
Sometimes city road is downgraded with low-axle-load road, so many "no route" messages are displayed on the window.
I think that the issue cannot happen at non-OTRP Extended version. Did you change the code about road renovation?
This issue is fatal and needs to be fixed. However, I didn't intentionally write the downgrading code and I can't find the cause. In which file is the renovation process of roads written?

Quote from: Phystam on April 22, 2018, 06:11:30 PM
I found another bug about building roads.
When I selected the road builder tool using "s" shortcut key, the "oneway" mode was ignored and the road was built with "twoway" mode.
(This issue cannot be seen when I clicked the road icons.)
I reproduced this issue and am still researching. Perhaps, solving this issue is not so easy because the tool_build_way_t object made with the tool bar is different from that made with the "s" shortcut key. Although I continue to solve this issue, this issue is not so fatal because players rarely build roads with the shortcut key, as they can build only one pre-specified roads with the shortcut key.

jamespetts

THLeaderH - I cannot immediately remember precisely where in the code the road upgrades are (somewhere in simcity.cc, if I recall), but you should be able to find it easily by setting a breakpoint in the set_desc() method of a way, and then, on a clean map with just towns, using the "grow town" special tool.

As to the "s" key, I know that I use this quite frequently - it is very useful for switching between bulldozing and building a road (or building a road and building stops, etc.) during a particular construction project.
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.

THLeaderH

I confirmed that the downgrading issue of city road can be exactly reproduced on the master branch. This issue is not derived from OTRP, although the mechanism of this issue is still not understood.
Some players reported me that bridges built as city road have ERROR overtaking_mode status and I fixed this issue.
As to the "s" key problem, I haven't succeeded in solving yet. The tool_build_way_t object that is used with "s" key has to derive overtaking_mode from the object of the tool bar. I struggle to do this without making a mess in the code.

THLeaderH

The "s" key problem was solved! ex-OTRP and ex-OTRP-distribute branches contains these fixes and all changes from the master branch of simutrans extended.
The solution commit for the s key problem: https://github.com/teamhimeh/simutrans/commit/fa87cd655e732f57939725f1080ee5709864d8e5

(I apologize for double posting.)

Phystam

Splendid! I confirmed that the problem has been solved.
I could not find any issues other than the problem, even when we played Network games.
If there are some issues that I could not find, probably they are small and negligible.
Thank you again for your work!

THLeaderH

The halt mode is now supported on ex-OTRP. Both ex-OTRP and ex-OTRP-distribute branches contain this improvement.

(note: ex-OTRP-distribute = ex-OTRP + signal open direction control patch. It is recommended for players and testers to use the code of ex-OTRP-distribute branch.)

Phystam

Very good! It works on my savegame.
I will debug for the patch.

jamespetts

Excellent, that is very helpful, thank you. I will look into testing and integrating this when I get a moment.
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.

jamespetts

Thank you for this. I have now tried merging this with the latest version of Extended. However, on starting Pak128.Britain-Ex, I get an error message:


FATAL ERROR: successfully_loaded() - class skin_desc_t-object RibiArrow not found.
*** PLEASE INSTALL PROPER BASE FILE AND CHECK PATH ***
Aborting program execution...


Does this require a specially compiled version of the pakset? If so, it would seem to make more sense to allow it to work, albeit without this feature enabled, with a non-modified version of the pakset, as Simutrans has traditionally always been strongly backwards compatible with older pakset versions, and it would be a great shame to break this now.

Edit: I have tried both the OTRP and the OTRP-distribute branch - both have the same issue. I have made my own OTRP and OTRP-distribute branches with these 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.

THLeaderH

#20
Yes. The current ex-OTRP requires misc.ribi-arrow.pak in the pakset to show the ribi arrow.
To continue the test, you can download it from here.

QuoteIf so, it would seem to make more sense to allow it to work, albeit without this feature enabled, with a non-modified version of the pakset, as Simutrans has traditionally always been strongly backwards compatible with older pakset versions, and it would be a great shame to break this now.
I'm working on this issue. Though I'll allow OTRP to work without the ribi-arrow pak,  it is highly recommended to use ribi-arrow to check the connection direction when you build oneway roads. So, Pak128.Britain-Ex should contain the ribi-arrow pak as soon as the OTRP is integrated to the master branch. Ribi-arrow is just a simple misc object and does not require a special makeobj to compile, that means it can be compiled with a conventional makeobj. The zip file which you can download from the link above contains the png and dat file. As you see these file, you'll immediately get how to define the dat.


EDIT: In addition to the ribi arrow pak,
simple_tool[37]=,:
should be added to the menuconf of the pakset to activate the ribi arrow feature.

THLeaderH

Now this commit allows ex-OTRP to work without the ribi allow pak!
(already commited to both ex-OTRP and ex-OTRP-distribute branch.)

jamespetts

Thank you very much for that. This does now seem to run without crashing. May I ask where in the pakset directory structure that the OTRP_Arrow.dat file should be located?
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.

THLeaderH

#23
I think the OTRP_Arrow.dat should be located in /gui/gui128 of simutrans-pak128.britain repository.

fam621

Has there been any progress since the last update?

THLeaderH

I'm waiting for James to accept or point out some more issues.

fam621


jamespetts

My apologies for the delay in merging this: I have been trying to prioritise fixing the signalling bugs, which unfortunately seem to be both numerous and very time consuming. However, I am away from home this week without access to the computer on which I have a graphical debugger installed, so I can do some work that does not involve debugging.

I have managed to merge the latest code from the master branch into the OTRP-distribute branch, but the on merging the new changes from your OTRP-distribute branch into my merged branch, I get a very large number of merge conflicts. I have pushed my merged version of the OTRP-distribute branch (that is, with the master branch changes merged into the older OTRP-distribute branch, but without the new OTRP-distribute changes merged into my OTRP-distribute branch) to my Github repository.

The merge conflicts no doubt come from some recent changes on the master branch. Would you be able to resolve these merge conflicts so that I can test the OTRP this week? It would be most useful to be able to do this.

Thank you again for your help with this work.
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.

THLeaderH

I merged the latest master and solved all conflicts for both ex-OTRP and ex-OTRP-distribute branch. Please check my github repository ;)

jamespetts

Excellent, thank you. I have now incorporated this into the master branch - thank you very much for your work on this: it is much appreciated.

I have amended the GUI slightly by adding translation texts for the various modes. I wonder whether you might assist further by adding some tool-tips for each of these modes? It may not be entirely obvious to a player what these each mean otherwise.

Also, a help text would be very useful.

In any event, thank you again for your work on this.
Incidentally, have you a good graphic or video that I could use to promote this new feature on the Simutrans-Extended Facebook page?
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.

THLeaderH

Thank you very much for the integration. This is the moment that the OTRP supporters have waited for, and that my dream came true at.

Of course I'd like to help by adding tool-tips and writing help texts. However, I'm going to take a trip to California for about a week that starts tomorrow. So it might take some time for these work.

Due to my trip, I cannot immediately make a promotion video of OTRP. Instead of making a new one, please use the video I made one year ago, although the video is made with simutrans standard.
https://www.youtube.com/watch?v=waShbKcFV3s

jamespetts

Very best wishes for your trip to California - may you enjoy much interesting transport! And thank you for your work again on the feature.
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.

Matthew

Thank you to @THLeaderH and @jamespetts for working together to bring a new feature to Simutrans-Extended.

I have downloaded the latest nightly .exe and pakset, but so far I cannot see any new icons or other changes in the Roads menu. Is this new feature still 'under construction'? I realize this might just be the first of several changes. Or do I need to wait until motorways become available? Or am I simply missing something obvious (either in the GUI or in the file structure)?
(Signature being tested) If you enjoy playing Simutrans, then you might also enjoy watching Japan Railway Journal
Available in English and simplified Chinese
如果您喜欢玩Simutrans的话,那么说不定就想看《日本铁路之旅》(英语也有简体中文字幕)。

jamespetts

Quote from: Matthew on June 01, 2018, 10:49:40 PM
Thank you to @THLeaderH and @jamespetts for working together to bring a new feature to Simutrans-Extended.

I have downloaded the latest nightly .exe and pakset, but so far I cannot see any new icons or other changes in the Roads menu. Is this new feature still 'under construction'? I realize this might just be the first of several changes. Or do I need to wait until motorways become available? Or am I simply missing something obvious (either in the GUI or in the file structure)?

The user interface may need a little polishing perhaps as it is slightly non-obvious - but the way to use this feature is to CTRL+click when selecting a road to build. You  are then given a menu of the different modes available. Building a road over another road of the same type but with a different mode selected will alter the overtaking mode of the underlying road without upgrading it or costing anything.
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.

Matthew

Quote from: jamespetts on June 01, 2018, 11:23:15 PM
The user interface may need a little polishing perhaps as it is slightly non-obvious - but the way to use this feature is to CTRL+click when selecting a road to build. You  are then given a menu of the different modes available. Building a road over another road of the same type but with a different mode selected will alter the overtaking mode of the underlying road without upgrading it or costing anything.

Thank you for explaining how to use the new feature; I realize that this is very much a work in progress. I look forward to experimenting with the feature!
Quote from: ACarlotti on June 02, 2018, 02:07:40 PM
Note: This ended up being quite a long post, in which I express quite a bit of frustration. The first half of the post is about specific issues in THLeaderH's changes, many of which had been raised before. The second half is a more general discourse on code quality, both in the context of these changes and the codebase more generally, and about my opinions and aims regarding quality and how they compare with those of THLeaderH, James and the main developers of Standard.


I was looking through these changes last night, and I noticed that many of the issues mentioned in the Standard thread for this patch are still present in this thread. I've made some changes to your code, which James has now incorporated into master, so you should be able to look at them fairly easily. In no particular order.

I'm not qualified to comment on the technical details of this discussion, but there are some things I can say:

@ACarlotti, thank you for taking the time to improve the code for future devs with today's patch. It may not be as obvious as a new vehicle or building, but keeping code quality high is an important contribution to keeping Simutrans alive.

@THLeaderH, thank you for taking the time to learn how Simutrans works and developing a new feature. You've made the game a little bit more fun!  8) You have excellent, fluent written English, but your work must still have been especially painful when the comments and code are written in two languages (German and English) which are very different from Japanese. Getting the patch incorporated into Extended is a great achievement: I hope that the feedback encourages you continue improving the quality of the code as a gift to future developers.
(Signature being tested) If you enjoy playing Simutrans, then you might also enjoy watching Japan Railway Journal
Available in English and simplified Chinese
如果您喜欢玩Simutrans的话,那么说不定就想看《日本铁路之旅》(英语也有简体中文字幕)。