General Question Modifying state of running sim

DraigLlofrudd

New member
Joined
Nov 27, 2018
Messages
1
Reaction score
0
Points
1
Hey all,

I've been dabbling in orbiter on and off for a few years now (so I know some basics, but many other things I don't know).

Recently a project came up where I am thinking of using Orbiter as a basis for a physical simulator. I am having difficulty finding exhaustive explanation on Orbiter's capabilities when it comes to changing an Ongoing scenario (e.g., when a contingency such as a malfunctioning thruster is meant to take place).

Basically, I am looking for a way to modify states of any vessels while the simulation is running.

What would be the best way to achieve this in orbiter? Presumably a mod/extension that changes things using the Orbiter API?
 

Thymo

I like breaking things
Addon Developer
Joined
Jun 26, 2016
Messages
120
Reaction score
148
Points
58
Website
nassp.space
That totally depends on the vessel you're trying to use. Orbiter has no API to modify state or failures within vessels as the way these are implemented can vary wildly (if implemented at all). I can only speak for NASSP in detail and I can tell you we do not specifically expose a stable API for these kind of things. You can modify some things from an MFD or other vessel but these are all internal interfaces and thus undocumented. You could totally modify the code to expose the things you need but it would require intricate knowledge of NASSPs codebase. If that's something you want to do we'd love to point you in the right direction and give some tips, but that would be specific to NASSP only.
 

n72.75

Move slow and try not to break too much.
Orbiter Contributor
Addon Developer
Tutorial Publisher
Donator
Joined
Mar 21, 2008
Messages
2,687
Reaction score
1,337
Points
128
Location
Saco, ME
Website
mwhume.space
Preferred Pronouns
he/him
A good start would be reading the API reference.

Modifying the state of any vessel in Orbiter is probably not feasible. However, implimenting your own vessel(s) and modifying their states has nearly limitles possibilities.
 

jedidia

shoemaker without legs
Addon Developer
Joined
Mar 19, 2008
Messages
10,842
Reaction score
2,105
Points
203
Location
between the planets
Basically, I am looking for a way to modify states of any vessels while the simulation is running.
Unsurprisingly, Orbiter vessels are polymorphic. Orbiter provides a base class that integrates the vessel into the simulation, and provides the parameters and api calls neccessary for that. On top of that people implement extended functionality specific to their vessels in a derived class.

As such, what you can modify in a vessel state at runtime depends to the knowledge you can get about the other vessel at runtime. You can always know the base implementation (though there's different versions that provide different capability, but you can know the version you're dealing with), and manipulate any parameters it provides (in fact, the specific vessel implementation is using the exact same API to manage its simulation state. There's no protected API to the VESSEL class, it's all public).

As a general rule of thumb, what happens with the vessel in the simulation is handled by the base class and the orbiter core, what happens inside a vessel is implemented by a derived class. There's some borderline cases like propellant consumption, CoG shifts, attachment points, dockports and stuff, which are handled by the base class, but things like damage, failure simulation, hull-heating, complex systems simulation, explosions and so on are all up to the implementation.

If you want to manipulate states that are specific to a certain add-on implementation, the derived class has to provide an API for that, and you need to know it. In other words, as long as you can get the header files and a lib of the add-on into your project, and the class provides a public API to manipulate its state, you're good.
For 3rd-party add-ons, this is usually not the case. You can always get the needed knowledge if the project is open source, which it isn't always, but whether the thing is designed to be manipulated by a third party is an altogether different question.

When you implement a vessel yourself, you can obviously design it for whatever degree of external manipulation you want/need.
 
Top