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 2)
2 Pages1 2 
on Mar 11, 2006
I was making a list of what the different anomaly models looked like, when I noticed that, no matter what class I used, when I clicked on the anomaly in-game, the class and description matched the model. And I've been unable to find where this data is stored. Is it hard-coded? Anyone know?
on Feb 08, 2007
how do you get a text editer
on Feb 08, 2007
how do you get a text editer


Start Menu->All Programs->Accessories->Notepad.
on Feb 09, 2007
thanks
on Feb 09, 2007
well actully i did it on notepad and tried pasting it on the normal stuff and it still dint work
on Feb 17, 2007
never mind
on May 10, 2008
I'm interested in space monsters and item #12 seems to address that. Where are the characteristics of the space monster stored?
on May 10, 2008
May I humbly suggest that this excellent article find its way into the wiki in some form?
2 Pages1 2