How To Merge Routes In Tsc?

Discussion in 'General Discussion' started by cityrail-rulez, Sep 28, 2023.

  1. I have read somewhere that it's certainly possible to merge two or more routes together as long as the routes match up! Which is very rare 'as quoted on the forum I found the post on'.

    I have two routes only one curve away from each other, surely this is close enough to merge the routes. Just trying to figure out how to merge them. Both routes are test routes of real life Australian lines and is of the same corridor in order to test merging..

    If anyone has merged routes, please let us know how you did it.
     
  2. Doomotron

    Doomotron Well-Known Member

    Joined:
    Oct 24, 2018
    Messages:
    3,858
    Likes Received:
    4,429
    If the origin points are the same then yes they can be merged. I am not aware if it's possible to change the origin point of a route should the routes not share the same origin, and I don't know how to actually merge routes. In fact since I'm planning on merging routes myself this thread will be quite useful for me as well.
     
    • Like Like x 1
  3. Do you mean that both routes has to have the exact same Latitude/Longitude? Aka Route origin in TS.

    Hopefully, we both can merge routes mate :)
     
  4. mr2mark

    mr2mark Member

    Joined:
    Oct 26, 2020
    Messages:
    113
    Likes Received:
    18
    This is something i would also be very interested in learning how to do.
     
  5. Thor-Ulf Ståhlberg

    Thor-Ulf Ståhlberg Member

    Joined:
    Mar 21, 2019
    Messages:
    98
    Likes Received:
    88
    Hello!
    7 years ago I merged Bergensbanen and Roa Honefosslinja with RW Merge Route.
    Make a backup in both routes first and then Merge them.
    Note! Both routes must have the same starting position.
    Good luck!
     
    Last edited: Sep 28, 2023
    • Like Like x 1
  6. Works brilliantly!! Thanks heaps for that useful information :) It's a shame it doesn't merge routes based upon it's latitude/longitude in the real-world.

    I didn't need to make any backups of the routes ;) They were just to test merging.
     
  7. dolanbaker

    dolanbaker Active Member

    Joined:
    Dec 29, 2022
    Messages:
    144
    Likes Received:
    120
    Cunningn wrote an app that can merge routes that have different origins, you should try to contact him to see if it is still available
     
    • Like Like x 2
  8. But who is Cunningn?
     
  9. 749006

    749006 Well-Known Member

    Joined:
    Dec 10, 2016
    Messages:
    10,057
    Likes Received:
    3,140
    Neil Cunningham who made the Cambs/ECML route
     
    • Like Like x 2
  10. cunningn#3154

    cunningn#3154 Well-Known Member

    Joined:
    Mar 22, 2023
    Messages:
    225
    Likes Received:
    298
    Last edited: Sep 28, 2023
    • Like Like x 5
  11. Thanks mate :)
     
  12. Cheers :) I'll have a look at it later, been up all night LOL
     
    • Like Like x 1
  13. ac_freeman

    ac_freeman Active Member

    Joined:
    Jan 26, 2023
    Messages:
    86
    Likes Received:
    112
    I'm not sure which method Nick used a few years ago but when he merged our North Wales Coast-BR Blue route with Backdated Trainsim's Conwy Valley route we lost approximately 1 tile's worth of sceney at the joint point, same thing happened when he merged our South Lancs Route with North Wales Coast so that we could use the already created Crewe Station. Not a huge deal, I just recreated the scenery for the "join" tile - eagle eyed drivers might have noticed that I forgot to do that on South Lancs at the join point near Chester, there is a lack of scenery there....I will get around to fixing that at some point but concentrating on the new sections at the moment.
     
    • Like Like x 6
  14. cunningn#3154

    cunningn#3154 Well-Known Member

    Joined:
    Mar 22, 2023
    Messages:
    225
    Likes Received:
    298
    If you know the offset then you could just copy the original donor scenery tile into the new merged route.
     
    • Like Like x 2
  15. ac_freeman

    ac_freeman Active Member

    Joined:
    Jan 26, 2023
    Messages:
    86
    Likes Received:
    112
    Thanks - can't remember why Nick did not do this originally, and sadly of course he is no longer with us to ask, but I will try this at Chester when I come to look at it.
     
    • Like Like x 1
  16. toms87

    toms87 Well-Known Member

    Joined:
    Jan 20, 2022
    Messages:
    705
    Likes Received:
    1,063
    • Like Like x 1
  17. cunningn#3154

    cunningn#3154 Well-Known Member

    Joined:
    Mar 22, 2023
    Messages:
    225
    Likes Received:
    298
    It's worth saying that this 'tool' works to an accuracy of up to half a tile (up to 500m) so there is always the need for a little fettling at the join point. It could be made absolutely accurate with a little work but since it did what I needed it to I never bothered.
     
    • Like Like x 1
  18. toms87

    toms87 Well-Known Member

    Joined:
    Jan 20, 2022
    Messages:
    705
    Likes Received:
    1,063
    cunningn#3154 We´ve had the same problem with the tiles not beeing lined up accuratly. Thx anyway for sharing.
     
    • Like Like x 1
  19. cunningn#3154

    cunningn#3154 Well-Known Member

    Joined:
    Mar 22, 2023
    Messages:
    225
    Likes Received:
    298
    Yup. In most cases it isn't an issue as you can 'lose' any differences at the nearest curve or change in gradient.
     
  20. toms87

    toms87 Well-Known Member

    Joined:
    Jan 20, 2022
    Messages:
    705
    Likes Received:
    1,063
    True, going to try that out on a project in the future. In the past we´ve tried merges within cities and it failed, because there was not enough space to smooth things out and bring the different tiles together. The merge point needs to be out in the countryside with alot of leeway.I guess that´s when it works.
     
  21. cunningn#3154

    cunningn#3154 Well-Known Member

    Joined:
    Mar 22, 2023
    Messages:
    225
    Likes Received:
    298
    Understood. TBH making my tool more accurate is eminently do-able - the only slightly tricky bit is dealing with tile boundary shifts. It's just much more work than I am interested in. I have made the (slightly LOVE) code available so anyone can pick it up and improve it ;-)
     
    • Like Like x 1
  22. dolanbaker

    dolanbaker Active Member

    Joined:
    Dec 29, 2022
    Messages:
    144
    Likes Received:
    120
    When I used the tool to merge my route with the Cambs/ECML route, there was almost 400m difference north and 0.5 m height, easily lost it by making Shelford closer to Cambridge.
     
    • Helpful Helpful x 2
    • Like Like x 1
  23. atomicdanny

    atomicdanny Guest

    There is of course the unseen part of route merging two different points of origins, in that the further out from the join point, at the join point it would be something like 500-700m out (I attempted one tile at Stratford from GEML to NLL and it was a long way out - this was pre North London Line (I did the track for that route - but had to do it again). The further out you go the more out it gets - so the other end of the route would be something like 10-20 miles out. (basically routes "curve" at different angles and are built on a flat plane, not a curved earth or something like that )

    (Despite common belief in that i've said "i don't know how it works" - I've always known that it was possible, I just never had the skills to make a tool but just said that i didn't know to stop people asking :) )
     
    • Like Like x 4
    • Helpful Helpful x 1
  24. dolanbaker

    dolanbaker Active Member

    Joined:
    Dec 29, 2022
    Messages:
    144
    Likes Received:
    120
    With the benefit of 20-20 hindsight, maybe the origin should have been locked when the game was first developed. Then all routes eould have the same origin. Some of the antipodean routes would have high tile indexes, but that shouldn't be an issue.
     
  25. atomicdanny

    atomicdanny Guest

    It would make sense but if you would use a London Point of Origin for something in Scotland or another country there is a possibility that it may not work.(not sure but I think there would be issues with really high numbers for tiles? ) I mean at the time I did suggest that both ECML and GEML should use Swanley as the point of origin to match the other London to Brighton and London to Faversham routes at the time - but was just ignored. (equally though the idea of Route Merging wasn't really a thing at least until South London to Brighton? (at least with official routes)

    Out of curiosity - I tried to go to Hamburg on a uk route - the co-ordinates weren't even recognised, it refused to go that far - so it appears there may be a limit.
    (the location in the editor - it basically just ignored it and did nothing)
     
    Last edited by a moderator: Oct 3, 2023
    • Like Like x 2
  26. dolanbaker

    dolanbaker Active Member

    Joined:
    Dec 29, 2022
    Messages:
    144
    Likes Received:
    120
    It makes sense that there is limit of relative movement from your starting location on a route as no one would do a coast to coast drive in one session(country dependent). But using a common origin for routes within a country or region would have avoided the merging issues.
     
    • Like Like x 1
  27. 749006

    749006 Well-Known Member

    Joined:
    Dec 10, 2016
    Messages:
    10,057
    Likes Received:
    3,140
    When the game was originally introduced I doubt that long routes were thought of at the time.
    Hindsight is 20/20
     
    • Like Like x 1
  28. dolanbaker

    dolanbaker Active Member

    Joined:
    Dec 29, 2022
    Messages:
    144
    Likes Received:
    120
    I tried to see how far I could move away from the Origin and found that the game seems to stop moving at around the 650 tile mark (approx 670km), so it seems possible to have a common origin for countries the size of Britain.
     
    • Like Like x 1
  29. Spikee1975

    Spikee1975 Guest

    I think Danny is right, there is the possibility of rounding errors and misplacements due to earth's curvature if the origin is too far away from the route. TSC is single route based by design, and its flat map projection only is valid in a small radius from its origin. That's the problem with map projection.

    Zusi is more flexible in that aspect. You build your timetable by selecting the needed route modules (usually about 20 kms long), which do connect and then you can set a specific origin for each timetable (=route in TSC), on which relative position calculations are then done by the engine.
     
    Last edited by a moderator: Oct 4, 2023
    • Like Like x 1
  30. mindenjohn

    mindenjohn Well-Known Member

    Joined:
    Aug 19, 2022
    Messages:
    553
    Likes Received:
    409
    Difficult to get your terrain right if all started at say 0,0 and there must be a limit to the number of tiles available even if most are blank. Why would someone want to merge Pacific Surfliner with LIRR or the London Overground? It might appeal to some eccentrics as a novelty but even if we operate in a "fantasy" world there has to be limits or we risk even more ridicule from the uninitiated.
     
  31. Probably best to do an expansion with routes from what I've been reading here :)
     
  32. dolanbaker

    dolanbaker Active Member

    Joined:
    Dec 29, 2022
    Messages:
    144
    Likes Received:
    120
    Yes, that is how I initially started when I build my route, using the GEML as the host. Later I merged Neil's Cambridgeshire route using his merge tool.
    That's when I discovered all the idiosyncrasies of route merging.
     
    • Like Like x 1
  33. I've merged some routes back in MSTS and in Trainz :D
     
  34. cunningn#3154

    cunningn#3154 Well-Known Member

    Joined:
    Mar 22, 2023
    Messages:
    225
    Likes Received:
    298
    The curvature issue would be a problem if trying to create a huge/lengthy route using DEM as I assume the terrain map would diverge further and further from reality as you go away from the origin. In the case of my mergers the route terrain maps were already done - each based on a 'sensible' local origin - so the discrepancies wouldn't be obvious. As previously stated, if the original creators of the game had known what it would become then they'd have doubtless done things differently - 20/20 hindsight as someone already said!
     
    • Like Like x 3
  35. 85hertz

    85hertz Well-Known Member

    Joined:
    Jun 22, 2021
    Messages:
    303
    Likes Received:
    356
    Evening all, sorry for bothering you all. I'm trying to merge two routes using the merge tool, how do I find the corresponding merge tile? I know where I want to merge the two routes, just not sure of the tile name. TIA. Kind regards.

    (Where it says "Select only merge 'TILE':")
     
  36. cunningn#3154

    cunningn#3154 Well-Known Member

    Joined:
    Mar 22, 2023
    Messages:
    225
    Likes Received:
    298
    In route edit you move to the end of the track where the join is going to happen on your 'target route' and note the tile coordinates (at the bottom left of the screen). Do the same for your 'donor' route. The difference in tile number (in both x and y axis) is the offset or difference which you feed into the tool (and which it uses to adjust the tile references in your donor tiles so they slot into the correct location on your target route).

    Then do a trial run (on copies of the routes) and see how close your merged track (and scenery) gets. The two track ends are likely to be offset in all three axes. At this point you need to make some editorial decisions as to how you are going to smoothe over the discrepancies.

    Always try to make your join in open country. Even if this means adding track in one of other route manually, before you do the merge, to shift the join point into an open location where any fudges aren't obvious. Ideally do this where there is a curve so you can tighten or open the curve to make the ends meet.

    Good luck.
     
    • Like Like x 4
    • Helpful Helpful x 1
  37. 85hertz

    85hertz Well-Known Member

    Joined:
    Jun 22, 2021
    Messages:
    303
    Likes Received:
    356
    Brilliant, thank you. I appreciate your help.
     
  38. Aussiedog88

    Aussiedog88 New Member

    Joined:
    Apr 25, 2020
    Messages:
    20
    Likes Received:
    5
    Hello all. Sorry to add to this discussion, but I'm attempting a merge myself. I've got everything for the merge setup (x offset and y offset, backups, etc.) and downloaded the program, but when I click on source to, I presume, get the route I'm merging with, the list is completely empty. The program can't seem to find the routes in my Railworks folder.

    My Railworks folder is on an external drive (storage issues).
    I've attempted to clone the Railworks folder into my C:\ drive with the correct path to see if that'll help (C:\steamapps\Railworks\Content\Routes\<Route Folders>).
    I've copied the serz.exe file into my C:\temp as per not-manual.

    After these attempts, I'm still left with the same blank list shown in the screenshot here.
    Can someone please help me with this?
    Many thanks
     

    Attached Files:

  39. 749006

    749006 Well-Known Member

    Joined:
    Dec 10, 2016
    Messages:
    10,057
    Likes Received:
    3,140
    If the routes are within an *.ap file format the Tile Cloner might net see them.
     
  40. Aussiedog88

    Aussiedog88 New Member

    Joined:
    Apr 25, 2020
    Messages:
    20
    Likes Received:
    5
    How would I be able to tell if they were in the .ap file format? And if they are, is there a way to fix that?

    Thank you
     
  41. cunningn#3154

    cunningn#3154 Well-Known Member

    Joined:
    Mar 22, 2023
    Messages:
    225
    Likes Received:
    298
    Remember that this isn't a fully-formed end-user tool with lots of nice UI - it requires you to have some TS backend knowledge and some basic VB skills. The source and target dropdowns should list all available routes identified by GUID. It is indeed hardcoded to look at the C: program files... location so that was the right thing to do.
    However, it allowed for 'local adjustment'. So the first thing the code does is to look for an ini file override:
    Code:
            gsRWPath = GetIniValue("section", "RW-path", "c:\rw-klon.ini", "c:\program files (x86)\steam\steamapps\common\railworks\content\routes\")
            gsRWTrackSubstitute = GetIniValue("section", "Track-substitute", "c:\rw-klon.ini", "")
            fname = GetIniValue("section", "Mixmap-conversion", "c:\rw-klon.ini", "0")
    
    This means that you can setup an ini file in the root of 'c:' (classy coding or what??) that points to a different location for your TS/RW install.
    You can also use it to specify a different track that you intend to use on the cloned route and get a mixmap conversion data (cannot remember how that worked or what it did). Sample here:
    [section]
    RW-path=
    Track-substitute=
    Mixmap-conversion=0
    Mixmap-table=

    BUT - since you copied the TS stuff into the correct c: drive location that isn't as helpful as it might be.

    As Peter says, if ALL of your routes were in .ap files then my Noddy routine wouldn't find them - but the default Kuju ones are always in the open so it can't be that or youi would see at least those ones.
    So I guess it could still be pathing
    - check that your copy of TS is in exactly the location: c:\program files (x86)\steam\steamapps\common\railworks\content\routes\
    - make sure everything in your TS folder is read-writable - no write protection
    Maybe try the ini files approach and point to your real install location.

    What OS are you running on? At some point my old code will stop being supported or blocked as suspicious activity so there is always that happy thought...
     
    • Like Like x 1
  42. 749006

    749006 Well-Known Member

    Joined:
    Dec 10, 2016
    Messages:
    10,057
    Likes Received:
    3,140
    When you open the Route Folder there will be a MainContent.ap file. - it is like a Zip file with a different name
    And 7z which is free, https://www.7-zip.org/, can be used to open and extract the required files
     
    • Like Like x 2
  43. Aussiedog88

    Aussiedog88 New Member

    Joined:
    Apr 25, 2020
    Messages:
    20
    Likes Received:
    5
    Ok thank you both for your answers. The pathing was indeed the issue. I didn't initially copy the copied folder into the Steam folder on my C drive out of fear Steam would confuse the 2, but I made that exact pathing and the program was able to find the 2 routes. The route folders do not have a MainContent.ap so it was able to find them.

    Thank you both so much for that.

    However now I've run into another issue. This should be the last one though as I've got everything else setup. I get the route folder names in and plug in the tile-file-range and offset and hit initialise. No issues yet. Then I hit run, every single tile copy failed for the same 2 reasons. These are also in the screenshots but they are:
    1) (This one is the most common) error in TileCopy Could not find a part of the path 'c:\temp\workfile.bin'
    2) (This one happens about once every 5 errors) error in CleanUpCat_Main Could not find a part of the path 'c:\temp\workfile.bin'

    I tried the .ini file trick to see if that would work.
    I went and ensured every file that would've been accessed was not write protected.
    These made no difference.

    Does anyone know a solution to this?

    And I'm using Windows 11 Home.

    Thank you all.
     

    Attached Files:

  44. Aussiedog88

    Aussiedog88 New Member

    Joined:
    Apr 25, 2020
    Messages:
    20
    Likes Received:
    5
    Ok so bear in mind I do know a fair bit about how the route construction of TS works with regards to files, but I have a VERY basic understanding of coding. I could read it given some time, but I wouldn't know the first thing about editing it. I could see the different tile names and work things out, but I could open the .bin file, I would stare at it, it would stare back at me and I would close the file without making any changes.

    With that in mind I think I may have found the issue here:
    I downloaded the latest Visual Basic and Visual Studio and I opened and used the program through VS to see what was happening. When the same error from the program inevitably comes up, I look at the feedback in VS and it reads the following:

    Exception thrown: 'System.IO.DirectoryNotFoundException' in mscorlib.dll
    Exception thrown: 'System.IO.DirectoryNotFoundException' in Microsoft.VisualBasic.dll
    Exception thrown: 'System.IO.FileNotFoundException' in Microsoft.VisualBasic.dll

    The error that shows up from the program itself is the it cannot find "workfile.bin".
    I also cannot seem to open this program in Visual Basic either. (I'm using VB 6.0)

    Is this just a simple case of creating a file called workfile.bin in a folder somewhere correctly in the directory? If so where can I place this?

    Thank you all for your input and help.
     
  45. Spikee1975

    Spikee1975 Guest

    There's also Claudio Mussa's RWMergeRoute tool.

    I'd advise to copy all source files needed to a temp folder (unpack MainContent.aps) and do your merging there. Then put the new route folder into your main installation.

    https://www.mcs-software.it/rs/MergeRoute_en/index.htm
     
    Last edited by a moderator: May 14, 2024
    • Like Like x 1
  46. Aussiedog88

    Aussiedog88 New Member

    Joined:
    Apr 25, 2020
    Messages:
    20
    Likes Received:
    5
    That one is excellent at merging 2 routes with the same route origin points. I’ve used it before. The problem is, in this instance, I’m also trying to move a selection of tiles about 40km. Thats why I’m trying to work out the solution to my issue with this one.

    I really do appreciate it though.
     
    • Like Like x 2
  47. cunningn#3154

    cunningn#3154 Well-Known Member

    Joined:
    Mar 22, 2023
    Messages:
    225
    Likes Received:
    298
    Not sure what is going on TBH - but I've zipped up my c:\temp folder (https://drive.google.com/file/d/1zYI6W8wL4aLqPfIHMbG2y2N5KRVpyQsT/view?usp=drive_link)- perhaps you can try using that? Could be read/write on the temp folder itself or missing a utility dll (less likely).
     
  48. Aussiedog88

    Aussiedog88 New Member

    Joined:
    Apr 25, 2020
    Messages:
    20
    Likes Received:
    5
    I've copied and pasted your Temp folder into mine. Made no difference even when I removed the .ini file and copied the routes into the C drive to see if that would work.

    When the errors come up, it looks like they are logged, but the log cannot be copied and the directory is so long that I can't actually see what it's trying to find. I've got 3 screenshots of both the program and Visual Studio after I tried merging 4 tiles:

    My exact pathing to my Temp folder is:
    C:\Users\<MyName>\AppData\Local\Temp
    My exact pathing to my Railworks folder is:
    D:\SteamLibrary\steamapps\common\RailWorks
    When I open either Route folder I find 5 folders and a file:
    MixMap, Networks, Scenarios, Scenery, Terrain and RouteProperties.xml

    I hope this information will help get to the bottom of this. Thank you
     

    Attached Files:

  49. Aussiedog88

    Aussiedog88 New Member

    Joined:
    Apr 25, 2020
    Messages:
    20
    Likes Received:
    5
    If it’s absolutely necessary, I could start the process of moving everything TS related to the C drive? I’d have to reinstall most of my mods on top of it taking like a day, but for this I think it’d be worth it.
     
  50. cunningn#3154

    cunningn#3154 Well-Known Member

    Joined:
    Mar 22, 2023
    Messages:
    225
    Likes Received:
    298
    The program is looking for the c:\temp\ folder - it isn't going to find it anywhere else (ie it isn't in your own documents space - it is in the root ). No need to move the TS install anywhere as long as you set its path in the ini file which must be in the root of c:
     
    • Like Like x 1

Share This Page