[Outdated] Xml Module System Version 0.9 (Updated 06-01-2007)

Users who are viewing this thread

Is it possible to mix the XML system together with the native Module system? I mean, I would like to use this system for my definition of troops, but do my triggers and scripts in Python. Sorry if it has been answered, I could not find it.
 
I think a major problem that we have here and the cause for Hellequin's incomprehension is that the module system provides a low-level way to structure your mod and it ressembles too much what is done with python. I mean low level since the conversion seems pretty straight forward between code and produced text files. (For the coders out there, this is much like C -> assembly.)

IMO, what is needed for extra productivity is the following:

1/ Higher levels of abstraction : These can be achieved by using the tooling that using XML provides. You automatically have a declarative language with processors (XSL). Of course this is might be more complex than python tuples. Using XML will be useful only when you can properly use its tools. Python is an OO language and could also be more adequately used.

2/ Less duplication : There's so much duplication in the current mod codebase, it isn't even funny. The XML editors provide a clean and short way to add a new troop/city. Using XML inheritance can help a lot (this new hero will act by default like the others except for ...). This can also be achieved through Python.

3/ Better structure : It seems to be "obvious" to most that troops should be kept separate from parties and quest. Why is that? If I create a new NPC, I might to have him bundled together with his quests. If I were to add boats, I might have to include scripts, parties, party_templates, etc... Grouping these by functionality would be just as valid as following the output structure. Any tool that can break down these artificial barriers is welcome. Since XML includes inclusion mechanisms, this tools is promising.

I'll be sticking with python for now, but those are little things to remember. Duplicating what does python is not the goal.
 
Scion said:
Is it possible to mix the XML system together with the native Module system? I mean, I would like to use this system for my definition of troops, but do my triggers and scripts in Python. Sorry if it has been answered, I could not find it.
Not really as there are many cross-references and especially the scripts/triggers reference other items by their number. So for example you need to know all the troops in order to reference one particular one. It is "possible" but not really feasible.

svaucher said:
I think a major problem that we have here and the cause for Hellequin's incomprehension is that the module system provides a low-level way to structure your mod and it ressembles too much what is done with python. I mean low level since the conversion seems pretty straight forward between code and produced text files. (For the coders out there, this is much like C -> assembly.)
True, but in fact that was my goal, because having a solid descriptive base is always good. Adding higher abstractions can follow afterwards.

IMO, what is needed for extra productivity is the following:

1/ Higher levels of abstraction : These can be achieved by using the tooling that using XML provides. You automatically have a declarative language with processors (XSL). Of course this is might be more complex than python tuples. Using XML will be useful only when you can properly use its tools. Python is an OO language and could also be more adequately used.
Keep in mind that higher abstractions are fine for people writing them by hand but are way harder to be put into an editor. So, yes, you can code loops creating 20 npcs in 3 lines in python and, yes, it is possible but maybe a bit more complicated to do it in xslt, but both of them are editor unfriendly. The thing is, the resulting xml can be read by a tool, the 20 npcs created by the python code not so easily. You'll need to create python code in your python code to have any chance at all to make it editor friendly.

2/ Less duplication : There's so much duplication in the current mod codebase, it isn't even funny. The XML editors provide a clean and short way to add a new troop/city. Using XML inheritance can help a lot (this new hero will act by default like the others except for ...). This can also be achieved through Python.
In fact, this is possible with a few restrictions already. the following module generates a new troop which simply extends and slightly changes an existing troop:
Code:
<?xml version="1.0"?>
<Module Version="0.4" xmlns="urn:mount-and-blade:xml-module-system:0.4">
	<Name>My Item Contribution</Name>
	<Version>0.2</Version>
	<Definitions>
		<Troop Id="elite_swadian_skirmisher" BaseId="swadian_skirmisher">
			<Name>Elite Swadian Skirmisher</Name>
			<Level>20</Level>
			<WeaponProficiencies>
				<WeaponProficiency Name="default">120</WeaponProficiency>
			</WeaponProficiencies>
		</Troop>
		<Troop Id="swadian_skirmisher" Mode="modify">
			<CanUpgradeTo>
				<Troop RefId="swadian_crossbowman"/>
				<Troop RefId="elite_swadian_skirmisher"/>
			</CanUpgradeTo>
		</Troop>
	</Definitions>
</Module>
The result is a new troop, put into the right category (say, it is placed after the last "regular" troop and the regular category is expanded by one) and being added into the upgrade tree. Let me add here that i tried it, but it required small tweaking to get a complete flawless result. It'll be included in the next version. The main restriction currently is that the inheritance only works for the first depth.

3/ Better structure : It seems to be "obvious" to most that troops should be kept separate from parties and quest. Why is that? If I create a new NPC, I might to have him bundled together with his quests. If I were to add boats, I might have to include scripts, parties, party_templates, etc... Grouping these by functionality would be just as valid as following the output structure. Any tool that can break down these artificial barriers is welcome. Since XML includes inclusion mechanisms, this tools is promising.
It's already possible as stated multiple times.

