Get the inside scoop on my doings at Stardock.
An Introduction to Anomalies
Published on February 16, 2006 By CaretFarmer In Modding

In this article, I'll briefly outline how to add your own anomalies to the game.  So, get a fresh cup of coffee or can of Coke, make a back up of you data directory and fire up your text editor!

If you look in the game's localized data directory (a default installation would be Program Files\Stardock\TotalGaming\GalCiv2\Data\English), you'll find a file named Anomalies.xml.  This file is where all of the game's anomalies are defined.  Here is a complete anomaly definition:

<Anomaly InternalName="Weapons1">

<Title>Weapons</Title>

<Description>We have uncovered a new waveform that will help improve our weaponry by roughly +1 percent.</Description>

<Image>Gfx\\anomaly_data2.png</Image>

<Model>1</Model>

<Type>11</Type>

<Quantity>1</Quantity>

<Commoness>1</Commoness>

<Power>1.000</Power>

<Class>1</Class>

</Anomaly>

As you can see, there's not much to an anomaly.  Let's create a new one.  Copy and paste an existing anomaly (everything between and including one pair of Anomaly tags) and then edit the copy's tags and attributes as follows:

InternalName: Every anomaly needs a unique internal name; it's how the game keeps track of them.  Therefore, make sure you give your new anomaly an InternalName that isn't used by any of the other anomalies in the file.

Title: Presently, the game doesn't use this value, so you can put whatever you like there.

Description: This is the descriptive text that appears when the player discovers an anomaly.  This text is preformatted when it is read in by the game, which means that it is scanned for certain special characters that get replaced with something else.  There are only a handful of special characters: '\n' will insert a CR/LF into the text; '\t' will insert a tab; '\\' will insert a backslash.  Also, if you were taught to type two spaces after a period, don't bother here: the preformatting will remove consecutive spaces.

Image: Specifies the filename and relative path of the image to display when this anomaly is discovered.  The game uses 250x180 PNGs; you can use other size images but they'll be scaled/stretched to fit in a space that nicely displays 250x180-sized images.

Model: A number that specifies which model to use when displaying the anomaly on the game screen.  Version 1.0 ships with 9 different models, so you can specify a number between 0 and 8 to indicate which model you want your anomaly to use.  And, if you're feeling adventurous and you know how to create your own .X files, you can add additional anomalies to the Gfx\Models directory; just be sure to follow the naming convention (Anomaly##.X and Anomaly##.png).

Commoness: If this value is 1, it indicates that the anomaly is just as likely to appear in a galaxy as any other anomaly with a Commoness of 1.  If this value is some number other than 1, then the chances of it appearing are roughly 1 in N*C, where N is the Commoness value and C is the total number of anomalies in Anomalies.xml.  For example, if there are 10 anomalies defined in Anomalies.xml and one of them has a Commoness of 7, there will be a 1 in 70 chance of that anomaly appearing in a galaxy.   

Type: A number that specifies what the anomaly actually affects in the game.  Legal values are:

0: Give/take money to/from the discoverer.  The amount added/subtracted is specified in the Quantity tag.

2: Adds/removes population from a randomly-chosen planet belonging to the discoverer.  If the Quantity tag is set to 0, population is subtracted; if the Quantity tag is set to 1, population is added.  The exact amount of the change is determined by the value of the Power tag: change = population * Power / 100.  Note that if Power is greater than 100, and you're subtracting population, you'll actually end up subtracting more population than is present on the planet, resulting in an overflow (i.e., a really big population). 

3: Boosts research on the technology that's currently being researched.  The Quantity value specifies what percentage of the remaining unfinished research is added to the current tech.  For example, if an anomaly of this type had a Quantity of 25 and the current tech had 4 weeks of research left, this anomaly would make it so that a week was removed from the remaining research time.

4: Random planet colonization.  The game will look for an uncolonized planet and, if it finds one, colonize the planet in the name of the anomaly's discoverer.  Note: the code that handles this event has not been exercised in a while, so use at your own risk!

5: Free ship.  Gives the discoverer a free ship.  Note: the code that handles this event has not been exercised in a while, so use at your own risk.

6: Improve ship.  Depending on the value of the anomaly's Class tag, it does the following:

Class = 0: Adds the Power tag's value to the ship's movement.

