[REQUEST] Mod and save manager for X4

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

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

Post Reply
bogate
Posts: 81
Joined: Sat, 29. Dec 18, 23:08
x4

[REQUEST] Mod and save manager for X4

Post by bogate » Mon, 7. Jun 21, 12:21

Hello, I wanted to request if someone could make a simple GUI to select a mod preset before game startup based on findings in another post.

kmunoz wrote:
Mon, 7. Jun 21, 00:01
If it is stored in a readable config file, some enterprising modder could make a command line batch file of some sort that would let you insert/replace mod sets into that config file.

Edit: it's in Documents/Egosoft/X4/<profileID?>/content.xml

Completely human readable. A game launcher could read it, modify it based on a selection from a list of presets (or save a preset based on the current state), then save the file and launch the game. I'm fairly sure that's exactly what Paradox does with their launcher. No reason X4 couldn't have something similar (either made by EGO or put together by a modder).
Is it possible to make some kind of GUI to read that file, select which mods should be on/off, make and save mod presets for fast selection later? Some way to start the game from the GUI would be appreciated. Being able to start the GUI from steam by clicking play on X4 would be extra bonus points

More bonus points if it also automatically changes the save folder under "Documents/Egososft/X4/<profileID>/" to match the save folder for that mod preset. (maybe just a folder save_modpreset1 for each preset and just renaming the chosen one to "save" before starting the game?, would need to check what mod preset the "save" folder belongs to)

kmunoz
Posts: 444
Joined: Sun, 25. Feb 07, 19:59
x4

Re: [REQUEST] Mod and save manager for X4

Post by kmunoz » Mon, 7. Jun 21, 19:51

Maybe modders already know this, but if not, here's a very tiny leg up on how content.xml works based on my accidental investigations, quoted from my reply to the other thread regarding the request:
The way content.xml works currently, if you remove an extension from the folder it DOES NOT remove that extension from content.xml. (This is not a problem normally, but it might get weird if the mod launcher reads an extension in context.xml that you don't actually have installed anymore - you might expect it to be there, but it's not. The game still runs just fine, it's just that the extension is missing.)

In game, X4 is doing some comparison between the content.xml file and the extensions folder. It's reading the on/off state from the xml file but reading the exists/doesn't exist state from the extensions folder. So if you remove an extension from the folder it doesn't show up in the game's list, either as on or off, but if you then put it back it will restore whatever on/off state was in effect the last time you had it - because it's still in content.xml.
Let's Play Poorly! - Suboptimal X4 Playthroughs

User avatar
euclid
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 13289
Joined: Sun, 15. Feb 04, 20:12
x4

Re: [REQUEST] Mod and save manager for X4

Post by euclid » Mon, 7. Jun 21, 22:59

It should be possible but I'd like to mention two things to remember if someone attempts to code such an UI:
  • The saved game folder cannot be changed and hence saved games have to be moved to another folder (say "moded saves").
  • Mods usually leave traces in a saved game and hence removing the mod may not be sufficient to provide a 'clean' saved game.
Cheers Euclid
"In any special doctrine of nature there can be only as much proper science as there is mathematics therein.”
- Immanuel Kant (1724-1804), Metaphysical Foundations of the Science of Nature, 4:470, 1786

Post Reply

Return to “X4: Foundations - Scripts and Modding”