Elvas Tower: Potential Features to Simplify ENG/WAG Creation - Elvas Tower

Jump to content

  • 3 Pages +
  • 1
  • 2
  • 3
  • You cannot start a new topic
  • You cannot reply to this topic

Potential Features to Simplify ENG/WAG Creation Let's make engines and wagons a bit easier to manipulate. Rate Topic: -----

#1 User is offline   pschlik 

  • Conductor
  • Group: Posts: Contributing Member
  • Posts: 458
  • Joined: 04-March 15
  • Gender:Male
  • Simulator:OpenRails - Unstable
  • Country:

Posted 14 August 2024 - 01:11 PM

As some might know, I have created a few physics replacement sets in my time. This has been sort of in the style of Gerry's conversion kits but much more in the weeds with specific details, to the point that I completely throw out the original .eng and .wag files so every little piece of the rail vehicle is set by my mod. Despite heavy use of include files, this means it's not a drop in replacement (can't just replace the MSTS GP38-2 engine with "include("GP38-2_Physics.inc")" and be done; what gear ratio is it, what type of dynamic brakes, how heavy did this railroad make theirs, what's up with the 3D model, and so on) and as a result setting up anything new is pretty involved. But I've noticed the setup is involved for the wrong reasons-it doesn't take so much time to figure out the right engine, gear ratio, dynamic brakes, fuel tank size...it's silly things like the 3D model isn't centered and I need to manually calculate the center of gravity Z value to re-center it, calculating davis numbers twice because of empty/load weight change, or the lovely fun process of doing shape file editing to set up a reskinned locomotive. All these steps that don't require much thought are ripe for automation, and I wouldn't mind not doing them anymore.

