How to Make Your AI Unique

From The DarkMod Wiki
Jump to navigationJump to search

written by Springheel

Running into clones of the same AI over and over again can ruin the illusion of being in a realistic environment. Beyond that, it's just plain boring. Luckily, there are some fairly easy ways to make your AI look a little different from each other.


An easy--and quite effective--way to make your AI quite different from each other is to use an alternate skin. A skin is basically a different texture from the default. It could be as simple as changing the colour of an AI's tunic from blue to green, or a totally new texture that changes the clothing entirely (though obviously the basic shape of the model remains the same). See Creating Multiple Skins For A Model for more information on how this process works.


It's very easy to swap skins in Dark Radiant.

1. First, type a dummy spawnarg into the AI entity window: "skin" "x" (it doesn't matter what the second variable is. "x" will do.

2. Then click on the "skin" line in the list of properties.

3. A "choose skin" button will appear. Click it.

4. A new window will open. Select "Matching Skins" and then choose the skin you want. You can preview it in the right hand window. If there is no "Matching Skins" option, then the AI does not have skins available (most AI do).

Attaching A Different Head

Another option is choosing a different head. There are well over fifty heads (as of the release of 1.0) to choose from. See Heads Available for AI for more details and for images of all available heads.


Changing Voices

There are various different voices available and you can choose which one an individual AI uses. Making an AI use a different voice can easily make him stand out. See Voices for more information and examples.

Def_Attaching Prop Items

Another way to add more variety to your AI is to attach different objects to them. With a little creativity, you can get some surprising variation by attaching different models.

What an AI wears can also be modified by attaching armour pieces, (like pauldrons), belt buckles, brooches and other jewellery.

Finally, AI can be carrying numerous things on their belt to add a little character. Game objects like weapons, purses, keys, or potions are obvious choices, but other objects like a spoon, a coil of rope, or a workman's hammer can also be used.

See Attaching Props to AI for more information.

// the information below does not take the new attachment positions into account and needs to be updated

In order to be attached to an AI, an object needs to have an entity definition that sets what 'joint' it should be attached to (head, spine, etc. see next section) and how it should be positioned and rotated relative to that joint. The object will move with the joint it is attached to, so if you attach something to the head joint, it will move whenever the AI moves its head.

Currently, all our 'attachable' entities (with the possible exception of weapons--check that) are found in tdm_prop_wearable_items.def and tdm_prop_items.def. You attach one of them by selecting the AI in the editor, and typing in the key/var "def_attach" "[prop entity name]". If you want to attach something that doesn't already have a 'prop' entity, then you'll need to make one. See Making 'Prop' Entities.

Note that an attached object will not show up in the editor. You have to run the game in order to see it.

Prop objects can be 'tweaked' for each AI (the values that position a key perfectly on the belt of one model may be too low for another) but most are currently only set for a single AI. See Adding Offset Values for Specific AI for more info. This will be improved as time goes on.

Attaching 'Alternate Animation' Objects

Some attached objects change the way your character moves. For example, if you attach a torch to your AI's hand, then the AI will play the 'carrying torch' animations, which keep his hand stuck out in front of him. See Overriding animations via attached objects for more information on how this works.

There are lots of ways to use this to make AI more interesting. AI can carry lots of regular things in their hands and use the 'carry torch' animation--candles, cups, brooms, etc. You could also create unique animation replacements, like attaching a wine bottle to a guard, and replacing the regular attack animations with the 'blind' attack animations to make him swing wildly when attacking (as if drunk).

There's also a sneakier way to use this system, by creating invisible entities that change the animations an AI uses.

For example, you could attach an entity that has no visual model, but causes the AI to replace the normal walk animation with a 'limp' animation. Or you could attach an invisible entity that makes an AI shake his fist whenever he senses someone around (replacing 'alert' animation with 'shaking fist' animation), etc. Or more simply, you could just choose an alternate walk cycle so two similar AI don't walk identically.

Making AI move faster or slower

You can tweak the speed of individual animations that are played by an AI; for example, to subtly increase or decrease a particular AI's walk speed, or their attack speed, or the speed at which they turn their head when looking around. See changing the animation playback speed for details.

Changing the speed of an AI has gameplay implications, however, so use with caution.

Extra note: To make an AI run on patrol add the property/value : run 1 to a path_corner on the AI's patrol and the AI will run to it (then resume walking after it if the next path_corner does not have that property set.)


Combining these effects can make your AI look like totally different models, allowing all kinds of variety. Imagine a skin with a no-draw texture on an AI's leg, and then attaching a wooden torch as a peg-leg (with a 'limping' animation)? There are all kinds of creative possibilities if you want to experiment.