Sergeant Knight at Arms
Original Message Contents said:So, a few days ago I suddenlyTM got interested in the Module System compiler. Again.
Hopefully, the results speak for themselves:
So far it's very similar to swysdk, except it's pure Python. So it's somewhat slower than swysdk binary, but roughly 5 times faster than Native compiler.
As can be seen on screenshot, it supports object-oriented style for variable and entity naming, while retaining full compatibility with Native-style reference and variable names.
It also supports dynamic expression calculation. So you can easily write (assign, reg0, mesh.banner_a1 + 2) in your code and leave it for compiler to figure out what the resulting value will be. It is planned (and 90% of the underlying framework is already done) to also add support for dynamic runtime expressions - i.e. generating code dynamically from mathematical expressions using Module System variables, registers and slots. Those who remember WORMS will know what I'm speaking about, those who don't can find it through the links in my sig.
Compiler tries as best as possible to generate the same output as the Native compiler - up to the last space. There are a few exceptions, however.
First, it does not include entity tags into entity references. As far as I can tell, they are a legacy feature from Mount&Blade and Warband ignores them entirely. I may be wrong here, but that's what testing is for.
Second, when there are records with a duplicate reference name, Native compiler will match the name with the first occurence, my code will match with the last.
Third, I have removed several limitations that were imposed by compiler but do not actually exist in the game itself. So now it's perfectly possible to have item weight as much as necessary with any arbitrary precision (Warband will only display weight up to 0.1 unit). It is also possible to have huge quantity values for ammo and food items.
As a side note, Native compiler has a minor packing bug, where values for swing damage will inevitably overflow into item HPs. It's not important, since there are no items in the game for which both swing damage and health would matter, but may cause problems if a careless modder makes an item entry with superfluous damage definitions.
Oh, and the compiler has no use for ID_* and process_ files. Everything needed to compile the module fits into just two scripts. Of course, module files need some preparation for this to be working. In theory, compiler should work with raw Native module system without any modifications to the files whatsoever, but that theory has not yet been confirmed by practise, so there. Still, it's something that can and most likely will be achieved.
Planning to release first alpha version for public scrutiny once I get rid of one minor mistake in conversation.txt generation and finalize the export of quick strings and dialog states.