So, before I go crazy from tedious work on more physics modifications, I want to determine and implement (haven't started on any of this) some simple things that would make .eng and .wag set up easier. I'm curious if any of this sounds useful for other workflows (I know I'm pretty much on my own when it comes to complete replacements of .eng and .wag files), or if there are any ideas in a similar vein that I haven't considered.


Automatic Model Centering: I am tired of checking for and calculating the offset to re-center shape files, so I'd like to bypass the need to use the whole CentreOfGravity thing to re-center models exported with the wrong origin by providing a parameter to automatically re-center the rail vehicle 3D model. Eg: ORTSCenterShapeZ() could read the 3D model data, check the min and max Z values, then calculate the required offset for the min and max to be equidistant from the origin, and set CentreOfGravity Z to that value automatically (without the 1-meter limit currently imposed on CoG.Z). The data is there, so why should I ever waste time running that calculation myself? Another advantage of this approach (and many other ideas in this post) is that it dynamically updates when the 3D model changes, which might be useful if the author actually fixes their stuff and centers the model. I specifically mention centering the shape on the Z axis because that's most useful, centering the shape in the X and Y directions could be done but probably wouldn't do anything useful.
(Before anyone responds "just get the shape right the first time" I don't make shapes, it is far too late for that, there's stuff coming out even now that makes these sorts of mistakes. It's far easier to fix in post than expect everyone to both pay attention to the models they make today and fix the thousands of models they have made over the last 20 years. This post is also a case of "only tool hammer .eng file so everything look like nails new STF tokens" but sometimes the .eng file is really the only tool you have)


Automatic Bounding Box Size: To get correct coupler spacing, I always find myself opening up shape files, checking the model length, subtracting off the coupler overlap I want, and manually typing that in the Size() parameter. This is another thing that would be trivial to automate and save me some time. Something such as ORTSAutoSize( 0m, 0m, -0.18m ) could determine the Z dimension (length) of the 3D model, subtract 18 cm from it (this is the coupler spacing I use, I know others are different), then use that value as the model length. The X and Y dimensions of the model would be calculated from the 3D data, but then with no offset added. This would not only ensure the length is correct for coupler spacing, but also ensure that the width and height are at least sensible for calculating the aerodynamic drag of the vehicle, when many MSTS things have nonsense entered for width and height (wagons that aren't rectangles should still have their area specified manually).


Manual Offsets: Find a model that's sitting in the rails or floating above them? That can be solved by shape file editing, but shape file editing is not fun and that only fixes the problem on your computer (again, it is too late to "just get the 3D model correct" there is brand new content coming out with the wheels clipping into the rails); if you want to fix the problem for other people you have to tell them to shape file edit and you immediately lose the interest of most people. Instead, this is something that could be done entirely at runtime inside of OR. Think of something like ORTSOffsetShape( 0m, 0.02m, 0m ) to move a shape up by 2 cm (but with no change to left/right or forward/backward position) because the wheels clip the rails. Due to the way things work under the hood, I think this would also work for offsetting shape components. Bogie in the wrong place? (this would be one very messed up 3D model!) Then maybe ORTSOffsetShape( "BOGIE1", 0m, 0m, -0.2m ) can do the trick.


Model Scaling: There are some particularly baffling cases out there of models, or at least sub objects of models, having completely wrong scaling. Or maybe you want to know what a GEVO would look like on narrow gauge. Again, this would be convenient to solve at the .eng/.wag level instead of editing the shape file. ORTSScaleShape( 0.637, 0.637, 0.637 ) could scale down the entire model (width, height, and length) to 63.7% of original-enough to convert from standard gauge to 3ft gauge. I know I have some models where the bogies are too narrow and the wheels don't align with the track, so ORTSScaleShape( "BOGIE1", 1.2, 1, 1 ) could make the bogie 20% wider without messing up the height or length.


Texture Overrides: How many copies of the same 3D model, just with different texture names specified, do you think you have in your trainset? It could be far more efficient, and easier to set up (again, shape file editing causes a lot of people to tune out), if just one shape file could be used by multiple pieces of rolling stock with the textures specified in a text file. Under the hood, it's not too difficult to intercept the list of textures read from the shape file and sneakily replace it with something else. Something along the lines of ORTSTextureOverride( "BNSF_777_a.ace, BNSF_778_a.dds", "BNSF_777_b.ace, BNSF_778_b.dds" ) could replace the textures for BNSF 777 with those for 778, effectively reskinning the shape without any editing needed. Or perhaps more generically ORTSTextureOverride( "0, BNSF_778_a.dds", "1, BNSF_778_b.dds" ) where 0 and 1 are the index of the texture based on the order of textures in the shape file (this would reduce the risk of typos breaking the texture mapping). Of course, many reskins also involve freight animations so something similar would go into ORTSFreightAnims as well.
I know there are sometimes changes other than textures that might require shape file editing (like changing the material for part of the model to allow transparency), those should also get something that can be done in the .eng or .wag so shape file editing isn't needed at all. If it's not obvious, shape file editing is not something users should have to do in 2024.


Automatic Davis Calculation: Except for some specialty equipment or when using a resistance calculation other than the Davis method, Open Rails receives all the information needed to calculate resistance using the Davis method. I've used quite a bit of time and space setting up resistance numbers (I have entire folders that are just files with resistance numbers) when for the most part I just want the Davis resistance of a boring old boxcar. So, if the user fails to specify resistance values (of course, if the user does enter data like they should, use that), we should at least attempt to generate some reasonable replacement based on the type, weight, number of axles, ORTSBearingType, ORTSDavisDragConstant, ORTSFrontalArea, and so on-think of doing what Fcalc does but doing it automatically upon loading the game. For comparison, the current fallback for missing resistance data is incredibly limited and seems to only consider the weight of the vehicle-probably just a last resort.


Parametric Include Files: My equipment tends to be built out of many include files, allowing things to be assembled piece by piece (can make a locomotive have no dynamic brakes by simply not including the dynamic brake include statement without affecting anything else) which is flexible but the result is an .eng file with too many include statements for anyone but me to understand and far too many .inc files in the common folder to sift through and find what I need. It would be nice if one include file could do more than just one specific configuration, so one of my more exotic ideas is to allow include files to be provided parameters that can tell the include file to read or skip certain lines. The idea here is that include("GP38-2_Physics.inc") could provide the default state for a typical GP38-2, easy enough for someone to add on to an MSTS model without knowing every last detail, while the exact same file could provide much more specificity when used as something like include("GP38-2_Physics.inc", "NoDynamicBrake, ExtraCapacityFuelTank, BlombergM, WBGCompressor"), which would modify the default configuration to have no dynamic brakes, the optional larger fuel tank, relevant adjustments for the Blomberg M bogie, and the big 6 cylinder WBG compressor. Normally each option on the configuration would require a separate include file (this is what I do for dynamic brakes), taking the questionable route of overriding a token by including it again later in the file (I find this works ok ish for the fuel tank capacity), or just giving up and not offering the choice (I don't have the option for the WBG compressor as I understand it's not exactly common). By allowing one file (as opposed to dozens of files) to govern many different design variations, it's easier to make an engine/wagon file as fewer include statements are needed, the common folder gets cleaner as fewer individual .inc files are needed (in theory), and it's easier to account for the various configurations of the real model of locomotive/wagon.
That said, this is the one thing I'm less sure about the technical details of. Include files are already a strange system, anything could happen if more is added in.


Anyway, those are just the things I've already thought of to make .eng and .wag creation easier and that I feel I can implement in a sensible amount of time (I'm hoping to save time in the future, after all!) This is coming from the perspective of someone using MSTS 3D models and rewriting the .eng/.wag from scratch, but I'm sure different perspectives (devs working from their own 3D models, those adding onto existing .eng/.wag instead of starting over, someone who just wants to add reskins without editing things) make for different priorities, so I'm open to other ideas for automating or simplifying these processes.


#2 User is offline   Genma Saotome 

  • Owner Emeritus and Admin
  • PipPipPipPipPipPipPipPipPipPipPipPipPip
  • Group: ET Admin
  • Posts: 15,471
  • Joined: 11-January 04
  • Gender:Male
  • Location:United States
  • Simulator:Open Rails
  • Country:

Posted 14 August 2024 - 02:58 PM

We think alike Phillip, I've suggest a number of things in your list above. I'll send you a few ideas via PM.

As for getting anything done, don't count on anything being done in the OR code unless you code it yourself.

A typical .wag file of mine.

Quote

SIMISA@@@@@@@@@@JINX0D0t______

Wagon ( PRR_USRA_45853
WagonShape ( PRR_USRA_45853.s )
FreightAnim ( usra_ss_50xm_parts.s 1 1 1 )
Include ( "..\\Common.Inc\\Models\\Tim_Muir\\USRA_SS_Boxcar\\XM_USRA_SS_Empty_Car.inc" )
Include ( "..\\Common.inc\\Fleet\\Approved\\Std_Type_E_Coupler_Generic_Draft_Gear.inc" )
Include ( "..\\Common.inc\\Fleet\\Approved\\Single_Pipe_AB_Brakes.inc" )
Include ( "..\\Common.inc\\Fleet\\Approved\\Std_Cast_Iron_Brakeshoe_Friction.inc" )
Sound ( "genfreightwag2.sms" )
Name ( "XM 40' PRR X26 45853 MT" )
)


Perhaps of interest to you is in the Empty_.inc file, specifically parts 1d and 2b:

Quote

Comment ( XM_USRA_SS_Empty_Car.inc )

comment ( "Part 1 - parameters based on the car itself is correct for all .wags of this model" )

comment ( "Part 1A - Physical Dimensions" )
Type ( Freight )
Size ( 3.1m 4.6m 13.45m )
ORTSLengthBogieCentre ( )
ORTSLengthCarBody ( )
ORTSLengthCouplerFace( )
ORTSWagonFrontalArea ( 137.97 ft^2 )

comment ( "Part 1B - Trucks and wheels" )
ORTSNumberBogies ( 2 )
ORTSNumberAxles (4 )
ORTSRigidWheelBase ( 5ft 6in )
ORTSTrackGauge ( 4ft 8.5in )
WheelRadius ( 33in/2 )
ORTSUnbalancedSuperelevation ( 3in )
ORTSBearingType ( Friction )

comment ( "Part 1C - Fixed data for brakes" )
MaxBrakeForce ( 90.9132kN )
MaxHandbrakeForce ( 18.1826kN )
BrakePipeVolume( 0.191ft^3 )


comment ( "Part 1D - Unsupported parameters based on the model itself." )
MaxWidth ( 10ft 1in )
MaxHeight ( 13ft 7in )
TruckWidth ( 6ft 8.5in )
BrakeShoeFriction ( 0.2 )
TargetPctMtyWeight ( 0.7 )
DavisFormula ( "Davis 1926" )

CAPY ( 100000 )
LD_LMT ( 122400 )
LT_WT ( 46200 )


comment ( "Part 2 - all values based on the value of Mass() and physical dimensions and may reflect mass of a lading." )

comment ( "Part 2A - Relevant parameters." )
Mass ( 26.069t-us )
CentreOfGravity( 0m 0.8m 0m )
ORTSDavis_A ( 146.225lbf )
ORTSDavis_B ( 1.0463lbf/mph )
ORTSDavis_C ( 0.0685lbf/mph^2 )

comment ( "Part 2B - Unsupported parameters based on lading." )
LadingName ( None - Mty )
LadingWeight ( 0 lbs )



Both files are the output from a spreadsheet I made.

#3 User is offline   Weter 

  • Member, Board of Directors
  • PipPipPipPipPipPipPipPipPipPip
  • Group: ET Admin
  • Posts: 7,538
  • Joined: 01-June 20
  • Gender:Not Telling
  • Simulator:ORTS
  • Country:

Posted 17 August 2024 - 04:30 PM

Hello.
Sorry, if a bit off topic, though.
Today, I had a little of time to ride along new route for me.
I've taken the last testing version, I have, taken EP-converted EMU train...
Brakes didn't work. Naturally, that is my fault in many, but still: this conclusion have came to my mind:
It's more productive to correct all mistakes, but settle with MSTS settings, than just add some new ORTS features, which will not work some years later, with newer ORTS version. It's against logic, but it's likely so...

#4 User is offline   Weter 

  • Member, Board of Directors
  • PipPipPipPipPipPipPipPipPipPip
  • Group: ET Admin
  • Posts: 7,538
  • Joined: 01-June 20
  • Gender:Not Telling
  • Simulator:ORTS
  • Country:

Posted 17 August 2024 - 04:36 PM

To Your post, Phillip:
Center of gravity. I might misunderstand, likely.
In case of symmetric car, well, two-cab locomotive (already much less perfect), the center of gravity is about the center of the shape, but, when it comes to steam locomotive? MOW machine?

Textures override - very useful-sounding, thanks for idea!
Also great - about Davis coefficients auto-calculation!

Inc-files... Try to sort them into common subdirs (couplers, compressors, air distributors, etc.)

Yes: the big problem: devs often take '2001 dash9 *.eng, modify it here and there, and assigning it to their cool-looking *.s-file of their favorite diesel of 1961, making several mistakes. Then, other devs take that modified *.eng, modifying it further,Mir fitting their upcoming '1971 diesel's model, reproducing original, previous-dev's mistakes, and, maybe, adding their own ones...

#5 User is offline   pschlik 

  • Conductor
  • Group: Posts: Contributing Member
  • Posts: 458
  • Joined: 04-March 15
  • Gender:Male
  • Simulator:OpenRails - Unstable
  • Country:

Posted 17 August 2024 - 06:40 PM

View PostWeter, on 17 August 2024 - 04:36 PM, said:

Center of gravity. I might misunderstand, likely.
In case of symmetric car, well, two-cab locomotive (already much less perfect), the center of gravity is about the center of the shape, but, when it comes to steam locomotive? MOW machine?

The situation I'm talking about (the Z, or front/back, position) of center of gravity has no effect on physics. The only part of CentreOfGravity that changes physics is the Y (or up/down) location of the CoG. Higher CoG.Y makes derailments easier, but CoG.X and CoG.Z don't do anything for derailments (in fact, the X, or left/right, location of the CoG isn't used by the code at all!) By default, the CoG height is 1.8 meters and most people don't change it from that default value. For most things, you want this to be located at the center of the model.
Whatever the CentreOfGravity token does, center of gravity is not exactly an accurate name, but it's what MSTS did so we are stuck with it. If you look at things closely, there are lots of places where the name of an MSTS token makes no sense compared to what it actually does, some are even misspelled... This is why we have to add new things instead of trying to work with old stuff (remember, the grand plan is to stop adding features to .eng and make a new file type that doesn't rely on MSTS behavior at all...but we'll need to get Ryan back involved for any progress to be made on new JSON file formats.)

#6 User is offline   Weter 

  • Member, Board of Directors
  • PipPipPipPipPipPipPipPipPipPip
  • Group: ET Admin
  • Posts: 7,538
  • Joined: 01-June 20
  • Gender:Not Telling
  • Simulator:ORTS
  • Country:

Posted 17 August 2024 - 07:11 PM

Hello.
Thanks for reply. Yeah, adheAsion. But may I know, why Z-axis center is still important, since it does nothing to physics?
I guess, that's for proper animation, negotiating curves?
New config file... Yes, that would be great idea.
Ryan... I doubt, we have good chances (ask him via PM about situation, if You wonder).

#7 User is offline   Traindude 

  • Engineer
  • Group: Posts: Contributing Member
  • Posts: 722
  • Joined: 17-November 13
  • Gender:Male
  • Location:Seattle, WA
  • Simulator:Open Rails
  • Country:

Posted 23 August 2024 - 06:10 PM

I think one thing that might be of interest in regard to the simplification of *.eng/*.wag creation is the use of dynamic numbering & lettering. That way, no two locomotives or cars (of the same class) within a consist have the same exact numbers. Microsoft/Kuju had established the basics for it in the MSTS days from how it manages mileposts and speed limit signs:

Attached Image: speedposttext.jpg

It stands to reason that the same logic can be applied to road numbers on locomotives and rolling stock. However, ErickC once pointed out to me that it's not as easy as it sounds, as each individual railroad had its own preferences of where the numbers should be placed (below cab window, near the hood ends, etc). The same can also be said for "named" passenger cars (sleeping and dining cars, for example).

The use of dynamic numbering/lettering would not necessarily exclusive to locomotives and/or rolling stock either. For example, the same logic can be applied to things like station and interlocking tower name signs, so that we don't need separate shape and/or texture files for each sign.

#8 User is offline   pschlik 

  • Conductor
  • Group: Posts: Contributing Member
  • Posts: 458
  • Joined: 04-March 15
  • Gender:Male
  • Simulator:OpenRails - Unstable
  • Country:

Posted 23 August 2024 - 08:11 PM

Ha, I don't think dynamic numbering fits in the simple to implement category. Perhaps contrary to popular assumptions, it's actually within reach considering all the places dynamic numbers are already placed in 3D space (mileposts, speed signs, any numeric readout in a 3D cab), but it won't exactly automate away tedium...more like replace it with something better, but still a bit tedious since you have to define the 3D positioning and size of these numbers somewhere and that does mean doing more work in the short term.

#9 User is offline   Traindude 

  • Engineer
  • Group: Posts: Contributing Member
  • Posts: 722
  • Joined: 17-November 13
  • Gender:Male
  • Location:Seattle, WA
  • Simulator:Open Rails
  • Country:

Posted 23 August 2024 - 08:17 PM

View Postpschlik, on 23 August 2024 - 08:11 PM, said:

Ha, I don't think dynamic numbering fits in the simple to implement category. Perhaps contrary to popular assumptions, it's actually within reach considering all the places dynamic numbers are already placed in 3D space (mileposts, speed signs, any numeric readout in a 3D cab), but it won't exactly automate away tedium...more like replace it with something better, but still a bit tedious since you have to define the 3D positioning and size of these numbers somewhere and that does mean doing more work in the short term.


I misspoke. What I meant to say is that it could simplify things so we don't need separate shape files for each road number, and perhaps maybe even we won't need separate *.eng/*.wag files -- just let ORTS pick a random number within a series (example: 4000-4049), apply that random number to the first unit in the consist, then select another random number within the same series, and apply it to the next unit, and so on...

I hope that clarifies things. IOW, we may not even have to make separate *.eng/*.wag files for each road number if we have this random-number generator!

#10 User is offline   Weter 

  • Member, Board of Directors
  • PipPipPipPipPipPipPipPipPipPip
  • Group: ET Admin
  • Posts: 7,538
  • Joined: 01-June 20
  • Gender:Not Telling
  • Simulator:ORTS
  • Country:

Posted 26 August 2024 - 01:46 PM

Hello.
That might be quite an interesting idea, however, many locomotives with certain numbers have their own specific features, so concrete models should be made for each of them, but confusing numbers would look as a big mistake in such cases. With cars, I think, that's less critical, but still.

Example: it's known, that locomotive #x had some modernization/customization, #y has traces of wreck, #z does not exist after crash/fire, and #w is totally different locomotive...

  • 3 Pages +
  • 1
  • 2
  • 3
  • 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