I'll be sticking with python for now, but those are little things to remember. Duplicating what does python is not the goal.
Well, in fact, it was the first goal. But of course it's not the only goal and it already offers more features in a tool-friendly manner. "More" being relative as python, being a programming language, has the greatest possible flexibility, if and only if you understand it. And understanding python is hard for a tool :wink:
 
What are the XML definitions for various 'things' in the game.  Please provide examples of all the types of things we can mod in and I'll try using your system for my new mod Dogs of War.

Also, do you have an XML file that duplicates Native?  That would help people to 'convert' over to your system I think.

I like this idea, I hope someone can build a GUI editor based on your XML files.

 
To make my last question clear I should point this out:

Now that you have your own single-file module you can add any definition like items, dialogs, troops and so on. As we want to add an item in this tutorial you will want to have a look at the items.xml in the native module. There you can copy/paste the basic structure of any item to your new module and modify it to your needs.

Where is the items.xml for the native module? I cannot find it..... probably doing something stupid on my end.

Thanks.
 
sirgrigor said:
What are the XML definitions for various 'things' in the game.  Please provide examples of all the types of things we can mod in and I'll try using your system for my new mod Dogs of War.
Well, the same as you can mod with the official module system, to be exact: conversations, faction, menus, items, map icons, mission-templates, particle systems, parties, party-templates, quests, scene props, scenes, scripts, sounds, triggers and troops. The map and art data like meshes, textures and sound are resources not directly handled in the module systems (official and this one).

Also, do you have an XML file that duplicates Native?  That would help people to 'convert' over to your system I think.
Of course, just take a look at the 'native' folder in the 'Modules' folder of my package. The module is split into multiple files resembling the original structure of the module. This was only done because it makes it easier to convert the original module into xml structure, as i said before, you can mix all definitions in the xml files.
 
This is such a great Idea, XML is so much easier for me to read than the python strings (of course, so of you all are used to python)
as a matter of fact I'm going to check into what can be done to integrate this into some kinda GUI based editor.

Great job Codewright!!!
 
codewright said:
V0.6 is out, mostly bug fixing this time.

As i said before i am strongly considering replacing the xml representation of code with a textual one. So what do you think: is this one
Code:
store_encountered_party #1
store_encountered_party2 #2
try_begin
	lt #2,0
	try_begin
		ge #1,towns_begin
		lt #1,towns_end
		jump_to_menu menu:town
	else_try
                ...

Any chance you could make it YAML compatible?

This thread wasn't dead, it just needed a bump :wink:
 
aGorilla said:
codewright said:
V0.6 is out, mostly bug fixing this time.

As i said before i am strongly considering replacing the xml representation of code with a textual one. So what do you think: is this one
Code:
store_encountered_party #1
store_encountered_party2 #2
try_begin
	lt #2,0
	try_begin
		ge #1,towns_begin
		lt #1,towns_end
		jump_to_menu menu:town
	else_try
                ...

Any chance you could make it YAML compatible?

This thread wasn't dead, it just needed a bump :wink:

Not really as code really isn't something to be represented in xml or anything similar. At least it ends up looking ugly or being not as flexible as it should be. Ok, the MB scripting language isn't really high level, but still it doesn't fit into xml nicely.
 
Very very thanks for making this editor because i have a problem (maybe in my brain :smile:) and cant use python :oops:

I tried a little mod with your editor. (I am telling what I did because there is a problem and I will ask 'why' at the end.) I copied all content of XmlModuleSystem-0.9\Modules\native and put these xml files into a new folder in XmlModuleSystem-0.9\Modules\ Then I edited some of xml files using notepad. I edited troops, parties, party_templates, factions and tried to add a new faction, 3 new troops of this faction and a spawn point for parties of this faction. Then I double clicked XmlModuleSystem.exe, selected my new module file (which I copied and edited from native files), I clicked export then it showed an error:
errrpz1.jpg

When I only select native or native with skeleton-simple.xml, it exports normaly. What did I do wrong?

Edit: If I click continue, the bar that shows the percentage freezes and I have to close the program.
 
ottomanski said:
Very very thanks for making this editor because i have a problem (maybe in my brain :smile:) and cant use python :oops:

I tried a little mod with your editor. (I am telling what I did because there is a problem and I will ask 'why' at the end.) I copied all content of XmlModuleSystem-0.9\Modules\native and put these xml files into a new folder in XmlModuleSystem-0.9\Modules\ Then I edited some of xml files using notepad. I edited troops, parties, party_templates, factions and tried to add a new faction, 3 new troops of this faction and a spawn point for parties of this faction. Then I double clicked XmlModuleSystem.exe, selected my new module file (which I copied and edited from native files), I clicked export then it showed an error:
errrpz1.jpg

When I only select native or native with skeleton-simple.xml, it exports normaly. What did I do wrong?

Edit: If I click continue, the bar that shows the percentage freezes and I have to close the program.

Well, you must have screwed one of the xml files :wink:.
First have a look at what is written behind "There is an error in XML document ... -->". Most likely this will help you find the error. An easier way of finding such errors may be opening the file in internet explorer, which will give you a few more details. Don't expect too much though.
 
Back
Top Bottom