Elvas Tower: Route extending Open Rails files - Elvas Tower

Jump to content

  • 9 Pages +
  • « First
  • 5
  • 6
  • 7
  • 8
  • 9
  • You cannot start a new topic
  • You cannot reply to this topic

Route extending Open Rails files Rate Topic: -----

#91 User is offline   jonas 

  • Engineer
  • Group: Posts: Contributing Member
  • Posts: 592
  • Joined: 04-April 14
  • Gender:Male
  • Simulator:MSTS & OR
  • Country:

Posted 27 April 2021 - 06:33 PM

Thanks for replying, I was just curious if it is known how to fix the sd40-2 model.
I am trying to program an editor for the clocks files. I have to read the JSON animated.clocks-or and the STF clocks.dat. So I just realize what a considerable effort is required for this.

Best regards
Jonas

#92 User is offline   YoRyan 

  • Conductor
  • Group: Posts: Active Member
  • Posts: 391
  • Joined: 19-February 20
  • Gender:Male
  • Location:California, United States
  • Simulator:Open Rails/unstable
  • Country:

Posted 27 April 2021 - 06:38 PM

Well, there's loader code and a converter already in Open Rails, so there's no need to write your own readers. In addition, mainline OR does not need support for clocks.dat.

#93 User is offline   jonas 

  • Engineer
  • Group: Posts: Contributing Member
  • Posts: 592
  • Joined: 04-April 14
  • Gender:Male
  • Simulator:MSTS & OR
  • Country:

Posted 27 April 2021 - 06:55 PM

View PostYoRyan, on 27 April 2021 - 06:38 PM, said:

Well, there's loader code and a converter already in Open Rails...
Thanks for the tip. I forgot to mention that I don't program the editor in C#. It will run (if I can get it to work at all :-) as a stand alone, independend from OR. It's more of a template how such an editor could look like...maybe just for me.

#94 User is offline   YoRyan 

  • Conductor
  • Group: Posts: Active Member
  • Posts: 391
  • Joined: 19-February 20
  • Gender:Male
  • Location:California, United States
  • Simulator:Open Rails/unstable
  • Country:

Posted 27 April 2021 - 07:08 PM

Do note that we only accept C# into our repository, so if you choose not to use it, you will not be able to contribute your editor to OR.

#95 User is offline   jonas 

  • Engineer
  • Group: Posts: Contributing Member
  • Posts: 592
  • Joined: 04-April 14
  • Gender:Male
  • Simulator:MSTS & OR
  • Country:

Posted 27 April 2021 - 07:21 PM

I am perfectly clear about this.

#96 User is offline   Csantucci 

  • Member, Board of Directors
  • Group: Posts: Elite Member
  • Posts: 7,445
  • Joined: 31-December 11
  • Gender:Male
  • Country:

Posted 27 April 2021 - 11:10 PM

Ryan, I don't think that the SD40 issue demonstrates that STF is unreliable or badly defined. Assume you have a shape editor that generates loadable .json shape files. I could modify them, still maintaining the .json syntax, and get something that is unloadable. That wouldn't mean that Json is unreliable or badly defined.
By the way, do you mean SD40 or SD40-2? The latter loads here.

#97 User is offline   Laci1959 

  • Superintendant
  • Group: Posts: Elite Member
  • Posts: 1,131
  • Joined: 01-March 15
  • Gender:Male
  • Simulator:Alföld
  • Country:

Posted 27 April 2021 - 11:47 PM

Why is manual repair sometimes necessary? A very typical example:

https://msts.steam4m...ls/gantlet.html
https://msts.steam4m..._dbl_slips.html

OR does not handle this to date. TSRE is already yes but not complete. This is when manual editing comes in.
There will always be something in the situation that the app creator does not think about.
Mindig kíváncsian figyelem az újdonságokat, mert ezek viszik előbbre az Open Railst.

#98 User is offline   cjakeman 

  • Executive Vice President
  • PipPipPipPipPipPipPipPipPip
  • Group: ET Admin Group
  • Posts: 3,031
  • Joined: 03-May 11
  • Gender:Male
  • Location:Peterborough, UK
  • Simulator:Open Rails
  • Country:

