plane icon Welcome to Microsoft Flight Simulator’s SDK Q&A Platform!

You have questions regarding the SDK? DevMode Tools? SimConnect? You would like to submit an idea for future improvements, seek help or exchange knowledge? You’re in the right place.


Please take a moment to read the platform’s guidelines before you get started!


question

ecardona5 avatar image
ecardona5 asked sonicviz commented

Best way to code a mod/plugin?

Hi, I'm new at the SDK and I was wondering what is the best way/route to create a plugin/mod that handles the aircraft behavior. I would like to start with something basic, like starting behavior, engine flood for too much priming and such things.

I'm still reading the SDK Docs but I'm a bit confused. I've seen other projects code and I've seen that some uses C++ and/or Rust for creating WASM modules (FBW). But I've also seen the ModelBehaviorDefs XML stuff, which is very confusing to me TBH.

Also, if I have some behaviour code for an Asobo base aircraft, do I need to copy the whole model into another version of the aircraft? Is there any way to attach the code to a existing aircraft?

simconnectdocumentationhelpwasmc++
10 |10000

Up to 5 attachments (including images) can be used with a maximum of 4.8 MiB each and 23.8 MiB total.

FlyingRaccoon avatar image
FlyingRaccoon answered FlyingRaccoon edited

Hello and welcome @ecardona5

Regarding Model Behaviors, check the documentation here: Model Behaviors (flightsimulator.com)
You will need xml behaviors to configure interactions and animations
The advantage of using Model Behavior xml is that you have templates to start from. You can quickly implement basic logic using simvars and local vars. The drawback is that when template don't cover what you want to do, you'll have to create your own component and it can be a bit tricky sometimes.

If you want to implement some more advanced logic, WASM can be handy: WebAssembly (flightsimulator.com)
You'll be able to write and read simvars, local vars and send events as well using the GaugeAPI. You'll be able to render gauges using GDI+ or NanoVG.

Depending on what you want to do, you might need both.

Regarding your last question, although I'm not sure if you are talking about XML or WASM, yes most of the code can be applicable to other aircraft. Just make sure the file and node names are matching the new model in the case of XML. Obviously, some code is context dependant and jet engine logic will fail if used on a piston aircraft for example.

I hope this helps.
There are plenty of aircraft creators here that will have good advice as well I'm sure.
Enjoy your development and let us know if you encounter any issue.

Regards,
Sylvain

10 |10000

Up to 5 attachments (including images) can be used with a maximum of 4.8 MiB each and 23.8 MiB total.

sonicviz avatar image
sonicviz answered sonicviz commented

Just getting started on this myself, and was going to ask the same question.

Is there a starter project for writing a complete standalone WASM custom flight model that you can hook up to the existing aircraft sample project (for example)?

I can't find a clear concise pathway to get started on doing this, and was wondering if I missed it somewhere?


Thanks!

Paul

2 comments
10 |10000

Up to 5 attachments (including images) can be used with a maximum of 4.8 MiB each and 23.8 MiB total.

davux3 avatar image davux3 commented ·

Somebody made this: https://github.com/tml1024/flying-brick


The WT CJ4 FADEC module used to be around (I can't seem to find it right now), and was also a good learning resource. This did everything except setting the flight model physics, but that part is actually the same data flow anyway.

0 Likes 0 ·
sonicviz avatar image sonicviz davux3 commented ·

Thanks. I saw the brick project.

Will have a look for WT CJ4 FADEC.

0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 5 attachments (including images) can be used with a maximum of 19.1 MiB each and 23.8 MiB total.