Advanced Route Merger

Forum for discussion about TSRE features.
Post Reply
User avatar
Goku
Site Admin
Posts: 363
Joined: 15 Jan 2019, 18:10
Location: Poland
Contact:
Here is an example of what you can achieve using TSRE code.

Friends asked me if it would be possible to merge two routes which were made using completely different coordinates. One route uses real word Lat/Lon data MSTS map projection, the other route is placed somewhere else.

Here is the same palce in two routes. You can see that not only World Tile doesn't match, but even xyz coordinates. So, it would not be possible to merge them using the old ways of copying and pasting world files.

Image

Image

So, In two days I made new merging software using TSRE. It doesn't just copy files, but reads objects from second route and places them in a new place on a main route.
How does it work?

Merging routes.

1.
Find the same place in two routes and note both coordinates of this place.
I decided to choose one of the junctions. It is best choice if you want to merge tracks nicely.

Image

Image

Convert Tile XY+xyz coordinates to xyz coordinates.
resultX = X*2048 + x
resultZ = Z*2048 + z

Calculate offset between these two points:
result = second route - main route
Result for X and Z values must be rounded, so it can be divided by 128. Using other values may result in a bad quality of merged terrain, but if you wish to retexture terrain anyway, you can ignore it.
For me it ended with -8448, 81.47992, -9600

2.
Place new line in settings.txt:
routeMergeString = second_route_dir:X:Y:Z
For me it is:
routeMergeString = Poznan- Olsztyn:-8448:81.47992:-9600

3.
Make sure that autoFix is disabled and loadAllWFiles is enabled in settings.txt first!
Run TSRE and select main route.

After some time and nice progress bars you should see the merged route:

Image

Image

As you can see, you can nicely merge routes regardless of it's coordinates.

Also you can see on the images above that routes must be prepared first before merging.

So, start from the beginning.

Preparing routes.

1. First you have to decide which signals and speedposts you want to keep if routes use different sigcfg.dat, speedpost.dat files.
When you decide:
Place new line in settings.txt:
objectsToRemove = signal:speedpost
Enable autoFix and loadAllWFiles.
Run the route you want to remove signals and speedposts.
When loading is finished, see Errors and Messages Window. Signals and Speedposts should be removed from route World Files and autoFix should fix all TDB errors related to this issue.

Image

Save route and quit.
Paste choosen sigcfg.dat, sigscr.dat and speedpost.dat files into main route directory.

2. Now you have to decide which overlapping objects you want to keep.
When you decide, open route in TSRE where you want to clear overlapping area.
For multiple selection, select terrain patches using Shift + mouse and choose Select Objects" option.

Image

Image

Delete and repeat until you are satisfied with the result.

3. Use autoFix on both routes to remove broken objects before merging the routes.

4. Paste assets from Terrtex, Textures and Shapes directories from second route to the main route.

5. Merge routes using instructions above.

Image

Now the result is much better.

6. You can use dynamic track Flex Tool to easy merge tracks from two routes:

Image

7. New, merged route is ready to run in OR.

Image

===

More work needs to be done, like merging ssource.dat, ttype.dat and .ref files. But it can be done by hand.
Tool will be available in next TSRE version.

Septf
Posts: 24
Joined: 16 Jan 2019, 14:04
Location: France - Charente
Contact:
thank you for your work

Best regards

Jean-Marc

Archimage
Posts: 118
Joined: 19 Feb 2019, 12:17
Is it possible to rotate (not just change the coordinates of tiles) one of the routes during the merge? For example if i need to rotate one of the routes 45 degrees clockwise....

User avatar
Goku
Site Admin
Posts: 363
Joined: 15 Jan 2019, 18:10
Location: Poland
Contact:
Nope.

Weichenpfleger
Posts: 1
Joined: 16 Jan 2019, 16:39
@Goku

I have been trying for some time with the new
"Advanced Route Merger" to merge the Wuppex and Rollbahn lines in the Münster area.
Unfortunately, the program always crashes after reading the 2nd world file. I have already successfully connected the WuppEx route with PT10 Aachen-Cologne, which worked straight away.
I am attaching the "Log" and "Settings" files.
log - Kopie.zip
(87.02 KiB) Downloaded 1784 times
settings - Kopie.zip
(867 Bytes) Downloaded 1786 times
Thank you for your wonderful work.

Regards

Weichenpfleger

Archimage
Posts: 118
Joined: 19 Feb 2019, 12:17
I have a problem with this function:
objectsToRemove = signal:speedpost
Enable autoFix and loadAllWFiles.
I tried to use it to automatically clean out my own route from the old signals and speedposts (to place signals with new models and scripts after that) and found out that the tdb is somehow broken after that... You still can work in TSRE with the route but the RTS dispatcher app now doesnt normally work with it: when you try to switch any point (junction) the RTS dispatcher app just "lags" (even i have a powerful PC) or even freezes that you have to restart it. So somehow the "objectsToRemove" function breaks down the tdb (even visually all is ok) and you can no more use the route in RTS. Why does this happen? How to fix?

robwor78
Posts: 1
Joined: 12 Nov 2023, 19:26
Hello! I'm having trouble calculating this part:

Code: Select all

Convert Tile XY+xyz coordinates to xyz coordinates.
resultX = X*2048 + x
resultZ = Z*2048 + z
What is Tile XY and what is xyz coordinates? Could you please tell me in the screenshot above which values these are in order to calculate the result given below?
Last edited by robwor78 on 12 Nov 2023, 19:36, edited 1 time in total.

Post Reply