Modding:Objects

From Caves of Qud Wiki
Jump to: navigation, search
This page is about modding. See the modding overview for an abstract on modding.
This page is about modding. See the modding overview for an abstract on modding.


Object Definitions[edit | edit source]

The game's object definitions live in %game directory%\CoQ_Data\StreamingAssets\Base\ObjectBlueprints.xml.

These object definitions may be extended or replaced via an ObjectBlueprints.xml file placed in your mod's root directory, %appdata%\Caves of Qud\Mods\[your mod name]\ObjectBlueprints.xml.

If an object attribute Load="Merge" is supplied, the data will merge with any existing definition, otherwise the object definition will replace the named object entirely.

Example ObjectBlueprints.xml that merges a new color into Ctesiphus's blueprint:

<objects>
    <object Name="Ctesiphus" Load="Merge">
        <part Name="Render" ColorString="&amp;B"></part>
    </object>
</objects>

Component System[edit | edit source]

Caves of Qud's codebase uses an entity component system architectural style, which makes it relatively easy for modders to create totally new objects with only a small XML snippet, simply by combining existing components from other game objects. Components are generally referred to as "parts" in Caves of Qud's XML files. For example, you might combine a LiquidVolume part with a MeleeWeapon part to create a weapon that holds liquid.

For a more thorough introduction to the component system used to define objects in Caves of Qud, check out this introductory presentation by CoQ developer Brian Bucklew from IRDC 2015:

Supported XML Tags and Functions[edit | edit source]

Each <object> in the ObjectBlueprints.xml file supports the following child XML tags:

XML Tag Description
<part> Indicates that this object should load the part with the specified name. A parts is any C# class that inherits IPart.
You don't need to know how to code to add a part though, there are a lot of useful parts already available in the base game that you can steal from other objects.
<removepart> Removes a part that is defined on or inherited by the object
<mutation> If an existing mutation is redefined, the game merges the new attributes you define with existing attributes on the mutation, overwriting them if they already exist.
<builder>
<skill> If an existing skill is redefined, the game merges the new attributes you define with existing attributes on the mutation, overwriting them if they already exist.
<inventoryobject>
<stat>
<property>
<intproperty>
<xtag>
<tag> The code includes a method to remove an existing tag, by redefining it with Value="*delete". However, this appears to currently be broken because it does not work in combination with Load="Merge" or on inherited tags.
<stag>

Adding the object to encounters[edit | edit source]

Once you've created your item, check out this page for information on how to introduce it to dynamic encounters: Encounter and Population Modding

Detailed Topics[edit | edit source]