How do we mod .Faction files?

I'm sure that there is an easy way to do this, but I can't figure it out.  Once a custom faction has been created, how can I go in and edit the file? I see a .Faction file but can't seem to find the xml files.

Any help would be appreciated. Thanks!

 

 

20,899 views 9 replies
Reply #1 Top

That's because the factions are saved as a .faction file. It is extremely inconvenient. If you want to mod in a faction yourself then I suggest you take a look at a few of the faction mods on this forum.

Reply #2 Top

It seems like it should save as an xml file, I wonder why it doesn't?!

Reply #3 Top

There are probably a few reasons to compact it into a single file.  Though it is not the most "modder" friendly, it can be more user-friendly for non-modders who make and share Custom factions.  The faction file has everything embedded, including what would be the factiondefs.xml file and the images (custom or stock) chosen by the creator.  This saves people who have no experience or desire to setup mod folders, etc... from having to do that for every faction and the icons/pictures.  Instead, it is all contained in one file.

Anyway, I would still prefer it to be separated out.  But I understand that there are some benefits to the current method.

Reply #4 Top

Quoting TS22, reply 2

It seems like it should save as an xml file, I wonder why it doesn't?!

Time-saving feature for the game, mostly.  From what I recall in the mod devchat with Derek on Monday, the game converts all of the XML files into a binary file/code it can understand.  The faction files are one of the few things, outside of the ship files (which aren't XML either, for what it's worth), that are created in-game but stored externally.  Thus the game is saving them in its binary format that it understands instead of reloading it and recompiling it every time it needed it.  Now Derek didn't seem against the idea of storing faction files as XMLs and then have the game convert them when it needed it.  But he also didn't quite see the need for it, either.  Being in the middle of chat, the pros and cons weren't that easy to discuss.

The biggest pro is that it makes it far easier to mod things after faction creation.  Starting amount credits, custom faction traits (especially ones that total more than are allowed by the base game), that sort of thing that the edit-by-copy-and-delete-the-old doesn't deal with as well.  

The biggest cons is the extra step/time that the game would need to reprocess the faction file.

Personally, I think the pro outweighs the con.  But perhaps the few amount of people who would want to edit faction files directly makes it not a priority on their part.  And every time you add a feature to the game, the risks for the code blowing up increase, even incrementally.  Still, perhaps if enough people ask for it, it'll come eventually. :)

Reply #5 Top

What if there was an Unpacker that would bring everything out of there? That would resolve everything.

Reply #6 Top

Derek also mentioned the possibility of making both a .faction file and a non-binary file for later editing, which is a nice compromise, in particular as this is just spitting out already made code (aka. the .faction file pre-binning as an .xml or similar), rather than something new.

Reply #7 Top

It was done so that normal players would not have to restart the game after creating their custom faction. It's strange, GalCiv 2 didn't have this problem and generated XML files.

Reply #8 Top

Just a

Quoting StephanReiken, reply 5

What if there was an Unpacker that would bring everything out of there? That would resolve everything.

This. And of course, the same tool should pack the files back into a faction file after the work is done.

Reply #9 Top

A .faction packer/unpacker would be awesome!

I can't seem to get any .xml faction to work that I make, and I don't want to be limited to the ingame creator, no power over custom start ships, etc.