Spore PROP XML Basics

Learning to mod or have something to contribute? Have a look and find more.
rob55rod
Admin
Admin
Posts: 4086
Joined: Sat Jul 02, 2011 9:50 am

Spore PROP XML Basics

Unread post by rob55rod »

Almost every aspect of Spore uses PROP files, which contain a list of properties...hence the name. SporeModder can decompile these files and convert them to XML and back, making them easier to edit. These files may seem intimidating at first, but they're really not that hard to understand once you know a few basic concepts.
Before proceeding though, make sure you undestand how hashes, names, and aliases work: viewtopic.php?f=177&t=6499





Here's an example XML file, which I have assembled from various sources. Note that this file is not an exact representation of what you'll find in the game itself, as I've assembled a variety of different property types in order to explain how they all work.

Code: Select all

<?xml version="1.0" encoding="utf-8"?>
<properties>
  <string16 name="description">Complete Themes for Booster Pack 1</string16>
  <key name="parent" groupid="creatureeditortemplates" instanceid="labcreaturemouthtemplate" />
  <key name="mouthtype" instanceid="SHD" />
  <float name="itemUnlockFindPercentage">0.99</float>
  <int32 name="modelRunTimeBoneCount">0</int32>
  <bool name="modelUseDummyBlocks">true</bool>
  <texts name="blockName">
    <text tableid="#4C3AB0DD" instanceid="ce_mouth_beastSentinel_01">KneeNoggin</text>
  </texts>
  <keys name="modelHandlePlacementTypesTemplate">
    <key groupid="DeformAxisLeft" instanceid="Preserveall" />
    <key groupid="DeformAxisForward" instanceid="Preserveall" />
    <key groupid="DeformAxisUp" instanceid="Preserveall" />
  </keys>
  <string8s name="modelHandleStretchSounds">
    <string8>creature_x</string8>
    <string8>creature_y</string8>
    <string8>creature_z</string8>
  </string8s>
  <vector3 name="modelRotation">
    <x>0</x>
    <y>-90</y>
    <z>0</z>
  </vector3>
  <vector4 name="palettePageBorder">
    <x>0</x>
    <y>0</y>
    <z>0</z>
    <w>0</w>
  </vector4>
</properties>
Now this may look intimidating, but by breaking it down into pieces and explaining how each one works, by the end of this thread, it will all make sense.





Alright, so the first thing to keep in mind is that all of these XML files have two lines of boilerplate at the beginning. You can copy and paste these. The beginning is as follows:

Code: Select all

<?xml version="1.0" encoding="utf-8"?>
<properties>
There's no need to understand what these signify, so just leave them as-is.





The first property in this XML file is a string16 property:

Code: Select all

<string16 name="description">Complete Themes for Booster Pack 1</string16>
A string16, as well as the syntactically identical type string8, is fairly simple: It just contains a line of text.
It has an opening tag:

Code: Select all

<string16 name="description">
The

Code: Select all

<string16 
at the start identifies the type as string16.
The

Code: Select all

name="description"
part tells the game that this property's name is "description". If the game checks for the value of a property called "description", then this property is the one it will find. Note that "description" could also be an alias or hash.
The

Code: Select all

>
after that simply signifies that the opening tag has ended an the property's value begins here.
Next, it has a value:

Code: Select all

Complete Themes for Booster Pack 1
This is the information the property contains, and this is the part you'll want to change in most cases.
Finally, it has a closing tag:

Code: Select all

</string16>
This simply tells the game that the value has ended, so it stops reading.





The next property is a key property:

Code: Select all

<key name="parent" groupid="creatureeditortemplates" instanceid="labcreaturemouthtemplate" />
These properties, unlike most, don't have separate opening and closing tags, but we can still break them down into parts, just...a bit differently.
The

Code: Select all

<key 
at the start identifies the type as key.
The

Code: Select all

name="parent" 
part tells the game that this property's name is "parent". If the game checks for the value of a property called "parent", then this property is the one it will find. Note that "parent" could also be an alias or hash.
After this, we will see up to three more segments similar to the name, but instead of name, they will include any combination of:

Code: Select all

instanceid
(think of a file name)

Code: Select all

groupid
(think of a folder name)

Code: Select all

typeid
(think of a file extension)
Finally, the

Code: Select all

 />
tells the game that the property has ended, so it stops reading.




Now we come to...another key property:

Code: Select all

<key name="mouthtype" instanceid="SHD" />
Why am I covering this again, you may ask? It's because sometimes, key properties are used in weird ways and don't actually reference a file, but an arbitrary value which is interpreted by the game's code! The syntax for the key is the same though, it's just the effects of the value that change.




