Elvas Tower: OR consist format - Elvas Tower

Jump to content

Posting Rules

All new threads will be started by members of the Open Rails team, Staff, and/or Admins. Existing threads started in other forums may get moved here when it makes sense to do so.

Once a thread is started any member may post replies to it.
  • 24 Pages +
  • 1
  • 2
  • 3
  • 4
  • 5
  • Last »
  • You cannot start a new topic
  • You cannot reply to this topic

OR consist format Let's talk details Rate Topic: -----

#21 User is offline   Genma Saotome 

  • Owner and Admin
  • PipPipPipPipPipPipPipPipPipPipPip
  • Group: ET Owner
  • Posts: 13,968
  • Joined: 11-January 04
  • Gender:Male
  • Location:United States
  • Simulator:Open Rails
  • Country:

Posted 07 July 2020 - 12:16 PM

View PostYoRyan, on 07 July 2020 - 09:49 AM, said:


The way I envisioned this, we would keep both parsers around, but have them both load the same (overhauled) TrainCfg data class. Manual conversion would be possible in the new consist editor in the MSTS->OR direction only. But I'm open to criticism on this front, too...


Up to you programmers but if I was on your side of the fence I would complain. Would it not be better to have the code act upon the new formats ASAP so the old objects and methods could be depreciated? That way maintaining things would be as it is now: just one way of doing things.

It's up to you guys... but it is also your time in play.

#22 User is offline   YoRyan 

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

Posted 07 July 2020 - 12:53 PM

The simplest method that I can see is to extend the TrainCfg class with the data fields and functionality we want, and then to write a parallel parser for the JSON format. This is a much simpler task than one might assume due to the ease of working with JSON.

* With the caveat that my assumptions could be completely wrong, and circumstances might well change once I start writing code. :)

#23 User is offline   Genma Saotome 

  • Owner and Admin
  • PipPipPipPipPipPipPipPipPipPipPip
  • Group: ET Owner
  • Posts: 13,968
  • Joined: 11-January 04
  • Gender:Male
  • Location:United States
  • Simulator:Open Rails
  • Country:

Posted 07 July 2020 - 01:14 PM

If it will help any, an example using the SIMIS file type (only because I know how to do that)
Train (
TrainUiD ( Int )
TrainName ( string )
MaxVelocity (default values; could be replaced by Activity process data )
TrainClass ( string: 1 to 5 plus Extra )
TrainDirectionOfTravel ( string -- East, West, North, South )
BlockList
Block (

BlockUiD ( Int )
BlockFileName ( String ) <--- I am assuming all of these files are in the same directory
BlockOrder ( 1 )

)
Block (

BlockUiD ( Int )
BlockFileName ( String )
BlockOrder ( 2 )

)
Block (

BlockUiD ( Int )
BlockFileName ( String )
BlockOrder ( 3 )

)

)

)

