A trip through the fantasy worlds I enjoy

 

In a prior Developer Blog (https://forums.galciv3.com/461709/page/1/ ) I talked about all the cool stuff you can do in the Custom Race tool. We give you a bunch of images, traits, abilities and settings to create whatever race you want.

But, if you really want to make something unique you can go so much further. In this post I’ll talk about how modding works in Galactic Civilizations III and show you how I used it to make a new faction for the game, the Ghosts of Abbadon.


How does modding work?

Mods are files placed in your My Games/GalCiv3/Mods/ directory. They can include graphic and XML files. You can have as many mods in here as you want, but keep them in their own directories (so if you want to remove one it’s easy to do). The plan is to get some Steam Workshop integration in here to help manage this at some point. But first we are getting the system working.

NOTE: We use a file structure to help with organization, but the game actually just searches all subdirectories when looking for files. So your files must have unique names (even if they aren' in the same directory).

At a high level there are three things you want to do when modding. You either want to add something, modify something or delete something.

  1. Adding things. This is the easiest, just create a new XML file, with a new name. It doesn’t matter what the name is, as long as it isn’t the same as an existing file. Personally I like using the same name that it uses in GC3, but I append the mod name to make sure it is unique. The only other thing that matter is that it is in the right directory. Faction Defs, Star System Defs and Planet Defs are all in the Game folder (because if you look at the XML in the GalCiv’s real directories those files are in the Game folder). You have to match GalCiv3’s file placement so that the modded files load correctly. Add a new file in here with just the new Faction, Star System, Planet, Tech, Improvement, Ideology Trait, etc (there are about 150 moddable xml files in GC3). Anything Paul can add to the game, you can add too.
  2. Modifying things. What if you want to increase the amount of credits the Iridium to start the game with? If you ever want to modify an existing object you just need to copy the file from the GC3 directories and modify what you like, but be sure to keep the name exactly the same. When the game starts if it sees a file with an identical name in your mod directory to one of the base files it uses your mod file instead. This gives you ultimate control over overwriting anything in the base game (without ever having to modify a base game file).
  3. Removing things. Since you can overwrite any of the existing XML files our deletion solution is built right in. If there is a particular global event that annoys you can copy that xml file into your mod directory, delete that event form your copy and voila, it’s gone.

Now let’s use this power to create a new faction, the Ghosts of Abbadon. The Ghosts are unlike any other faction in GC3, and we want to be able to do more with them than the Custom Race tool normally allows. In this case they have ruined their homeworld and used the last of their resources to prepare 3 colony ships to go out and attempt to find a new home.

How do we do this?

1: Copy the FactionDefs.xml file into my new mods \My Games\GalCiv3\Ghost\Game\ directory.

2: Rename it from FactionDefs.xml to FactionDefs_Ghost.xml. (I don’t want to overwrite the existing factiondefs, I just want to add a new one).

3: Open up the file (I use Notepad++ for this) delete the other entries, except maybe one I am about to use as a template, and add the XML for my faction.

There are lots of things set here. But the important things here are that <HomeStarSystem> is set to “DeadSystem” where normal factions have a Colony, Scout and Survey ship in <StartingShips> they have 3 Colony ships instead. We could put anything we want in here, 12 Colony ships, a Battleship, a fleet of flying toasters, etc.

I played with a bunch of options with their starting ships. At first I gave them the extra colony ships in addition to the normal Survey and Scout. But when it was just Colony ships it made them feel a more desperate. They don’t have the luxury of having a scout out finding planets for them, or time spent collecting anomalies. When they choose to set out for a star it becomes a dramatic step, and when there is nothing there it is a tragedy of the time of a very valuable resource wasted. And when they find a worthwhile planet it is a huge joy. The hardest part is finding a mediocre planet, do they keep going, looking for something better, or settle?

I used the Terran definition for most of their art aspects, and I’m using one of the extra faction foregrounds and backgrounds that come with the game (“Devilgirl”) for the leader art. We could create our own versions of any of this. If you had a custom image you wanted to use for your faction you would just reference it here, I think Paul has one for his dog Maggie.

The only custom art I created for them is that I created a new material in <Material1>, Ghost_Ship_Material_01.

To do that I added a new file for my mod, this time in the \Mods\Ghost\Core\ directory. I’ve used it to define a new material that I can use to create ships. Materials aren’t colors (you will want to add appearances to modify ship colors). They define the way that light interacts with the surface of the object and I wanted to try some things out to make the ghost ships look unusual.

I really don’t know what I’m doing here. But I love having lots of levers available to tweak and play with. So I’m not asking any modder to understand what all these options mean. Instead do what I did, make a bunch of new materials with all sorts of values then load up the game and check them out. I’ve created new color schemes and materials, and I will add them to the base game to make it easy for non-modders to play with. But modders can go wild.

For this new material I bumped the Reflectivity to a crazy 10.2. That’s going to make my ship look like it is made from mirrors. It’s hard to appreciate in a still picture, but it looks pretty cool in motion.

 

So I have some cool looking ships and a fun faction to play as. I’m going to go play some Galactic Civilizations III.


Comments (Page 1)
12 Pages1 2 3  Last
on Feb 21, 2015

Very nice, looking forward to what the community brings to the table!

on Feb 21, 2015

This is really cool.

I think it'd be great if you'd allow at least some of this capability within the race generator vs xml modding.

Assign a total point value to home planet value/colony ship/scout/etc and allow the player to modify it in game.

on Feb 21, 2015

I see some modding problems with the system as written... but first off, I want to say thanks for posting this early enough for us tyo give feedback before it's done (I hope?)

 

  • The first issue I see is that modding a specific core  race's tech tree (or worse all) will either make that mod inoperable with any other mod even if both simply add a new item to the tree & do not cause conflicts
    • The only ways I can see accomplishing this is to either A replace he factiondefs.xml & use a new name for the modded tree, but this causaes a problem in that any mod will need to be manually added to this... or B Replace the $RaceTechDefs.xml & get a different shade of the same problem
    • While modding, I've found that having a second file with the same start of the name (say TerranTechDefs - Copy.xml, the default for win8.1's copy/paste from/to that folder), but then it complains about duplicate entries in the file at launch  A Better solution IMO  would be to start modded xml files with something akin to this:
<modfile>
<Thisfile>SomeXmlFile.xml</ThisFile>
<DiffMethod>Replace/Modify/Append</DiffMethod>
<modded stuff...>
</modfile>
 
With the Replace/Modify/Append, I forsee this example functionality:
  • Replace:  Outright replace the ThisFile tagged file with this one (aka current behavior)
  • Modify any object in the mod file will replace  the existing copy in ThisFile.  This means that removing something takes explicit action rather than omission & allows multiple mods to exist at the same time without manual merging.  want to delete an improvement/tech/hull?  Give it an impossible prerequ, delete an event?.. set the weight to 0..  Note, a better method for delete below in its own section
  • Append: This mod adds stuff to the xml tagged in ThisFileso now you can load 5 different mods that sim ply add a single item to improvementdefs.xml & the tech trees without having to do any manual editing of files or com through large tech/component/improvement files hoping to get just the modded stuff. any duplicates resulting between this & the original file will throw the same error that having duplicates in either file would, this is a good thing for reasons explained later
  • Lets say you explicitly want to delete something (or even lots of somethings), using the 4 <DiffMethod>s, the easiest solution would be to copy the original file to your mod directory & remove the offending item with a Replace <DiffMethod>.. then set that mod to load first with the highest priority.  This allows removal of an item that doesn't normally have/allow a prerequ (ie.e. upresolutions.xml )

 

Using the above suggestions, I'm hoping that the following is not too optimistic:

  • Players have a mod manager that allows multiple mods to be loaded at the same time with an option to define which order mods are loaded in.  Since mods would theoretically (I hope) just be the bare bones of the mods themselves & define for themselves how they are to treat the original xml, almost no additional validation need be performed above the existing validation already in place.
  • In the event of a conflict, players can choose to quit & redo the load order/remove a mod or continue & ignore since they might legitimately want to ignore it and play anyways just as you could if modding the original xml files
    • Legit example reason to continue & ignore: It's not uncommon for modders to build off another mod.  Take one mod that does a bunch of stuff & add two different forks that add different sorts of things to the original making the duplicates irrelevant.  Yes, the names could have different suffixes & they wouldn't need to build off it so much as require it for their built off forks if the suggested append type <diffmethod> exists, but it's only an example ^& there could be other less obvious ones.
  • You could load N  different mods that individually add/remove different things to the tech trees for each race  & the worst case scenario is that a prerequ for n2 of them is removed by one of the others assuming they all use unique suffixes conflicts are avoided by virtue of modders simply saying "This mod requires X mod to be installed & loading before this one" rather than each trying to copy things from required mods

edit: It's possible I've misread something... If so, My appologies

- Tetra

on Feb 21, 2015

Tetrasodium

The first issue I see is that modding a specific core  race's tech tree (or worse all) will either make that mod inoperable with any other mod even if both simply add a new item to the tree & do not cause conflicts

Can you explain where the conflict is? I haven't tried modding GCIII yet, but I don't see why this modded race which uses the Terran tree wouldn't just use a modded Terran tree if you created one.

@Stardock: Do custom raced created with the in-game editor create .xml files like this one so you can start a race in the editor and then go in an mod it?

on Feb 21, 2015

I'm really liking the modding options. It is fun to do just like playing the game, it makes it feel personalized.

Glorious.

on Feb 21, 2015

@perrgrine. In this example. A new race is being added, nothing I'm the core game is being modified so no conflict. But lets say you have two hypothetical mods as follows:

• mod1 removes the tourism stuff from all tech trees, adds some new buildings Ann specialty planet types with resource types for the buildings added to colony or something instead of faction

• mod2 removes the atarbase module stuff from tech trees & adds them in elsewhere along with new/different modules.

 

both mods do not directly conflict, but there is no way to use both using the capabilities described without having to keep one (or both) branches that should be pruned/trimmed from the tech trees, ignore some errors about duplicate entries, or manually merge the two mods into one file.  Under the changes I suggested, they each take the relevant techs they want to remove & set their prerequ's to nonexisting tech effectively removing them.... the only time a conflict would come into play is if both wanted to prune the same techs (resulting in what should be the same basic end result), or add to the same techs/improvements/etc (probabbly not the most compatible of mods on a conceptual level at that point)

on Feb 21, 2015

Ahh, I see what you are talking about now. thanks for the clarification.

on Feb 22, 2015

Zhurok

This is really cool.

I think it'd be great if you'd allow at least some of this capability within the race generator vs xml modding.

Assign a total point value to home planet value/colony ship/scout/etc and allow the player to modify it in game.

Sure. But the point is that this is just one of many many crazy things that can be done with modding. And I picked a very simple one because I wanted a clear example. No matter what we provide in the custom race creator, there will always be another thing that could be added to it. The point of modding is that all of those options become available to you.

Modding is better for things that are inherently difficult to balance. I don't want players to feel like they have to make a custom Terran faction with 3 colony ships or else they are playing with a disadvantage. Instead we leave that to mods where the understanding is that you can do unbalanced things if you want.

For example, in my playing of the Ghosts last night I found out that they are overpowered. Since each of their initial colony ships start off with population they were starting with more population than any other factions (if they could get new colonies in a reasonable time frame). Population drives everything in GC3, so they became tech and production monsters right out of the gate. I fixed that by reducing their homeworld population from the normal 10 to 5. This accounted for the pop on the ship and also did a better job of reflecting that their homeworld is ruined.

on Feb 22, 2015

Will you provide support for standard bik files, so the average modder can add video or animated files?

Bk2 files, so far I haven't been able to obtain a license for as a casual modder or individual, I think they only sell it to game developers.

Thanks for reading either way. 

on Feb 22, 2015

Tetrasodium

The first issue I see is that modding a specific core  race's tech tree (or worse all) will either make that mod inoperable with any other mod even if both simply add a new item to the tree & do not cause conflicts

That is true (actually not in your example, but your point is valid). In general people shouldn't be modifying or deleting things from the base game if they want to be able to run multiple mods together. This is problematic in nearly every case. For example I have one mod that increases all the factions to start with 6000 credits, and another mod that adds a new faction. That new faction won't start with 6000 credits (because its creator didn't know you wanted to run with 6000 credits too, and the credits mod owner didn't know you wanted the new faction).
 
Or I have a mod that removes the Drone Sentry System tech from the game and another that adds another Tech that requires Drone Sentry Systems. They aren't goign to work well together no matter what you do.
 
In general, modifying and deleting base game objects is best for total conversion mods. Mods that you don't expect to run with other mods. That's not to say that you couldn't do it, just that compatibility issues are a risk.
 
Some of these issues are addressed on our side. Using your example (which would be a common one) of adding new techs to the Terran tech tree you can do entirely without replacing a base file. Create a new file for your new techs and they will be incorporated into the tree, as well as new techs from any other mods. So we will do what we can on our side to make it easy and clean.
 

Tetrasodium

While modding, I've found that having a second file with the same start of the name (say TerranTechDefs - Copy.xml, the default for win8.1's copy/paste from/to that folder), but then it complains about duplicate entries in the file at launch  A Better solution IMO  would be to start modded xml files with something akin to this:

