leezer3 / OpenBVE

OpenBVE- A free train simulator
http://www.openbve-project.net
269 stars 52 forks source link

[Suggestion] .x model selectable options support #1033

Open hotdamndel opened 1 month ago

hotdamndel commented 1 month ago

This is a feature found in .x models and used by, for example, Railsim (a Japanese railway layout simulator). In Railsim example, this allows defining various model parts that can be enabled/disabled or swapped (for things like implementing train variety coming from small changes during production or car numbers) much more easily than conventionally via [object] and StateFunction in .animated. I assume this can be considerably less performance-costly as well. No particular examples here, but any Railsim model with a good functionality can demonstrate that.

leezer3 commented 1 month ago

It isn't really going to be any different in terms of pure speed, that's just a function of polys + movement of any description.

X files (and for that matter most standard animation formats) use matrix keyframes (generally chained and interpolation between them. These are somewhere on a massive list of things I've not got as far as doing, as it requires a bunch of redesign work to the internals of the animated format....

hotdamndel commented 1 month ago

This isn't about animation, more like state changes from the option provided in the file, so no interpolation needed. And these don't really need to be animated (mostly just for Railsim model options support, .x models currently just load with all the options enabled at the same time and texture selections/shifts reverted to default with no way to change that via .animated). Railsim implementation of these features is really clever and simple, I'd like to see this work in Openbve

leezer3 commented 1 month ago

My point is that these changes are controlled by the animation keyframes. Basically, the X options just set a set of keyframes to be shown.

In order to get that working properly, we need proper support for the full keyframe and matrix chain support.

ginga81 commented 1 month ago

I'm sorry to go off topic, but I hope that we analyzed Railsim's GPL code and made it easier than BVEC_ATS and animated's functions to link object bones to reproduce the driving wheels of a locomotive, and to animate the rise and fall of a pantograph.