BlockFile (

BlockName ( (default values; could be replaced by Activity process data )
BlockOrigin ( (default values; could be replaced by Activity process data )
BlockDestination ( (default values; could be replaced by Activity process data )
Roster (

Uid ( int )
Path ( string )
FileName ( string )
RosterType* (

RosterTypeName (Engine, Wagon, etc. ) <-This identifies what specialized attributes to expect next, if any.
LadingName (String )
MassLading ( real, Unit of Measure )
ConsigneeName ( string)
ConsigneeLocation ( string )

or

FuelLevel ( real )
WaterLevel ( real )
etc.

)

Uid ( int )
Path ( string )
FileName ( string )
RosterType ( [indent]
<relevant data for this entry>

)
etc.)
)

)


It should be fairly clear what .con file data migrates to either Train or Block files. Anything new is mostly for information to display in-game. The exception is MassLading() which would necessitate calculating Davis A, B, and C in the program as well as adding MassEmpty() and DavisFormulaID() to .engs and .wags. The effect of doing this would be to transform most rolling stock to an empty status with final mass determined by either default values in .wags and .engs or variable values from the Activity process. This normalizes the data to more closely reflect real world railroading.


* RosterType may be a very poor choice for a name; What I'm getting at here is to identify what kind of rolling stock appears in the next block of data -- locomotives, freight cars, passenger cars, anything else that comes to mind where each one of those types may present a unique set of attributes tot he program specific to that type.

#24 User is offline   Genma Saotome 

  • Owner and Admin
  • PipPipPipPipPipPipPipPipPipPipPip
  • Group: ET Owner
  • Posts: 13,968
  • Joined: 11-January 04
  • Gender:Male
  • Location:United States
  • Simulator:Open Rails
  • Country:

Posted 07 July 2020 - 01:20 PM

View PostYoRyan, on 07 July 2020 - 12:53 PM, said:

The simplest method that I can see is to extend the TrainCfg class with the data fields and functionality we want, and then to write a parallel parser for the JSON format. This is a much simpler task than one might assume due to the ease of working with JSON.

* With the caveat that my assumptions could be completely wrong, and circumstances might well change once I start writing code. :)

Sounds like there could be a two step effort here: A conversion of some number of existing file types to .json and a migration from the KUJU data content to whatever new content is wanted for a future OR.

#25 User is offline   YoRyan 

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

Posted 09 July 2020 - 12:43 AM

Will update the original post as I evolve the proposal, as I have just done. Removed recursion as it seems too complex for correspondingly little gain.

Dave, the properties you propose seem better suited to a new activity format. Activity designers would want to control things like fuel and cargo levels. There are no doubt some data tags that belong in the consist format, but perhaps not very many, since a single consist can expect to be spawned many times during the same session.

#26 User is offline   Genma Saotome 

  • Owner and Admin
  • PipPipPipPipPipPipPipPipPipPipPip
  • Group: ET Owner
  • Posts: 13,968
  • Joined: 11-January 04
  • Gender:Male
  • Location:United States
  • Simulator:Open Rails
  • Country:

Posted 09 July 2020 - 09:27 AM

View PostYoRyan, on 09 July 2020 - 12:43 AM, said:


Dave, the properties you propose seem better suited to a new activity format. Activity designers would want to control things like fuel and cargo levels. There are no doubt some data tags that belong in the consist format, but perhaps not very many, since a single consist can expect to be spawned many times during the same session.


I agree entirely.

The issue here is whether or not there is utility in having defaults and if so will the task of over-writing them be an acceptable process. Not having defaults means all of that data needs to recorded in the Activity file area yet those files would only up updated (or append) data to other objects. IMO this really needs a GUI based editor driving transactions -- Pick a train from this list (a routine step), ok now here is the list of locomotives and the attributes you might want to (must) provide new values, here is the list of cars in that train etc, etc, here is the next train.... Defaults could greatly minimize that task. Or not. At this stage it is hard to tell. In this case my role is to put the question on the table.

FWIW, some time ago Chris and I discussed using .inc files to alter a .con file as it is read into the loader. I think it is in the developing features forum. It might be a more straightforward way to accomplish things and a different .inc could be specified for each spawning..

I suppose the second factor to consider is which object inside the program will all of those variables newly added to activity file wind up? I suspect in places like the train, engine and wagon objects. That doesn't require the same attributes to also be in the original flat files but there might be some good-enough reason to have them.

#27 User is offline   YoRyan 

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

Posted 11 July 2020 - 01:40 PM

Okay, I think I've worked out how randomized player consists should interact with the launcher. Basically, we give the player a choice of lead locomotive, and then go from there.

Hopefully I'll be able to start writing some code soon.

#28 User is offline   Genma Saotome 

  • Owner and Admin
  • PipPipPipPipPipPipPipPipPipPipPip
  • Group: ET Owner
  • Posts: 13,968
  • Joined: 11-January 04
  • Gender:Male
  • Location:United States
  • Simulator:Open Rails
  • Country:

Posted 11 July 2020 - 07:14 PM

Ryan, does the team already have a SIMIS to .json translation utility?

#29 User is offline   YoRyan 

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

Posted 11 July 2020 - 08:44 PM

We do not. You could write a 1:1 translator that copies the exact property names and values, but that would be pointless without a functional loader, or knowledge of what the native OR formats would look like. It might make sense for .eng, .wag, .sd, and route definition files, which we probably wouldn't alter substantially, but in the case of .con, I plan to drop certain Kuju fields and relocate some others. That would need to be explicitly programmed into a translator; a one-size-fits-all-SIMIS-files approach is not suitable.

It's like trying to convert your old records to XML when you haven't even defined the new schema.

#30 User is offline   Genma Saotome 

  • Owner and Admin
  • PipPipPipPipPipPipPipPipPipPipPip
  • Group: ET Owner
  • Posts: 13,968
  • Joined: 11-January 04
  • Gender:Male
  • Location:United States
  • Simulator:Open Rails
  • Country:

Posted 11 July 2020 - 09:35 PM

I was thinking more along the lines of taking files I know and then looking at what they look like in .json.

These days I can struggle and maybe accomplish some simple things in Ruby but that's about it. SQL and data modeling remain very strong.

  • 24 Pages +
  • 1
  • 2
  • 3
  • 4
  • 5
  • Last »
  • 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