<modfile>

<Thisfile>SomeXmlFile.xml</ThisFile>

<DiffMethod>Replace/Modify/Append</DiffMethod>

<modded stuff...>

</modfile>

I may not be understanding what you are asking for. This is essentially what it does. If it is a new filename then it does an Append of everything in it. If it is an existing filename then it replaces everything in the former file with this one. It doesn't happen on a per entry basis.

Let's talk about why. It would be cool to have that on each entry. It wouldn't allow modders to do anything additional, and it wouldn't get rid of compatibility issues. But it would reduce compatibility issues by allowing modders to be more surgical with their changes. The nice thing about the existing system (load file A or file B ) is that the game itself is unaware of mods, we are handing mod assets at the file level. No code to parse these files and apply logic on each entry. The game is simply given a different view of the world when you have mods loaded or not.

This also works when talk about scenarios and the campaign. Where they have a locked view of the world. For them mods don't exist but their own local changes do. So they are a special saved game state. So if you run a GC3 campaign game Paul can change it however he would like and thats exactly how it will play, regardless of what mods are in your mod directory. You could also make a special scenario with rules just for that scenario and not worry about compatibility.

That isn't to say that being able to modify/delete at an entry level wouldn't be good. This is a first step. lets get it into mod makers hands and see where to go next.

 

