Did Asobo really write tons of XML like this manually?

The animations (and other stuff?) in the model behaviour XML files call into so-called templates, defined in various files in fs-base-aircraft-common\ModelBehaviorDefs. Looking into these, one is, how should I put it, amazed and filled with horror. Such complexity to express things that could be expressed much less verbosely in some normal programming language.

I mean, things like the templates, an excerpt:

	<Condition NotEmpty="AFTERBURNER_GATE_POS_16K">
		<DRAG_MIN_VALUE>(A:THROTTLE LOWER LIMIT, position 16k) (O:XMLVAR_MIN_Limit) max</DRAG_MIN_VALUE>
		<DRAG_MAX_VALUE>16384 (O:XMLVAR_MAX_Limit) min</DRAG_MAX_VALUE>
		<PROCESS_LIMITS>
			#PROCESS_LIMITS#
			(A:GENERAL ENG THROTTLE LEVER POSITION:#ID#, position 16k) #AFTERBURNER_GATE_POS_16K# - abs #GATE_MARGIN# &gt; if{
				(A:GENERAL ENG THROTTLE LEVER POSITION:#ID#, position 16k) #AFTERBURNER_GATE_POS_16K# &gt; if{
					#AFTERBURNER_GATE_POS_16K# (&gt;O:XMLVAR_MIN_Limit)
				} els{
					#AFTERBURNER_GATE_POS_16K# (&gt;O:XMLVAR_MAX_Limit)
				}
			}
		</PROCESS_LIMITS>
		<RESET_LIMITS>
			(A:THROTTLE LOWER LIMIT, position 16k) (&gt;O:XMLVAR_MIN_Limit)
			16384 (&gt;O:XMLVAR_MAX_Limit)
			0 (&gt;O:XMLVAR_Limits_Needs_Recalculation)
		</RESET_LIMITS>
	</Condition>

A strange mixture of what clearly is an expression syntax in XML and a postfix language inside some of the elements. Plus, this being XML, to add insult to injury, that postfix language then has “normal” operators like > , which has to be written as &gt; because XML. Elegant, not.

Is this the result of a translation from some higher-level more elegant and less verbose language? Why is the detour through XML needed? Surely this will upon loading into the simulator be converted again into some more efficient internal structures. Possibly even JITting is involved.

The old saying Whoever does not understand LISP, is doomed to reinvent it comes to mind, but I digress. This being a Microsoft product, one would have expected C# to be used, a lot.

1 Like

And more XML files you have and more time the game needs to starts. :smiley:

1 Like

It like ćŠ‚æžœæ”·æ‹”é«˜ćșŠć€§äșŽ0ïŒŒćˆ™ć‘ç”ŸćŽ©æșƒ was a bit of FSX they could not understand, they made it

FSXtoMSFS(ćŠ‚æžœæ”·æ‹”é«˜ćșŠć€§äșŽ0ïŒŒćˆ™ć‘ç”ŸćŽ©æșƒ)

(I’ll leave you to Google what ćŠ‚æžœæ”·æ‹”é«˜ćșŠć€§äșŽ0ïŒŒćˆ™ć‘ç”ŸćŽ©æșƒ means )

or click on the little Globe !!

1 Like

It’s called RNP (reverse polish notation) and seems to be a compiler friendly thing

Compiler stack friendly : YES
Human readability : NO !!

2 Likes

Yes, I know, but the most important thing with what essentially is source code is that it is to be read by humans, multiple times, not only written once by a human and only read by a compiler or other software after that. We have come a long way since it was a good idea to base some programming language syntax on what is “compiler friendly”.

You don’t have to tell me that, it took me 3 days to figure out how to make simple modelbehavior code with this stupid syntax.

I went through a few languages etc already in my life but needed 3 days to do a simple if else with AND and OR combined


My brain seems to work in forward notation only hehe

1 Like

Yeah. I have dabbled a little bit with generating Postscript some decades ago so postfix languages aren’t completely strange to me.

(And way back in the day, the Forth programming language was allegedly popular in some use cases. And Forth was also used, of all places, in the command line interface to OpenFirmware, which is (was) used at least on Sun computers as what PC people calls the “BIOS”. And Wikipedia tells me that it is also used on IBM Power machines.)

Still I question the sanity of this development decision.

K.I.S.S. technology should always be used (and documented) or grab your briefcase and head for the door.

The corporate I.T. departments that have programmers in them (including management), that purposefully write code in cryptic fashion is just one thing: job security for them. And, the CEO’s know and understand this (and don’t like it).

I understand that in some company where you develope for the company inhouse, or something.

But we are the ones who have to work with that too. Without 3rdparty devs msfs wouldn’t be much. So imo there should really be a good reason to implement some weirdnes like this.

Compiler friendly isn’t enough for me, on first sight at least. Maybe i don’t have enough oversight to see why

2 Likes

One possibility is that this XML format is just a stopgap measure, and that the XML is generated from some high-level language, and what they actually want to do is to to compile that to .NET bytecode, or perhaps more likely WebAssembly bytecode. But then there were some problems with that and then managerial decisions to release the produce intervened and they had to quickly come up with something, and hey, XML is great, right?

But even if that is true, now they are then stuck with supporting this XML forever, as 3rd-party add-ons already use it. (That doesn’t mean they can’t eventually do what they perhaps originally wanted, too, sure. It’s a bit sad to see “backward compatibility” and “historical reasons” evolving in front of one’s very eyes.)

1 Like

I mean, wouldn’t it be really cool to describe your aircraft’s behaviour in some actual programming language? Like C#, Javascript, Java, or even C++. Some that can be directly compiled to either .NET or WebAssemly bytecode. Or is there a large number of 3rd-party developers who wouldn’t want to touch DIFFICULT PROGRAMMING (sarcasm) but are perfectly fine with writing XML manually? (But sure, when I say write I mean copy-paste and modify a bit. But there could-be equally copy-paste-friendly sample source code snippets, too, of course.)

This type of XML config/code goes back to FSX, so I suppose they already had code and tooling that works with it. Why reinvent the wheel as they say.

With the new HTML & JS gauges and WASM modules, they clearly are embracing modern tech when it has a benefit.

While the model behavior templates seem daunting at first, once you get the hang of it, seems to be a perfectly adequate system. There is quite a bit of existing documentation and FS dev forum posts about all of this stuff and much of it is still relevant today.

Here’s a link to the P3D SDK docs and it’s still very useful for MSFS 2020 dev work.

1 Like

RNP

GitHub Repo

1 Like

Ooh! Great minds think alike etc. I was just pondering writing such a tool


Do you know whether the flybywiresim truly open source glTF with Asobo extensions exporter (and importer) is as good as that MSFSToolkit one, which is not really open source style in development even if not proprietary. At least flybywiresim’s seem to follow the upstream Khronos importer/exporter which is great.

Nope, don’t know.

Sounds like COBOL. I know COBOL!

1 Like

@ PacificSet90456

Identification Division
 :wink:

1 Like

Just looking at the raw text I have to think no - they must have a designer or source language for this. It’s way too brittle not to invest in that kind of generator. Asobo are not idiots. They are big mature software company. Any intern can knock out an improvement on this as a source language in a couple of days.

1 Like