Version 4 (modified by historic_bruno, 12 years ago) ( diff )

--

Actors are the graphical representations of objects in the game. They combine meshes, textures, animations and props, and also control some other graphical features (such as whether the objects casts shadows or has transparent textures - see MaterialSystem).

Actor data is stored in XML files, which can be edited by hand, but usually the Actor Editor is used instead. Actor XML files are located in subdirectories of art\actors\ for a given mod (see mod layout).

Terminology

  • Variant: a named collection of data items, specifying the actor's texture, animations, etc (or any subset of those data). Shown in the Actor Editor as a single row.
  • Group: a set of variants; represented in the Actor Editor by a block of rows, separated from other groups by blank rows.
  • Choice: a variant from a group, which has been chosen to be used on the actor. Choices are often made randomly, and combine to form:
  • Variation: a set of choices, one from each group, making up a particular version of the actor.
  • Selection: a text string that usually matches a variant name; the chosen variation will use variants which match one of the selections, where possible.

Randomness

To allow some visual variety between otherwise-identical units, actors can contain 'random' elements. (They are not strictly random - a designer can choose a particular variation of the actor.)

To achieve this, the actor is split into a set of groups, each of which contains several variants.

The frequency of each variant controls how likely it is to be chosen. If two variants have equal frequency values, they have equal chance of being selected. If a variant's frequency is set to 0, it will never be chosen by the randomiser. A zero-frequency variant can still be selected by the game - for example, actors could have 'Summer' and 'Winter' variants, with the default always being Summer, and then the game could change the whole world to Winter.

For example here is how an actor might appear in actor editor:

Example of actor editor UI

This female citizen has 3 groups: one with a single variant called "Base", a second with variants for model and texture, and a third group for prop variants.

  • In the first group, the "Base" variant will always be chosen as there is no other variant and its frequency is 1. This variant defines props and animations common to all the other groups. Note that a prop is also an actor and may be randomized in its own file, as in this case. We only need to reference a single "dudette_head" prop actor which can vary in texture, shape, and other qualities.
  • The second group contains different body models and textures. This flexibility means we can have a single mesh with altered appearance due to random texture variants. In this example, "Dress-Chiton" has the greatest chance of being chosen and is 3x as likely to be chosen as "Dress-linen".
  • The last group contains prop variants which differ based on the actor's current behavior. If the female is idle, her hands will be empty; if she's woodcutting, she will have an axe in her left hand, etc. She will be idle by default, since that's the only variant in this group with a non-zero frequency. The game's logic will select other variants when appropriate.

Actor XML format

The following is an example of version 1 of the actor XML (edited for clarity).

<?xml version="1.0" encoding="utf-8"?>
<actor version="1">
  <castshadow/>
  <group>
    <variant frequency="100" name="Base">
      <animations>
        <animation file="biped/inf_sword_ready_a.dae" name="Idle" speed="100"/>
        ...
        <animation file="biped/walk_spearshield.psa" name="Walk" speed="120"/>
        <animation file="biped/walk_spearshield.psa" name="Walk" speed="111"/>
        ...
      </animations>
      <mesh>skeletal/m_tunic_short.dae</mesh>
      <props>
        <prop actor="props/units/heads/head_hele_b.xml" attachpoint="head"/>
        <prop actor="props/units/shields/rome_parma_b.xml" attachpoint="shield"/>
        ...
      </props>
      <texture>skeletal/rome_ijv_b.png</texture>
    </variant>
  </group>
  <group>
    <variant frequency="100" name="Idle"/>
    <variant name="Melee">
      <props>
        <prop actor="props/units/weapons/verutum_reverse.xml" attachpoint="loaded-r_hand"/>
        <prop actor="props/units/weapons/verutum.xml" attachpoint="projectile"/>
        <prop actor="" attachpoint="r_hand"/>
      </props>
    </variant>
    <variant name="gather_tree">
      ...
    </variant>
    ...
  </group>
  <material>player_trans.xml</material>
</actor>

Attachments (1)

Download all attachments as: .zip

Note: See TracWiki for help on using the wiki.