Tetrasodium

Players have a mod manager that allows multiple mods to be loaded at the same time with an option to define which order mods are loaded in.  Since mods would theoretically (I hope) just be the bare bones of the mods themselves & define for themselves how they are to treat the original xml, almost no additional validation need be performed above the existing validation already in place.

I'm all for this. It isn't in now and probably won't be in for Beta 5. But I would love to use Steam Workshop for this where you can find, install, uninstall, enable and disable all your mods in one place.

on Feb 22, 2015

markmid

Will you provide support for standard bik files, so the average modder can add video or animated files?

Bk2 files, so far I haven't been able to obtain a license for as a casual modder or individual, I think they only sell it to game developers.

Thanks for reading either way. 

We went to bink2 for performance reasons. We would have to write code to handle both, and we may even need to pay an additional licensing fee to do that. I'll ask the Rad Game guys to see if there is a way modders can make Bink2 movies for GC3.

 

on Feb 22, 2015

I want to preface this really long reply with this "Thanks for the reply, I had a lot of fun responding to your points & putting this together" a similar quote>comment quote>comment >repeat style seemed like the best format

 

Derek Paxton

That is true (actually not in your example, but your point is valid). In general people shouldn't be modifying or deleting things from the base game if they want to be able to run multiple mods together. This is problematic in nearly every case. For example I have one mod that increases all the factions to start with 6000 credits, and another mod that adds a new faction. That new faction won't start with 6000 credits (because its creator didn't know you wanted to run with 6000 credits too, and the credits mod owner didn't know you wanted the new faction).