Posted 28 April 2021 - 08:11 AM

View PostGenma Saotome, on 27 April 2021 - 05:12 PM, said:

Consider, if the goal is to completely replace stf so that code can be retired, how long will that take? How many programmers? What will be done with people who don't convert or don't convert fully, as in some gets down this week, some next, etc. etc, and in three months his will all be in the new format?

. . .

I'm checking out.

Dave, I think the message has become muddled. We are not taking away the parsing of STF for existing types of file. JSON is only for new types of file.

Our policy is that "Open Rails will continue to maintain compatibility with content from previous official versions of Open Rails."

I will be publishing this and other policies on the Open Rails website shortly.

#99 User is offline   Goku 

  • Superintendant
  • Group: Posts: Elite Member
  • Posts: 1,785
  • Joined: 12-December 13
  • Gender:Male
  • Simulator:my own
  • Country:

Posted 28 April 2021 - 08:52 AM

View PostYoRyan, on 27 April 2021 - 06:13 PM, said:

There's a backslash at the end of one of the lines that fools OR's parser. Just one of many ambiguous corner cases in the STF syntax.

If you decide to use custom fast libs for JSON loading, then different libs can treat this kind of bugs differently too.

I don't think that pointing to bugs in some STF files is any reasonable argument against STF file format.

#100 User is offline   YoRyan 

  • Conductor
  • Group: Posts: Active Member
  • Posts: 391
  • Joined: 19-February 20
  • Gender:Male
  • Location:California, United States
  • Simulator:Open Rails/unstable
  • Country:

Posted 28 April 2021 - 08:57 AM

View PostCsantucci, on 27 April 2021 - 11:10 PM, said:

Ryan, I don't think that the SD40 issue demonstrates that STF is unreliable or badly defined. Assume you have a shape editor that generates loadable .json shape files. I could modify them, still maintaining the .json syntax, and get something that is unloadable. That wouldn't mean that Json is unreliable or badly defined.
By the way, do you mean SD40 or SD40-2? The latter loads here.

The SD40-2. Here's the file that doesn't load; it's straight from the MSTS 1.2 update. I have just tested it on master and on NewYear and it doesn't work on either. It's possible you've already repaired your own copy.

Attached File  SD402.zip (12.14MB)
Number of downloads: 340

It's the syntax that's badly defined about STF, not the names of the properties. In the case of the SD40-2, there's a backslash at the end of one of the lines. What is that supposed to mean to the parser? Kuju apparently just ignores it, but Open Rails doesn't. Should we change the behavior to match MSTS's? If we do, does this break any existing OR files that assume our current behavior?

You don't have these kinds of problems with JSON. If your data doesn't load correctly in your web browser, then it's not valid JSON.

View PostGoku, on 28 April 2021 - 08:52 AM, said:

If you decide to use custom fast libs for JSON loading, then different libs can treat this kind of bugs differently too.

Actually, they don't. There's one and only one way to parse JSON. This information does not exist for STF.

View PostGoku, on 28 April 2021 - 08:52 AM, said:

I don't think that pointing to bugs in some STF files is any reasonable argument against STF file format.

But it's a file produced by Kuju themselves. It's not a bug - it was intentional. The bug is in Open Rails itself, a consequence of the extreme difficulty of writing a consistent STF parser.

#101 User is offline   jonas 

  • Engineer
  • Group: Posts: Contributing Member
  • Posts: 592
  • Joined: 04-April 14
  • Gender:Male
  • Simulator:MSTS & OR
  • Country:

Posted 28 April 2021 - 11:29 AM

Just for my understanding - If this is the correct json file:

[
  {
    "Name": "Foo.s",
    "Type": "tree"
  }
]


And this would be the same json file with a typo:

[
  {
    "Name": "Foo.s",
    "Type": "tree"\
  }
]


Would the json parsers in general be robust enough to read the latter file flawless?