The next tag is a float, or floating point value:

Code: Select all

<float name="itemUnlockFindPercentage">0.99</float>
The syntax for these is the same as for string16, but instead of text, the value is a number! This number can even have a decimal.




The next tag is an int32, or integer:

Code: Select all

<int32 name="modelRunTimeBoneCount">0</int32>
Once again, the syntax for these is the same as for string16, but instead of text, the value is a number! Unlike a float, though, ths number cannot have a decimal.




After that, we have something called a bool, or boolean:

Code: Select all

<bool name="modelUseDummyBlocks">true</bool>
A boolean value uses the same syntax as string16, but instead of text, the value can only be

Code: Select all

true
or [/code]false[/code]. Think of it like a lightswitch, where you can turn it on (true) or off (false).




After that is a texts property. Now, this property is a bit weird, as, in a sense, it contains another property. Think of it like a plural version.

Code: Select all

<texts name="blockName">
  <text tableid="#4C3AB0DD" instanceid="ce_mouth_beastSentinel_01">KneeNoggin</text>
</texts>
The first part,

Code: Select all

<texts name="blockName">
works the same way as the string16 one, so I won't explain that again.
Next, we have this entire line:

Code: Select all

<text tableid="#4C3AB0DD" instanceid="ce_mouth_beastSentinel_01">KneeNoggin</text>
It's like a hybrid of the key and string16 examples. Everything from those applies. The opening tag is as follows:

Code: Select all

<text tableid="#4C3AB0DD" instanceid="ce_mouth_beastSentinel_01">
So it's similar to a key property, but instead of instanceid, groupid, and typeid, we have

Code: Select all

tableid
(refers to a locale file, I'll document those after this)

Code: Select all

instanceid
(refers to a string in that locale file)
The next part is the value. In this case, it's "KneeNoggin". This value is only used if the tableid and instanceid are not present.
After that is the closing tag:

Code: Select all

</text>
This works just like the other closing tags we've talked about.
Since this property is plural, you can add as many lines like this:

Code: Select all

<text tableid="#4C3AB0DD" instanceid="ce_mouth_beastSentinel_01">KneeNoggin</text>
as you want, all stacked up. After the last one though, there's the ending tag for the plural property:

Code: Select all

</texts>
Again, this works just like the other closing tags we've talked about. One more thing to note about plural properties though: They can be of almost any type. Here are a few more examples:

Code: Select all

<keys name="modelHandlePlacementTypesTemplate">
  <key groupid="DeformAxisLeft" instanceid="Preserveall" />
  <key groupid="DeformAxisForward" instanceid="Preserveall" />
  <key groupid="DeformAxisUp" instanceid="Preserveall" />
</keys>

Code: Select all

<string8s name="modelHandleStretchSounds">
  <string8>creature_x</string8>
  <string8>creature_y</string8>
  <string8>creature_z</string8>
</string8s>
The idea is the same: You have the starting tag, then on the next few lines, inner properties, of the singular type which corresponds to the plural type, and then a closing tag. Note that the inner properties don't have names of their own, as the game locates them by their position within the plural property.




And now, we come to a vector3 property:

Code: Select all

<vector3 name="modelRotation">
  <x>0</x>
  <y>-90</y>
  <z>0</z>
</vector3>
These work similarly to plural properties, but instead of inner properties, they have unique inner values of x, y, and z. Think of these as 3D coordinates.
Also note that vector2 (x, y), vector4 (x, y, z, w), colorRGB (r, g, b), and colorRGBA (r, g, b, a) properties exist. The syntax is the same, just with different inner values. Here are a few examples:

Code: Select all

<vector4 name="palettePageBorder">
  <x>0</x>
  <y>0</y>
  <z>0</z>
  <w>0</w>
</vector4>

Code: Select all

<colorRGB name="consequenceTraitColor">
  <r>0.282</r>
  <g>0.733</g>
  <b>0.549</b>
</colorRGB>



Finally, one more line of boilerplate at the end:

Code: Select all

</properties>
You don't have to understand this part, just include it.




Now you know how to understand properties in Spore XML files, and with a bit of practice, you'll know this stuff like a second language!

If you have any further questions, feel free to ask.


Having trouble with the Spore ModAPI Launcher Kit? Get help here!

If you're reading this, you have my permission to build off of my mods as long as I am credited. Please don't mirror my work unaltered, unless I no longer provide a working download.
Post Reply Previous topicNext topic

Return to “Modding Documentation”