I was trying to go with simple in example, and I agree that it was more than a little contrived to come up with one that wouldn't take much of a description for why  someone might want to run them both.  Your credits mod actually has a better place that should be able to do it and not have the problem you describe, but it sadly suffers from the same limitation it had in galcivII  Specifically  MapSizeDefs.xml

<GlobalCombatMods>
<EffectType>ShipRange</EffectType>
<Target>
<TargetType>Ship</TargetType>
</Target>
<BonusType>Multiplier</BonusType>
<Value>1.60</Value>
</GlobalCombatMods>
There is one for each maptype, unfortunately the only EffectType it allows is ShipRange I think (GC2 had a similar if not the same thing), if it  was more flexible & supported other stuff, your mod could simply  add this to it:

<GlobalCombatMods>
  <EffectType>CreditsInit</EffectType>
   <Target>
   <TargetType>Faction</TargetType>
   </Target>
   <BonusType>Multiplier</BonusType>
    <Value>2</Value>
</GlobalCombatMods>

and any newly created factions would automatically benefit from double the starting credits giving everything with 3000 creditsinit 6000 & anything starting with a value !3000   double !3000. add in things like tweaking research speeds, production capabilities, or anything else  as what could be a quick and trivial way to make massive global changes.  I don't remember what I tried with it in 0.6x

 

 

