API Question Custom module and staging

bitblit

New member
Joined
May 17, 2009
Messages
10
Reaction score
0
Points
0
I have a very basic vehicle module compiled and executing. Can anybody recommend a tutorial that covers writing code for a multistage vehicle? I'm pretty good writing C++, but am still having a hard time learning the Orbiter API and object model. Either I'm not understanding all of the API, or there are multiple ways to accomplish the same task. For example, is it better to build each stage as a separate module and class, that somehow attaches to the next upper stage? Or, is it better to model the entire vehicle with each stage a separate group of meshes placed next to each other, switch primary propellant to the next stage, animate the mesh drifting away, then delete the mesh?

Even better, does anybody have well documented sample code of a simple multistaged vehicle?
 
What mesh program are you using? Make a separate class for each stage and when you are done you edit the position of the stage in the ini. file to be placed upon whichever stage you want.
 
I didn't create the meshes. I got them from somebody else. I'm just the coder. That does answer my question though. So it is better to make them each a separate class? Can you tell me which API calls I should study up on? What is the best way to connect them? Connect them like docked vehicles? Do I need to shift the center of gravity every time it stages, or is the Orbiter engine smart enough to apply the physics to all connected pieces? Is it my responsibility to send user input to the active stage(s)?

---------- Post added at 03:04 AM ---------- Previous post was at 03:00 AM ----------

Also, what ini files? All I know about or cfg, msh, and dds. Are you referring to just implementing my own ini for configuration, using another dll in conjunction with mine, or is there something in Orbiter that I'm missing.
 
An ini is used with multistage.dll. MJR seems to think that is what you want to use. From what I can tell, you want to make your own dll(s), and will not be using multistage.dll.
 
There are a number of ways you can accomplish your goal. How I would do it is create one vessel module to handle the vehicle in the simulation. Then use simple configuration file based vessels to handle each stage after it has been jettisoned.

Atlantis for instance simply loads the SRB meshes in the proper location relative to the center of the Atlantis mesh, and creates the SRB thrusters/visual effects accordingly. When the boosters are jettisoned, srb meshes are removed from Atlantis' mesh, and two new vessels are created in place of the SRBs to simulate the separation.

As for the Orbiter API, it is divided in several parts. There is the MFD API, and a Vessel API. You will generally be using one of the two. Then there are the general oapi calls that can be used from within either context. Check out the vessel API header file to see the available function calls, then look them up inside the Orbiter API reference.
 
Quick_Nick was correct. Thanks for the information everybody. I'm quickly learning the API.
 
Back
Top