How to Make Your AI Unique: Difference between revisions

From The DarkMod Wiki
Jump to navigationJump to search
 
(28 intermediate revisions by 3 users not shown)
Line 7: Line 7:




http://www.mindplaces.com/save/proguardskin.jpg
http://www.mindplaces.com/save/generic_guard01.jpg


At the moment, not very many of The Dark Mod's AI actually have alternate skins to choose from, but things will improve slowly.
It's very easy to swap skins in Dark Radiant.


To use a different skin, you need to add the key/var "skin" "[skin name]" to the AI in the entity window.  You can browse for skins in D3ed, but existing skins will not show up in the "Matching Model" section, so you would have to scroll through the existing skins to find them (they should be under "characters") ''(look this up)''.  I don't know how this works 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 ==
== Attaching A Different Head ==
Another option is choosing a different head.  Most human AI have at least six alternate heads to choose from.  See [[Swapping Heads on AI Models]] for instructions about how to do this.
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.


http://www.mindplaces.com/save/heads5.jpg
http://www.mindplaces.com/save/citywatch_heads.jpg


Not every head looks good on every body.  Some heads are too large or too small, or have necks that don't match up very well.  Even on good heads, the necks can clip into the body in a somewhat displeasing way sometimes.  Unfortunately we can't do much about that.  Luckily it's usually only a problem when the AI looks up or turns in an odd way.
== Changing Voices ==


Be aware that not all heads have the same animations. The default D3 heads don't have lipsynching and don't close their eyes when they're KO'd, for example. So if you're choosing a head for an AI that has is an important NPC or has a scripted conversation, you may want to avoid those heads. Also, some heads come with headgear permanently attached--you wouldn't want a townsfolk walking around with a city watch helmet on.
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 ==
== 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.
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.


One easy way to add some character to your AI is to attach some kind of headgear.  There are hats, hoods, hair extensions, (like pony-tails), and oddities like eyepatches which can all give your AI a unique flavour.
What an AI wears can also be modified by attaching armour pieces, (like pauldrons), belt buckles, brooches and other jewellery.


http://www.mindplaces.com/save/hats.jpg
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.


What an AI wears can also be modified by attaching armour pieces, (like pauldrons), belt buckles, brooches and other jewellery.
See [[Attaching Props to AI]] for more information.


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.
''// 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) 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.
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 props.def.  You attach one of them by selecting the AI in the editor, and typing in the key/var "def_attach" "[prop entity name]".
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.
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.  This will be addressed as time goes on.
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===
=== Attaching 'Alternate Animation' Objects===
Line 45: Line 52:
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.
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 aniamtion 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.   
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.
There's also a sneakier way to use this system, by creating '''invisible''' entities that change the animations an AI uses.
Line 51: Line 58:
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.
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.


This system has a lot of potential, though it can't really be used effectively until more code exists to call animations (currently, though AI have a lot of animations, only the basic animations are called by the code).
== 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 [[Animation playback speed|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.)
 
 
 


== Conclusion ==
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.




[[Category:Editing]]
[[Category:Editing]]
[[Category:Tutorial]]
[[Category:Tutorial]]

Latest revision as of 15:56, 18 August 2009

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.

Skins

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.


generic_guard01.jpg

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.

citywatch_heads.jpg

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.)



Conclusion

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.