Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: MSTS consist / vehicle parser #684

Open
wants to merge 14 commits into
base: master
Choose a base branch
from
Open

WIP: MSTS consist / vehicle parser #684

wants to merge 14 commits into from

Conversation

leezer3
Copy link
Owner

@leezer3 leezer3 commented Aug 9, 2021

Heavy work in progress here, highly likely to explode unexpectedly.....
n.b. Contains the changes from #167 although not hooked up to anything yet, should work when this is done.

This will load (some) MSTS consists to a working visual train.
Not even thought about physics and stuff yet.
The new renderer is absolutely required for these to get a sensible framerate, and even this is still a little slow. We need to detect somehow if the proportion of texture in use for any given face uses alpha.

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
Copy link
Owner Author

leezer3 commented Sep 13, 2021

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
Copy link
Owner Author

leezer3 commented Sep 18, 2021

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
Copy link
Owner Author

leezer3 commented Nov 16, 2021

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
Copy link
Owner Author

leezer3 commented Dec 14, 2021

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
Copy link
Owner Author

leezer3 commented Jan 18, 2022

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

@leezer3
Copy link
Owner Author

leezer3 commented Jan 18, 2022

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.

@ginga81
Copy link
Contributor

ginga81 commented Feb 22, 2025

If this were to create, and I were able to create my own MSTS object, would it be possible to move the rod of a SL like this?
Japanese SLs have rods as this Steambox bigboy, but sorry, I don't think BVEC_ATS can animate reverser gears or other rods to this extent.

bigboy.mp4

@leezer3
Copy link
Owner Author

leezer3 commented Feb 22, 2025

Abolutely.
The whole point is to allow any hierarchy of parts to animate as a whole, and it's basically the standard animation format for any modern game.

If we add an appropriate controller (for valve gear, this would primarily be the wheel radius), then the animations actually work correctly in the current build.

(It'd be reasonably simple to add the wheel radii to train.xml so that a MSTS shape had working wheel animations, but the issue is that wheels can be attached to parent objects and stuff, which isn't yet really there)


Unfortunately though, we don't yet have many of the actual controllers implemented in-game.
It's somewhat of what we'd call a chicken and egg problem: To actually implement these controllers in any useful way, we need to implement the 'missing' subsystems.

MSTS has a reasonably readable textual format, and I'm basically currently using it to start to implement these missing systems, as a known working prototype.
Nothing very useful is likely to come out of this in the short and probably medium terms, but it's all interelated with moving away from being a simple liner simulator to something 'better....

leezer3 added a commit that referenced this pull request Feb 24, 2025
@leezer3 leezer3 force-pushed the MsTsTrain branch 3 times, most recently from c8354a0 to b3312df Compare March 10, 2025 11:29
@leezer3 leezer3 force-pushed the MsTsTrain branch 4 times, most recently from ac8b68d to d701478 Compare March 17, 2025 17:21
@leezer3 leezer3 force-pushed the MsTsTrain branch 3 times, most recently from 7dc4b0b to 9eac9fb Compare March 19, 2025 12:42
leezer3 added 14 commits March 19, 2025 12:45
Only does RPM and fuel usage for the minute, no physics effects
Change: Improve MSTS vehicle search tree

Change: Pull out brake system enums, implement flipped cars

Change: Work on brake systems in MSTS parser

Change: Work on cabviews in MSTS parser

Change: Internal work to get closer to main program loading
Change: More internal work

Change: Get in-game loading working right
Change: Get the MSTS train parser loading a description

Change: Cleaning...

Change: Work on cabview loading

Change: Work on getting the thing moving

Change: Partial implementation of some MSTS bits
Rebase fixing
Minor fixes for missing properties

Start wheel animation loading

Link unlinked animations to base wheels

Camera restriction should be turned on for CVF

Minor CVF bits

Don't throw exceptions in CVF

Start implementing SMS parser

Separate the handle files into subdirectories
WIP

Fix allowed empty blocks in MSTS parser
Start parsing / validating some more SMS bits

More work on SMS parser
Handle incorrect number of triggers in block

More WIP

Improve wagon type parsing

Add some missing cab component types

More WIP

Validate H/W/L of read wagon

More WIP

Change acceleration calculations to account for uncoupling possibility

Handle current method of MSTS acceleration curve output

Parse basic handle sounds

Alter deceleration curves

Use averages pressure distribution for the minute

Start basic implementation of some more bits

Hook in MSTS wipers

Only cab control works for the minute

Improve wheel radius reading from ENG file

Change: Generate default rotations for MSTS wheels if not specified

MSTS does this by default (yuck)

New: Implement moving bogies for MSTS models
Only panel simulation for headlights at the minute, need to think about lighting cones and stuff....
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants