A trip through the fantasy worlds I enjoy

 

In a prior Developer Blog (http://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 3)
on Mar 26, 2015

Can you please have a UI modding interface for this like the one in GalCiv 2 for us non-coders out there? It doesn't need to be fancy.

on Mar 27, 2015

WootwooT for customization!  Thanks, Stardock!

 

Okay, I started modding a Babylon 5-based race, Zathras (one of my favorite characters).  Some of it's working wonderfully, others not so much.  Possibly an error in my code.  I've attached three screenshots and copy-pasted to .xml for debugging purposes. If there's a more appropriate forum to share this please let me know.

 

Following this guide and the mod instructions text file I assembled to directories properly (in theory) and place the appropriate custom race images in their respective locations (again, in theory).  Everything in race selection screen is fine except the background and foreground images (Image 1).  However, if I create a custom race I can choose the correct background and foreground images (Image 2).  The startup screen is similar: everything okay except the images (Image 3).  Thoughts?

 

Thanks everyone for the hard work and interactions!

 

<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<FactionList xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../Schema/FactionDefs.xsd">
<!-- created by Stonehold the Magnanimous -->   
<!-- FactionsDefs_Zathras.xml -->
   
   <Faction>
        <InternalName>FACTION_Zathras</InternalName>
        <DisplayName>Zathras</DisplayName>
        <DisplayNameShort>Zathras</DisplayNameShort>
        <LeaderName>Zathras</LeaderName>
        <Description>An enigmatic and occasionally unpredictable race, there are
        currently     ten known Zathras' in existence.  Ever tied to The Great Machine,
        their mission is It's will ... and yes, that's as cryptic as it sounds.  
        Strong, caring and industrious, Zathras is always looking for the right tool
        for the job -- whatever that may be.  "Zathras is used to being beast of
        burden to other people's needs. Very sad life. Probably have very sad death.
        But, at least there is symmetry."</Description>
        <RaceType>Major</RaceType>
        <PersonalityTraits>Expansionist</PersonalityTraits>
        <PersonalityTraits>Scientific</PersonalityTraits>
        <RaceTraits>EngineersAbility</RaceTraits>
        <RaceTraits>AdaptableAbility</RaceTraits>
        <RaceTraits>Handy2</RaceTraits>
        <RaceTraits>Tough2</RaceTraits>
        <RaceTraits>Resilient1</RaceTraits>
        <RaceTraits>Observant1</RaceTraits>
        <RequiresHomeworld>true</RequiresHomeworld>
        <HomeStarSystem>SolSystem</HomeStarSystem>
        <StartingShips>ColonyStaticBlueprint</StartingShips>
        <StartingShips>SurveyStaticBlueprint</StartingShips>
        <StartingShips>ScoutStaticBlueprint</StartingShips>
        <TechTree>Terran_Tree</TechTree>
        <ShipCallsign>Zeta</ShipCallsign>
        <LogoImage>b5-logo.png</LogoImage>
        <LeaderThumbnail>Zathras_small.png</LeaderThumbnail>
        <LeaderImageFG>Zathras_FG.png</LeaderImageFG>
        <LeaderImageBG>The_Great_Machine_BG.png</LeaderImageBG>
        <NewsRobotMovie_Approach>Terran_ResearchAdviser_Approach.bk2</NewsRobotMovie_Approach>
        <NewsRobotMovie_Idle>Terran_ResearchAdviser_Idle.bk2</NewsRobotMovie_Idle>
        <StartupImage>StartGameZathras.png</StartupImage>
        <StartupTitle>You ... you not the One.</StartupTitle>
        <StartupDescription>You leave, Zathras die.  You take, Zathras die. Either
        way, bad for Zathras.</StartupDescription>
        <StartupTraitsDescription>No one, ever listens to poor Zathras no, he's
        quite mad they say. It is good that Zathras does not mind, has even grown
        to like it.</StartupTraitsDescription>
        <MapColorDef>TerranMapColors</MapColorDef>
        <UIColorDef>TerranUIColors</UIColorDef>
        <FactionMoviesFGDef>TerranMoviesFG</FactionMoviesFGDef>
        <FactionMoviesBGDef>TerranMoviesBG</FactionMoviesBGDef>
        <FactionMusicDef>TerranMusic</FactionMusicDef>
        <Material1>GC3_Ship_Material_01</Material1>
        <Material2>GC3_Ship_Material_02</Material2>
        <Surface1>GC3_Default_Surface_01</Surface1>
        <Surface2>GC3_Default_Surface_02</Surface2>
        <Appearance>GC3_Terran_Appearance</Appearance>
        <ShipStyleSet>TerranShipStyleSet</ShipStyleSet>
        <CreditsInit>6000</CreditsInit>
        <WarEnduranceInit>90</WarEnduranceInit>
        <DefaultResistance>0.5</DefaultResistance>
        <InfluenceTallyInit>10</InfluenceTallyInit>
        <StartingColonyPopulation>10</StartingColonyPopulation>
        <AICategoryWeight>
          <Military>16</Military>
          <Growth>8</Growth>
          <Tech>12</Tech>
          <Diplomacy>20</Diplomacy>
          <Expansion>18</Expansion>
          <Wealth>14</Wealth>
          <Influence>10</Influence>
          <Fortification>6</Fortification>
        </AICategoryWeight>
    </Faction>
 
</FactionList>

 

Race Selection

 

Custom Race Screen

 

Startup Screen

on Mar 27, 2015

Shoot!  Sorry, don't know what happened -- the pics didn't post, just a buncha gunk.  It won't let me edit it.  Help?

 

Edit:  fixed it.  Not used to this forum yet.

 Post edit: I meant, I fixed the previous post, not the issues stated in that p[ost.

on Mar 27, 2015

stonehold

Shoot!  Sorry, don't know what happened -- the pics didn't post, just a buncha gunk.  It won't let me edit it.  Help?

I see the pictures, very nice!  Zathrus is one of my favorites, too.

on Mar 28, 2015

Remove these two lines:

        <FactionMoviesFGDef>TerranMoviesFG</FactionMoviesFGDef>
        <FactionMoviesBGDef>TerranMoviesBG</FactionMoviesBGDef>

 

From my tests they will overwrite the Pictures you defined in

        <LeaderImageFG>Zathras_FG.png</LeaderImageFG>
        <LeaderImageBG>The_Great_Machine_BG.png</LeaderImageBG>

 

Can anyone start a game with a race added in by a mod?

I have used the FactionDefs.XML and the corresponding text files. Everything looks fine in the game Setup, however after creation of the galaxy the game never starts and either freezes or crashes.

The same thing happens when I just copy the FactionDefs.XML, rename it and only Keep Terrans in there and rename them.

Obviously I am missing something... Are any other files needed except for FactionDefs.XML and FactionText.XML?

 

When I create the exact same race through the ingame methods, I can start a game just fine.

 

For those interested, here an example race I created:

 

 

 

on Mar 28, 2015

Yes!  Thank you, @Ronnar!  Makes sense, the default images are animated.  Fixed the startup screen, too.

 

Doing some more extensive editing on StarSystemDefs.xml and PlanetDefs.xml now. 

 

Are there any plans for starbase editor?  It'd be really awesome if I could design one to look like B5 orbiting Epsilon III.

 

on Mar 28, 2015

stonehold

Yes!  Thank you, @Ronnar!

 

You are welcome. Is your new race working in game?

My race only works as an opponent, not if I want to play it.

Could you please make your files available so that I can compare what stupid mistakes I have made?

I think I found my stupid mistake - a typo in the tech tree entry

on Mar 28, 2015

Yup, got it working in-game.

Here's a link to the zipped directory.  After you extract it into your \Documents\my games\GalCiv3\Mods\ directory, go to your \Steam\SteamApps\common\Galactic Civilizations III\data\Game\ directory and append both the 'PlanetDefs.xml' and 'StarSystemDefs.xml' with '.1' or some equivalent in order to keep them intact. 

 Edit: btw, this is my first mod. Ever. In the history of existence.

 

on Apr 01, 2015

Is there a way to mod a galaxy? Say, for example, someone wants to create a custom galaxy with fixed star system points ('Babylon 5' a,d 'Mass Effect' are two examples with locations in specific coordinates and sectors).  The GalaxyDefs.xml file doesn't seem to have much room for customization as far as I can see.  Is there a different file one could use as a base-line for coding?

 

Thanks!

on Apr 01, 2015

Not sure what I am doing wrong.

 

I created a mod folder, identical to the examplemod.  In it a created an XML called FactionDefs_Test.

 

I copied text from the FactionDefs.xml to include the basic tags and the faction info (copied from Terran). I renamed the InternalName to "FACTION_Test" but otherwise left other things the same.  That should create a Faction that is just a duplicate of the Terrans, yes?  

on Apr 02, 2015

So you created a mod folder Dumhed, did you created the other folders under it and put your file in the mod\Game\ directory or just in the mod\ directory.

It's been said that you need to put files in the correct subdirectory in you mod or the game won't load them properly.

 

 

on Apr 02, 2015

Also have you created a mod version of the StarDefs.xml with your new start "KonokujaStar" defined in it you have that in the <BodyDef> tag for the star but I think you then need to define in in StarDefs with the same internal name. Might be wrong haven't got a change yet to mod the game myself but have managed to look through some of the xml and schemas.


on Apr 02, 2015

Can we get this permanently stickied so players have a tutorial to follow?

on Apr 10, 2015

Now I've tried this myself i am also seeing that my mod races don't appear in game, odd seems straight forward enough but doesn't seem to work.

on Apr 10, 2015

Just tried adding a mode that had the correct folder structure and a FactionDefsD2.xml, got rid of all other factions than the dregin in it and changed there internal name by adding a 2 nothing else. Expected to get a second lot of Dregin on the race choice screen and didn't so it seems mods don't work for me generally