Jump to content

R&D -- More Modular Mods


Amineri

Recommended Posts

I mentioned this in the Enemy Within Discovery thread, but I think it requires/deserves a topic all of its own.

 

The core idea here is to make installation of mods for XCOM:EW more modular than it was for EU. For example, installing the Long War mod overwrites the existing vanilla XCOM:EU files, requiring un-installing the mod in order to play vanilla (or to play multiplayer).

 

However, Firaxis appears to have given us an opportunity to allow for a mod to be installed without disrupting the vanilla code. The key is that EW now allows either EU or EW to be played.

 

--------------

 

This is done via a launcher. In /XCom-Enemy-Unknown/XEW/Binaries/Win32 is the file XCOMLauncher.exe. This is the file that is launched by Steam after EW is installed. This launcher is the first little app that pops up with two selectable boxes allowing either EU or EW to be played. It appears that all it does is launch either /XCom-Enemy-Unknown/Binaries/Win32/XComGame.exe or /XCom-Enemy-Unknown/XEW/Binaries/Win32/XcomEW.exe.

 

After that each executable references a completely different set of upk files. This includes the script files XComGame.upk and XComStrategyGame.upk as well as all of the map files, art assets, etc. Almost everything is duplicated for EW vs EU.

 

So, what would be needed is an entirely new (and configurable) launcher to take the place of XCOMLauncher.exe. Instead of being hard-coded to launch only 2 executables in the given locations, it would have to be configurable to launch 2 or more. The new launcher would launch either of the 2 vanilla games or launch an executable for a mod.

 

To create a mod this would require essentially duplicating the XEW folder into a new "MyXComModName" folder, then applying all of the mods to the copies of upks in the "MyXComModName" folder. To launch the mod the launcher would start the executable in the "MyXComModName" folder.

 

This would create a bit of disk bloat, as the full XEW folder is ~8 GB. However EW already has some of this bloat, as the full XEW install is now ~18.6 GB compared to EU's original size of ~13.1 GB. Almost all of the XEW's 8 GB is in two folders : 6.7 GB for the upks in CookedPCConsole, and 1.3 GB in the Movies folder.

 

To avoid too much disk-bloating EW has a feature that allows it to reference the movie files in the EU folder. The EU movies take up ~6 GB and EW adds another 1.3 GB of movies. In the EW Movies folder are a bunch of small text file references to the movie files in the EU Movies folder.

 

Ideally the mod wouldn't copy over all of the movie files from EW and could instead reference them from the new location.

 

------------------

 

Here's the steps I envision installing a mod could take:

1) Duplicate the XEW folder contents into a new 'MyXComModName" folder, at the same level as XEW

2) Apply changes to upks, config files and localization files into the 'MyXComModName' folder

3) Register the mod with the launcher so the mod can be launched

 

The advantage is that this method would leave the original vanilla game files untouched, allowing them to be still played, plus if the mod is faulty it wouldn't break the vanilla game.

 

The disadvantage is that it requires a lot more disk space (up to 8 GB to duplicate the XEW folder) and requires a fair bit of time to copy the XEW folder.

 

Uninstalling a mod would require deleting the 'MyXComModName' folder and un-registering the mod with the launcher.

 

-----------------

 

Technical things to be addressed :

1) How does EW know to place stuff into the My Games/XCOM - Enemy Within/ folder? Mods should similarly put their files into a My Games/ XCOM MyModName/ folder. EDIT: FOUND THIS

2) Are there any direct references to the XEW folder structure within XComEW.exe? Initial inspect suggest not, but more testing needed.

 

And of course someone would need to build a new launcher executable...

 

It's really too bad that Firaxis didn't take the extra step to create such a configurable launcher to better support mods. Oh well!

Edited by Amineri
Link to comment
Share on other sites

Update:

 

I figured out how the My Games folder is created.

 

It is in the /Config/DefaultEngine.ini config file.

 

For EW it reads:

[Windows.StandardUser]
MyDocumentsSubDirName=XCOM - Enemy Within
+DirsToCreateAtStartup=Saves

For EU it reads:

[Windows.StandardUser]
MyDocumentsSubDirName=XCOM - Enemy Unknown
+DirsToCreateAtStartup=Saves

So to update and create a new My Games subfolder for a mod, DefaultEngine.ini would be modded to read:

[Windows.StandardUser]
MyDocumentsSubDirName=XCOM - MyXComModName
+DirsToCreateAtStartup=Saves

Link to comment
Share on other sites

I think to avoid the disk bloat it would be better to aim for a mod manager which is only replacing files that are part of the mod.

Something in the lines of:

Installation

For each file in .\LWModFolder {

make sure there is a vanilla backup file in .\ModBackupFolder

replace file in vanilla game folder.

}

Uninstallation

For each file in .\LWModFolder {

replace file in vanilla game folder using file from .\ModBackupFolder

}

The logic should probably be a bit expanded and refined and the mod installers would have to work a little bit different, but in the end I think it should be possible to chain multiple mods and very simple to uninstall the mods again without adding any significant bloat.
The reason why I would prefer such a solution is that I have the game installed on my system disk which is SSD and really doesn't have lot's of extra room, unless I make room by moving something else to mechanical disk instead...
I understand that this is not the most common setup, but I don't think it is unique or rare either.
Link to comment
Share on other sites

@Bertsilsson :

 

Your suggested approach is definitely more optimized for space. One possible concern relates to a common problem in Long War uninstallation, having to do with the files that end up in the My Games folder. I suppose simply swapping in a replacement DefaultEngine.ini would allow for a new My Games folder to be created, if desired.

 

That said, I certainly wouldn't suggest cloning the XEW folder for smaller mods. However, we've started to delve into tweaking map files (in terms of spawnpoints at least), plus the 3 typical upk files and a variety of localization and config files.

 

I'm also curious as to why Firaxis didn't go with the file swapping approach instead of having a cloned folder.

Link to comment
Share on other sites

I'm also curious as to why Firaxis didn't go with the file swapping approach instead of having a cloned folder.

I suspect the reason may be as simple as not wanting to risk conflicts with steam validation.

But here in Elbonia we don't really have to deal with modern issues like that, at least not until tomorrow :P

Link to comment
Share on other sites

Having XCOM on SSD too :smile:

 

I think LW can only benefit from own folder as you suggest Amineri. And smaller mods should aim for specific version like EU, EW, LW. Some mods for EW won't work with EU, but may be compatible with LW.

 

Edit: I wonder how many people would ever replay vanilla XCOM EU.

Edited by Drakous79
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...