Announcement

Collapse
No announcement yet.

OpenRails / MSTS TSECTION.DAT file format

Collapse
X
Collapse
First Prev Next Last
 
  • Filter
  • Time
  • Show
Clear All
new posts

    OpenRails / MSTS TSECTION.DAT file format

    Hi,

    I'm trying to get my head around the (global) TSECTION.DAT file. I'm new to this and am trying to create a tram route so it needs some pretty severe curves, where it would go round corners on streets. I'm just experimenting at the moment. The version of TSECTION.DAT that I am using is based on Build 00038.

    From what I can see, the track shapes, say for example the 250r curve references two other track sections, when I look at those two other track sections, they seem to reference two more track sections and it goes on. I have seen examples where they seem to reference themselves, although I have to be honest, sometimes I get a bit lost.

    I tried to create a new 100r curve at 10 degrees, and I get strange results. I'm using TSRE5 for the track builder, blender to build the objects, and Open Rails as the simulator.

    When I add the track section, and then press Z to add it to the TDB, I dont get the yellow line. It will go in but when I run OR, the train stops when it gets to the section. Also, it will crash TSRE5 if I try to delete the object or press Z to take it back out of the TDB. However, if I place it and then press X a few times to get the curve to point the other way, it works fine.

    I've looked in this forum, google and a couple of other forums to see if I can find the answer, but nothing which seems to 100% show me where I'm going wrong.

    If anyone can point me in the right direction or how the logic of the two parts in the TSECTION.DAT file are put together, I would be most grateful.

    Below are snippets from my TSECTION.DAT file



    Code:
    _Info(100m 10d)
    TrackSection ( 50003
     SectionSize ( 1.435 0 )
     SectionCurve ( 100 -10 )
    )
    		_Info (100m 10 outer curve part)
    		TrackSection ( 50103
    		SectionSize ( 1.435 0 )
    		SectionCurve ( 102.4925 -10 )
    		)
    
    		_Info (100m 10 inner curve part)
    		TrackSection ( 50203
    		SectionSize ( 1.435 0 )
    		SectionCurve ( 97.5075 -10 )
    		)
    The trackshape PArt

    Code:
    TrackShape ( 50003
     FileName ( t2c100r10d.s )
     NumPaths ( 2 )
     SectionIdx ( 1 -2.4925 0 0 0 50203 )
     SectionIdx ( 1 2.4925 0 0 0 50103 )
    )
    			TrackShape ( 50103
    			FileName ( dummy.s )
    			NumPaths ( 1 )
    			SectionIdx ( 1 2.4925 0 0 0 50103 )
    			)
    
    			TrackShape ( 50203
    			FileName ( dummy.s )
    			NumPaths ( 1 )
    			SectionIdx ( 1 -2.4925 0 0 0 50203 )
    			)

    And pictures of what I see in TSRE5

    The left hand curve (doesnt work)

    LeftHand.jpg

    The right hand curve after pressing X (Does work)

    RightHandPressedX.jpg

    Also attached is my TSECTION.DAT

    Thanks,
    Wolfgang

    #2
    Did you update the counts in the headers for Trackshapes and Tracksections? I don't believe pieces in the Global can be numbered higher than 39999.

    The number ranges are pretty much fixed for the global and route Tsections.
    If you like what you see here at Trainsim.com, be it the discussions and knowledge in the forums, items saved in our library or the ongoing development of our TSRE Fork, I hope you'll consider a paid membership to help support keeping the site operating.... Thanks!

    Comment


      #3
      Look in your list of track sections listed in the TSection.dat as 'Tram'
      They have tight radius curves.

      regards,
      ............Vince ..............
      ...... Author NECv4 .......
      .... LIRR BUILD PHOTOS ....
      ...... Eschew Obsfucation ......

      On the The Statue of Liberty in New York Harbor there is a Tablet. On it is written:
      "Give me your tired, your poor, your huddled masses yearning to breathe free,
      the wretched refuse of your teeming shore, send these, the homeless, tempest-tossed to me,
      I lift my lamp beside the golden door!"

      Comment


        #4
        Found them. They're fitting. Cheers Vince.

        Comment


          #5
          I did set them to 60000. I'll put them back to 40000. I see there is a block which is unallocated. I'll get the latest one from github and pick some numbers from that. Thanks.

          Comment


            #6
            Hi,
            I was under the impression that the 40000 range is reserved for dynamic tracks.

            If so, it's best not to mess with them, unless the route is NEVER to be uploaded for public use!

            Cheers,
            Ged

            Comment


              #7
              Yes. I changed it back . There is a block of unused ones acccording to the comments (340 - 22679) so I've borrowed some around the 1000 mark. If this is decent enough to go near the public I'll apply for a reservation, but that would be a long way into the future.

              I might have been interpreting the file wrong too!......
              Last edited by wolfie2; 03-19-2022, 10:50 AM. Reason: The penny may have dropped!

              Comment


                #8
                You only need a reservation if you're planning to release the route publicly and you've created new geometry. For something that you only plan to have for yourself and a few friends, it's fine to just make modifications on the fly within the gaps and give instructions or the modified TSection file to anyone you plan to share with.

                If there are existing sections that already have the desired geometry, it's far easier to do a shape substitution than to add to the TSection.

                Lay the pieces using the already defined sections, and then replace the ShapeFile entry with a relative path to your route's Shapes folder and the associated filename. I've done that with sections where I needed a crossing piece that existed in XTracks, but didn't have a Scalerail equivalent.
                If you like what you see here at Trainsim.com, be it the discussions and knowledge in the forums, items saved in our library or the ongoing development of our TSRE Fork, I hope you'll consider a paid membership to help support keeping the site operating.... Thanks!

                Comment


                  #9
                  So I thought I had this conquered, but it seems I dont. I am trying to create a double piece of track with a central radius of 150m at 5 degrees.

                  I created two track sections and a track Shape:-
                  Code:
                  TrackSection ( 1010
                   SectionSize ( 1.5 0 )
                   SectionCurve ( 147.5075 -5 )
                  )
                  
                  TrackSection ( 1011
                   SectionSize ( 1.5 0 )
                   SectionCurve ( 152.4925 -5 )
                  )
                  And a track shape :-

                  Code:
                  TrackShape (1166
                      FileName (t2c150r5d.s)
                        Numpaths (2)
                        SectionIdx ( 1 -2.4925 0 0 0 1010 )
                        SectionIdx ( 1 2.4925 0 0 0 1011 )
                  )
                  when laid in TSRE5, it is OK providing I dont swap the direction, so on my test environment :-

                  (1st Part : OK)
                  1st Track Piece.jpg
                  (2nd Part: OK)
                  2nd Track Piece.jpg
                  (3rd Part: After pressing 'X' to get it the in the right orientation)
                  3rd Track Piece.jpg
                  It alters the orientation of the first two parts, this is also reflected in OR if I run it.


                  I did some experiments with my 250m 5d section which uses the existing track sections (194 and 196) and amending my two track sections 1010 and 1011 to be identical, I got the same 'jumping result' as with the 150m track shapes.

                  Before, which works perfectly:
                  Code:
                  TrackShape ( 1156
                   FileName ( t2c250r5d.s )
                   NumPaths ( 2 )
                   SectionIdx ( 1 -2.4925 0 0 0 194 )
                   SectionIdx ( 1 2.4925 0 0 0 196 )
                  )
                  After (Which Jumps)

                  Code:
                  TrackSection ( 1010
                   SectionSize ( 1.5 0 )
                   SectionCurve ( 247.5075 -5 )
                  )
                  TrackSection ( 1011
                   SectionSize ( 1.5 0 )
                   SectionCurve ( 252.4925 -5 )
                  )
                  
                  TrackShape ( 1156
                   FileName ( t2c250r5d.s )
                   NumPaths ( 2 )
                   SectionIdx ( 1 -2.4925 0 0 0 1010)
                   SectionIdx ( 1 2.4925 0 0 0 1011)
                  )
                  Can anyone see where I am going wrong?
                  Last edited by wolfie2; 05-22-2022, 06:37 AM. Reason: removed some accidental code copied for my example

                  Comment


                    #10
                    The end result in OR is interesting . . . .

                    Comment


                      #11
                      You almost have it! I was recently working on a project with custom track shapes, and may be able to offer a solution:

                      Any time a new curved "TrackSection" is defined, you need to make two entries - one with a negative curve angle and one with a positive curve angle (for when you flip it with "x")

                      So, your entries would look like this:

                      Code:
                      TrackSection ( 1010
                       SectionSize ( 1.5 0 )
                       SectionCurve ( 147.5075 -5 )
                      )
                      TrackSection ( 1011
                       SectionSize ( 1.5 0 )
                       SectionCurve ( 147.5075 5 )
                      )
                      TrackSection ( 1012
                       SectionSize ( 1.5 0 )
                       SectionCurve ( 152.4925 -5 )
                      )
                      TrackSection ( 1013
                       SectionSize ( 1.5 0 )
                       SectionCurve ( 152.4925 5 )
                      )
                      Code:
                      TrackShape (1166
                          FileName (t2c150r5d.s)
                            Numpaths (2)
                            SectionIdx ( 1 -2.4925 0 0 0 1010 )
                            SectionIdx ( 1 2.4925 0 0 0 1012 )
                      )
                      Notice how the "SectionIdx" lines within the "TrackShape" definition call on sections with a negative curve angle only, which is why curves turn to the left when initially placed in the editor.

                      Also, I found it very helpful to write an include file to store my route-specific tsection modifications and additions. The OpenRails manual has a great description on how to do this so you can avoid altering the global file directly

                      Hope this helps!
                      - Matt

                      Comment


                        #12
                        IMO the best thing a noob can do when trying to master new entries in the tsection file is to search the tracksection portion of the file for a set of specifications that matches what you want. When found you now have a valid SectionIdx() value to use with the shape you have created. That's half of the problem solved. Next search for a trackshape that uses that index, copy/paste that and change the file name to your file and the shape number to one assigned to you. It should be good but always test.

                        It's always best to start with single track tangents, then multiple track tangents, then a single track curve, etc. When in doubt find the data for a similar shape that you are trying to add and examine what somebody else has already done.

                        And of course get a block of numbers assigned to you before you start.
                        Dave Nelson
                        sigpic
                        Seldom visiting, posting less often that that.

                        Comment

                        Working...
                        X