#102 User is offline   jonas 

  • Engineer
  • Group: Posts: Contributing Member
  • Posts: 592
  • Joined: 04-April 14
  • Gender:Male
  • Simulator:MSTS & OR
  • Country:

Posted 28 April 2021 - 11:42 AM

Meanwhile I've test it with "animated.clocks-or" and get this box:
Attached Image: BackSlashError.jpg

To be fair: At least an error box pops up in OR with a hint where the error comes from.
But no error box with the OR-STF-Parser when reading the SD40-2, but then the SD40-2 isn't visible ...and one does not know why.

#103 User is offline   YoRyan 

  • Conductor
  • Group: Posts: Active Member
  • Posts: 391
  • Joined: 19-February 20
  • Gender:Male
  • Location:California, United States
  • Simulator:Open Rails/unstable
  • Country:

Posted 28 April 2021 - 11:56 AM

As you can see by running your snippet through JSONLint, it's not considered valid JSON:

Error: Parse error on line 3:
....s",	"Type": "tree"\}]
----------------------^
Expecting 'EOF', '}', ':', ',', ']', got 'undefined'

The point is not so much that the parser is "robust" - it's that you can expect every JSON reader ever written to follow the exact same logic. If it doesn't pass this validator, it's not JSON. Period.

Is the SD40-2 shape valid STF? Kuju thinks so. MSTS thinks so. Open Rails does not. But Open Rails has become the de-facto STF reader.

#104 User is offline   Goku 

  • Superintendant
  • Group: Posts: Elite Member
  • Posts: 1,785
  • Joined: 12-December 13
  • Gender:Male
  • Simulator:my own
  • Country:

Posted 28 April 2021 - 12:01 PM

View PostYoRyan, on 28 April 2021 - 08:57 AM, said:

The SD40-2. Here's the file that doesn't load; it's straight from the MSTS 1.2 update. I have just tested it on master and on NewYear and it doesn't work on either. It's possible you've already repaired your own copy.

Attachment SD402.zip

It's the syntax that's badly defined about STF, not the names of the properties. In the case of the SD40-2, there's a backslash at the end of one of the lines. What is that supposed to mean to the parser? Kuju apparently just ignores it, but Open Rails doesn't. Should we change the behavior to match MSTS's? If we do, does this break any existing OR files that assume our current behavior?

But the case with this file may be just an user made bug.

View PostYoRyan, on 28 April 2021 - 08:57 AM, said:

You don't have these kinds of problems with JSON. If your data doesn't load correctly in your web browser, then it's not valid JSON.

So, maybe the SD40-2 file is not a valid file and MSTS parser just ignores this bug?

View PostYoRyan, on 28 April 2021 - 08:57 AM, said:

Actually, they don't. There's one and only one way to parse JSON. This information does not exist for STF.

No programmer is perfect and many of these fast libs don't have to follow the specs 100% correctly. Try opening advanced ODF file id different apps and the result may be completely different. It's common.

View PostYoRyan, on 28 April 2021 - 08:57 AM, said:

But it's a file produced by Kuju themselves. It's not a bug - it was intentional. The bug is in Open Rails itself, a consequence of the extreme difficulty of writing a consistent STF parser.

How do you know that it was intentional? It doesn't mean anything.

I think that you are looking for problems where there are none. If you don't know what to do with "\" character in STF file when parsing it, just don't allow using it in OR files.

#105 User is offline   Goku 

  • Superintendant
  • Group: Posts: Elite Member
  • Posts: 1,785
  • Joined: 12-December 13
  • Gender:Male
  • Simulator:my own
  • Country:

Posted 28 April 2021 - 12:06 PM

Look, TSRE parser doesn't know nothing about "\" character, but this file works fine here:

https://i.imgur.com/WcSYOhq.png

I'm just a noob programmer and TSRE doesn't care about looking for errors. In the time of MSTS development it was common, handling errors makes things slower.

  • 9 Pages +
  • « First
  • 5
  • 6
  • 7
  • 8
  • 9
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users