OpenBVE icon indicating copy to clipboard operation
OpenBVE copied to clipboard

WIP: MSTS consist / vehicle parser

Open leezer3 opened this issue 4 years ago • 9 comments

This PR contains a parser for the MSTS consist / vehicle format, along with a lot of associated changes to backend systems. Relevant changes are being cherry-picked into master and this PR rebased relatively regularly.

OpenRails content / physics is not targetted, but is passively supported (recognised as valid but otherwise ignored).

Currently Working:

  • Most consists load in-game correctly.
  • Most cabview components.
  • Basic brake physics
  • Diesel electric physics (basic)
  • Electric physics (basic)
  • Horn sounds
  • Bell sounds (mapped to music horn)

Partially Working:

  • Traction variable controlled sounds are partially working, and will depend on the exact implimentation within the SMS file. Basic sound sets will generally work acceptably, but those dependant on complex interworking of some variables may not.
  • Cab signal displays.

Not Currently Implemented:

  • Steam physics ( https://github.com/leezer3/OpenBVE/pull/814 needs looking at again)
  • Lights
  • Interior views for cars other than the driver car.

Working Animations:

  • PANTOGRAPH1 (pantograph2 is currently rendered permanently down)
  • WHEELS-N
  • ROD-N
  • PISTON-N

Unfortunately, the inbuilt consist / vehicle parser seems to have been very forgiving of errors in the textual block, which means that I'm still very much rehacking the base parser as I go along..... Proabably want to cherry-pick the parser changes into the mainline branch.

msts01 30-odd van train from the 3DTS Cambrian route.

msts02

Class 47 & TEA tankers from Making Tracks' Network South East route.

leezer3 avatar Aug 09 '21 10:08 leezer3

Have picked out the fixes to the format parser, through piped brake type and the renderer tweaks and rebased this back onto the head of master. Probably going to end up doing this a lot, as there are too many half-features we need to get the whole thing working.....

leezer3 avatar Sep 13 '21 09:09 leezer3

msts03

Took a little more bashing, but we can now load a MSTS consist into the main game. Nothing really works (yet), so no physics, controls etc. but if nothing else we could just load a default set of acceleration curves.

Large detailed consists are rather slower than I'd like though, although this is poly-count related as opposed to anything else. We still need to find some speedups in the GL3 renderer.

Further Thoughts:

  • Everything not in the Train.MsTs plugin probably wants picking into master (again), as otherwise this will end up getting out of sync. Probably needs doing repeatedly every time something is fixed.....
  • No acceleration curves in MSTS as such. All it's got is stuff like max power numbers. Divide these by notches as a first step?
  • Need a percentage based power / brake controller. Been on the list for a while :/
  • Need to deal with the keyframe animations in MSTS stuff. Should be easier with the new renderer.

leezer3 avatar Sep 18 '21 12:09 leezer3

A little more work done.

Cabviews now load, but need a lot of components integrating. Camera restriction also appears to be broken.

If wheelspin is disabled, we can actually move our trains. No sound, brakes or power notch simulation at the minute mind, so not exactly useful. Need to also consider refactoring the acceleration curves a bit. Also highlights the fact that wheels don't rotate :/ Need to investigate that properly- I believe that an animation frame for wheels pulls out the wheel radii from the engine properties, and presumably twiddles via speed and this. Would wheel radii be useful for animated files?!

leezer3 avatar Nov 16 '21 21:11 leezer3

Animation changes really want pulling to master when completed & working- This is a common method of doing things.

Haven't tested performance yet, perhaps this would be better in shader when completed?!

Unsure how complete the rest of this is at the minute....

leezer3 avatar Dec 14 '21 01:12 leezer3

API changes pulled out and merged into master, just to try and keep things in better sync.

leezer3 avatar Jan 18 '22 13:01 leezer3

This branch will now load the new hierarchy objects. All complex parts appear to be where they should in a static object, which is encouraging.....

However, it doesn't get them into train exteriors, as the CarSection is tied to the current animated object. Still fiddling, heavy WIP.

leezer3 avatar Jan 18 '22 13:01 leezer3