Question about Extensions/Mods and XMLPatch

The place to discuss scripting and game modifications for X4: Foundations.

Moderators: Moderators for English X Forum, Scripting / Modding Moderators

Post Reply
Urgestein
Posts: 7
Joined: Thu, 2. Jun 22, 09:47
x4

Question about Extensions/Mods and XMLPatch

Post by Urgestein » Mon, 11. Jul 22, 19:16

Hello,

now, that I (mostly) understand how the different ships are defined, I am trying to get my head around the extensions/mods and xml patch...

I know, the "xml-files" are packed into the "*.dat"-files. At startup these are "unpacked" and read. At first the game reads the "original files" (located in the base game folder).
Then it reads the files from the various mods/extensions and applys the xml patch logic ("diff", "add/replace/remove"). Btw. in wich order are the mods/extension xml files read?

So, if an extension or mod is "changing" a file, the extension has to serve a "diff" tag and one or more "add/replace/remove" tags.
For my learning curve I am looking at two different extensions: "ego_dlc_pirate" (because it's from egosoft) and "vro" (because it's a very big mod and I think the author "knows what he is doing", and I use it in my own game^^).

But, if I look into the "index/components.xml" of the "ego_dlc_pirate", there is no "diff"-tag, but just more "entries"!? The "index/components.xml" of the "vro" mod on the other hand contains the "diff" and "add" nodes...
Contrary to this, in the "t/0001-l049.xml" of the "vro" mod, there is no "diff" and "add" nodes, but there are language ids overridden by vro! (ex. "{20105,5084}" is already defined in the base game, but overridden by vro).

Is someone able and willing to explain, how these overridings are handled by the game?

Thanks in advance
Urgestein

sprIder
Posts: 92
Joined: Sat, 3. Jul 10, 23:23
x4

Re: Question about Extensions/Mods and XMLPatch

Post by sprIder » Tue, 12. Jul 22, 16:59

That's funny. I always "diff" in index/components but "not diff" in index/macros. I saw it somewhere, when i began with modding and adopted it.
But since there is an official Egosoft Wiki and Rebirth is not that far from X4 just look here: https://www.egosoft.com:8444/confluence ... e+2%3A+XML.

Summarized: Both are apparently possible if you just add new stuff.
But in the wares.xml I never saw it that someone does it without "diff". Even in the Egosoft dlcs.
I even think I read that in the files in the libraries folder "diff" is mandatory. But I am not sure about that.

For the other stuff: Important is, what you define in your "content.xml" with the dependency(s).
Everything that is specified as dependent is read by the game first, then your mod. And if your mod says that it also changes location xy, then the game takes what is in your mod.
That is, the order in which the mods are loaded is crucial.
Therefore, t-files can also be overwritten.
But does not work everywhere (afaik), see my "possibly heard" regarding libraries-files.

Urgestein
Posts: 7
Joined: Thu, 2. Jun 22, 09:47
x4

Re: Question about Extensions/Mods and XMLPatch

Post by Urgestein » Tue, 12. Jul 22, 20:47

Thanks sprIder for now.

Then, I'll try to incorporate these logics into my code. I'm not trying to build a new mod, but a ship designer.

In my private game I also use the VRO mod, so I try to incorporate these ships into my ship designer...

Perhaps someone else is able to shed some more light on this topic?

SirNukes
Posts: 546
Joined: Sat, 31. Mar 07, 23:44
x4

Re: Question about Extensions/Mods and XMLPatch

Post by SirNukes » Wed, 13. Jul 22, 22:30

Non-diff style will just add the entries under root. (Iirc it might prepend the new entries from mods, but that should only matter if a followup diff is trying to use an index in its xpath.)

The egosoft dlcs will diff the wares.xml file because they need to do a diff patch on one of the existing entries (production method), and they wanted to keep all of the wares changes in one file, so the new wares must then be diff'd in with Adds. They don't diff for something like people.xml.

Post Reply

Return to “X4: Foundations - Scripts and Modding”