Derek Paxton
Or I have a mod that removes the Drone Sentry System tech from the game and another that adds another Tech that requires Drone Sentry Systems. They aren't goign to work well together no matter what you do.
if they only do the things you state that is correct, but if they both do additional things  & for some reason $player wanted to play with the additional things without caring that  the second mod would have an unobtainable prerequ on one or more techs as a result of the first.
 

 

 

 

Derek Paxton

In general, modifying and deleting base game objects is best for total conversion mods. Mods that you don't expect to run with other mods. That's not to say that you couldn't do it, just that compatibility issues are a risk.

 

I both agree and disagree at the same time on this one & will use a mod I made for GalCivII as an example,  I removed things from a number of core game buildings and techs (doc'd in linked post but the mod itself is no longer reachable due to new job).  Using the improved GalCivIII capabilities, I would probably have broken it into multiple individual mods that could be loaded individually when it  makes sense, but there are plenty of less extreme reasons than total conversion to want to remove things from the core game

 

 

Derek Paxton

 Some of these issues are addressed on our side. Using your example (which would be a common one) of adding new techs to the Terran tech tree you can do entirely without replacing a base file. Create a new file for your new techs and they will be incorporated into the tree, as well as new techs from any other mods. So we will do what we can on our side to make it easy and clean.

 

Great to hear, going along with that train of an example, will a mod that includes a <InternalName>$example</InternalName> that already exists in the core files replace, merge, or error  about duplicates with the original?   I could see reasons why each might be desired, but I think replace would be the generally optimal option.

 

 


 
Derek Paxton

Quoting Tetrasodium,


While modding, I've found that having a second file with the same start of the name (say TerranTechDefs - Copy.xml, the default for win8.1's copy/paste from/to that folder), but then it complains about duplicate entries in the file at launch  A Better solution IMO  would be to start modded xml files with something akin to this:


<modfile>

<Thisfile>SomeXmlFile.xml</ThisFile>

<DiffMethod>Replace/Modify/Append</DiffMethod>

<modded stuff...>

</modfile>



I may not be understanding what you are asking for. This is essentially what it does. If it is a new filename then it does an Append of everything in it. If it is an existing filename then it replaces everything in the former file with this one. It doesn't happen on a per entry basis.