Class = 1: Adds the Power tag's value to the ship's current and max hit points.

Class = 2: Adds the Power tag's value to the ship's experience point total.

Class = 3: Adds the Power tag's value to the ship's attack stats.

Class = 4: Adds the Power tag's value to the ship's defense stats.

7: Currently unused.

8: Wormhole.

9: Planet Quality boost.  Picks a colonized planet at random from all of the planets owned by the discoverer and adds one to its quality.

10: Currently unused.

11: Civilization ability boost.  Adds the value of the Power tag to the ability indicated by the Quantity tag.  Possible values for the Quantity tag are:

0 (Economics), 1 (Weapons), 2 (Defense), 3 (Speed), 4 (Morale), 5 (Pop. Growth), 6 (Social Production)7 (Military Production), 8 (Research), 9 (Influence), 10 (Trade), 11 (Diplomacy), 12 (Hit Points), 13 (Repair), 14 (Sensors), 15 (Espionage), 16 (Soldiering), 17 (Interest Rates), 18 (PlanetQuality), 19 (Trade Routes), 20 (Unused), 21 (Unused), 22 (Range), 23 (Luck), 24 (Courage), 25 (Unused), 26 (Unused), 27 (Loyalty), 28 (Logistics), 29 (Miniaturization), 30 (Home Planet Quality)

12: Space Monster!

The other tags not mentioned in the type descriptions above can be given default values for that type because they are ignored for that type.

Phew, that was a lot of typing!  Once you've finished your editing, save the file, fire up the game and look for your new anomaly.  Have fun and mod on!


Comments (Page 1)
2 Pages1 2 
on Feb 16, 2006
Actually, I misspoke about Type 5 anomalies (free ship)--the code has been exercised recently and should work.
on Feb 16, 2006
Good to see the instructions for modding several things in the game. Might be a bit early, but I'm sure they'll come in handy one day.
on Feb 16, 2006
Two bookmarks in this forum now!
on Feb 16, 2006
Wow. Cheers. Cookies all around. Good stuff to have
on Feb 16, 2006
Good stuff! Thanks! Just what I was looking for.
on Feb 17, 2006
Thanks for the info!
Any chance that this will be followed by a "Make your own minor race" instruction thread?
on Feb 17, 2006

Any chance that this will be followed by a "Make your own minor race" instruction thread?

Unfortunately, the number of minor races is limited to 8.  Therefore, the only way you can add your own custom minor race to the game is if you change one of the existing ones in RaceConfig.xml.  Most of the xml tags in that file are pretty self-explanatory, so it should be a straight-forward change, but you can always ask for help in the modding forum if you get stuck.  Mod on!

on Feb 17, 2006
How about the size for the images for events, invasion tactics, etc? How about making this topic sticky?
on Feb 17, 2006
Thank you oh!!! Majestic Godess of the vast Universe.
on Feb 17, 2006

Thank you oh!!! Majestic Godess of the vast Universe.

Okay, I think I should clarify a point: were I to ascend to immortality, I would, in all likelihood, be referred to as a "God", because here on Earth my mortal coil is (almost always) considered male.

on Feb 17, 2006
Sounds great, thanks for the answer CaretFarmer. With Portrait numbers in the 50s, I figured that you were allowing for several more minor races. So I guess the good news is that all that space from RaceImage10 to RaceImage29 is for major races...
on Feb 17, 2006
Okay, I think I should clarify a point: were I to ascend to immortality, I would, in all likelihood, be referred to as a "God", because here on Earth my mortal coil is (almost always) considered male.


Or we'll just call you Ascended, and let everyone assume whatever gender they desire.
on Feb 17, 2006
Oh Ascended one, sorry for my lack of vision I got the name confussed with your sister the Godess Carielf.

Darn english names, in spanish is easier!!!
on Feb 17, 2006
Darn english names, in spanish is easier!!!

says someone who isn't studying in Finnland for almoast a year... Those finns here have strange names...
"Yeah sure I can call him after lunch..."
"uhm it's a her!"
"oops... uhm... well.... gotta go"
on Feb 20, 2006
Do those civilization ability boost numbers line up for Planetary Improvement AbiltityType number and the ability number for the Political Party bonus?
2 Pages1 2