Let's talk about why. It would be cool to have that on each entry. It wouldn't allow modders to do anything additional, and it wouldn't get rid of compatibility issues. But it would reduce compatibility issues by allowing modders to be more surgical with their changes. The nice thing about the existing system (load file A or file B ) is that the game itself is unaware of mods, we are handing mod assets at the file level. No code to parse these files and apply logic on each entry. The game is simply given a different view of the world when you have mods loaded or not.

I was thinking more for the entire file than individual items in it since xmlname_addstuff.xml  xmlname_replacestuff.xml could both be included in a single mod.  Using your factiondefs_ghost.xml screenshot, the entire thing would be placed between <modfile><thisfile>factiondefs.xml</thisfile><diffmethod>append</diffmethod> and </modfile>. You are right that this can already be done as long as a mod adding an item with an InternalName already in the core files overwrites that one & the same is true for mods in a lower load order (assuming that is added).  I think doing it on a per component/improvement/tech/etc level might be excessive since you could just have an xml file for  the appends to $xmlfile, a second for replace if needed & a third for modify to do things like surgically remove bits from existing things like I did all over in the galcivII mod example, replacing the entire xml file would be excessive & incompatible if I were to break it   among itself if I were to have done it with a mod for the life support tech changes, one for the entertainment tech changes, & a third for sensortech changes..  all three would need to remove something from the original tech tree (various bonuses) in order to insert them elsewhere  without actually removing any techs (IIRC) and instantly become incompatible with each other allowing that sort of thing was the idea behind modify but would be unneeded if duplicate <InternalName>s  clobbered ones loading later with the first version... guess I'd still need to make it one monolithic thing using that example

 

Derek Paxton

This also works when talk about scenarios and the campaign. Where they have a locked view of the world. For them mods don't exist but their own local changes do. So they are a special saved game state. So if you run a GC3 campaign game Paul can change it however he would like and thats exactly how it will play, regardless of what mods are in your mod directory. You could also make a special scenario with rules just for that scenario and not worry about compatibility.

That isn't to say that being able to modify/delete at an entry level wouldn't be good. This is a first step. lets get it into mod makers hands and see where to go next.

Generally I find that the xml files get included with a save game & making changes usually needs to restart.  The only exception that I've noticed (accidentally at that) was mod some stuff> start a game> before saving alt-tab out & make more changes.  The specific thing I did this with was the bonus with some kind of ship component in 0.6x while in the designer .   I don't know if that was a fluke or just an interesting loophole.
 

 

Derek Paxton

Quoting Tetrasodium,


Players have a mod manager that allows multiple mods to be loaded at the same time with an option to define which order mods are loaded in.  Since mods would theoretically (I hope) just be the bare bones of the mods themselves & define for themselves how they are to treat the original xml, almost no additional validation need be performed above the existing validation already in place.



I'm all for this. It isn't in now and probably won't be in for Beta 5. But I would love to use Steam Workshop for this where you can find, install, uninstall, enable and disable all your mods in one place.

xenonauts has an excellent example of this in action, essentially it's a simple launcher app that lets you see installed mods, make them active, set the load order, etc.  it also doubles as a launcher that launches the game with mods as configured  & the mods only come into play if you actually click the button to go into that part.  something like that might(?) even be able to speed up whatever is happening between launching the game & Lord Kona/The drengin going away to give us the intro getting the video (if that's not doing some kind of beta debugging thingy?) by caching whats in memory to disk & just loading that if all the xml & game files have the same filetimes, maybe even reserve that to a default unchecked enable quickload option on that launcher since any problemsd caused by new drivers or something could be resolved by "try disable quickload &doing a standard load"

 

-Tetra

on Feb 22, 2015

If this isn't stickied, this should be stickied.  Great post.

on Feb 22, 2015

I want to translate the sentence of the game into Japanese. However, I do not want to update the xml file every version up. I want the other file to do a sentence playing a game.

on Feb 22, 2015

@folexe.  All of the language files are in calciv3\data\english\text\ rather than the XML files that define the mechanics. As long as you only change the string values rather than names, it should just be a matter of translating the English text to the corresponding Japanese text

12 Pages1 2 3  Last