Using ModelEdit to Create Characters and Weapons for

The LithTech(tm) Development System is copyright 1998-2000 by LithTech, Inc., Kirkland, Washington, U.S.A. All rights reserved.
Aliens vs. Predator 2 is copyright (c)2000 by Twentieth Century Fox Film Corporation. All rights reserved.

 

ModelEdit is the tool used by the Aliens vs. Predator 2 team to integrate models into the game. This guide covers the most frequently used and important features of ModelEdit. The ModelEdit UI is made up of several panels. The largest panel is the Model View panel, which previews the model mesh and its animations. Below this are the CD player-style buttons for controlling the animation. The Nodes panel lists the model's skeletal nodes. The Pieces panel displays all of the individual meshes that make up the current model. The Animations panel lists all animations that are loaded into the current model. The Child Models panel lists the sub-animations files that are loaded. An animation that comes from a child model cannot be edited and will have an empty box next to its name in the list. An animation that is part of the file you are looking at will have a check mark beside its name. The Sockets panel lists the model's sockets. All these panels are discussed in this document.

Use the Level of Detail (LOD)slider to select the level of detail you want to view. Use the Animation Edit control to manipulate animation data. Use the Transform Edit control to manipulate socket or node positions.

At the bottom of the display is the animation Time Bar. The Time Bar has a red mark for every key frame. Frame Strings are a way to tie an event or message to a keyframe so that it will be available to the game programmer. For example, if your character has a swiping claw attack, you could hook a message onto their swipe animation so that each time they swipe at you, a "whipping claw" sound plays.

Level of Detail (LOD)

One of the best ways to optimize the rendering of models is to draw fewer of the model's polygons where appropriate. ModelEdit has a tool to create multiple levels of detail dependent upon a distance value. At lower levels of detail, ModelEdit creates a version of the model that uses fewer polygons to draw the same object. The game engine will take the distance from the rendering camera whether-that is the player's point of view or a cut scene camera-to the object seen and use the triangulation set for that distance.

To open the LOD creation dialog, in the Model menu, choose the Build LODs option. The Level of Detail Generation dialog, similar to the following, appears.

To create a new LOD point for the model, click the Add LOD button and then enter information in the LOD Edit dialog:

In this dialog, specify the LOD by distance and the percentage of model triangles to keep. The distance is the threshold for the LOD being created. In the game when the view camera is that distance from the object, the new detail level (the lower-polygon mesh) is used to render the model. The LOD operation affects the whole model, but the user can change how LOD affects different pieces of the model. Artists can make some important pieces stay detailed while other parts of the model become lower resolution.

To differentiate the pieces for the LOD operation, pick a piece from the Piece Weights list and enter a value greater than one into the Piece Weights value box. The value represents the LOD priority for that piece. The larger the number, the later the piece will have LOD operations done on it. For example, if the value of one piece is three, it will take three vertex collapses before that piece's triangles start to collapse. This is useful for objects like heads or shields, where a small loss in detail can be very noticeable.

            LOD 0                           Reduced Triangle LOD

The images above are the result of an LOD operation. The image on the left (LOD 0) is the base model; the image on the right is the reduced triangle model. In the game, the renderer will automatically switch to the next LOD level when the distance associated with the LOD level has been reached.

Animations

Animations are part of the model's database. There are two methods for bringing new animation into a model. The first method adds it directly to the model's own data, and the second adds it by reference. A referenced animation's data is not included in the model file. Instead, the model file refers to another file that contains the actual animation data. This is useful when several models are going to share the same set of animations. All animations that are added must have the same hierarchy as the model being worked on. ModelEdit will signal an error when there is a hierarchy mismatch.

To add an animation directly, go to the File menu and select Import. A file dialog appears with check boxes at the bottom listing the import options. Select Animations and select the file you wish to load. The animation names appear in the animation list box when loading is done. You may want to do this if you know that no other models will need the animation. For example, an octopus's animation is only ever needed by the octopus model.

To add an animation by reference, in the Child Model menu select Add Child Model. Browse for the model or models you would like to load. ModelEdit checks the .abc file to see if the two models' hierarchies are the same, and then the animations will be available within ModelEdit. When the model is saved, a reference to that file is stored in the model data.

Editing Animations

Below the Model View panel, there are CD player-style buttons that control animation playback. Below that is the animation bar. The red vertical lines are key frames. The four buttons in the Animation Edit area manipulate the ordering of the animations in the Animations list box. The red X button deletes the animation from the model. The # button renumbers the currently selected animation, and the arrows move the animation up and down in the list box. The other two choices, User Dimensions and Translation, work in conjunction with the six thumbwheel buttons below to adjust either the size of the bounding box of the animation or the base position of the animation.

Note: To see the User Dimensions, in the Options menu select Show User Dimensions. Currently you cannot change the User Dimensions for child model animations.

In the Frame String text box, you can associate an arbitrary text string with each key frame in an animation. Use this association to indicate to the game code that a certain event has happened. This is most often used to associate a sound with an event. For example, you could associate footsteps with a "foot down" frame, gunshots with a model's "fire" frame, or a body hitting the floor with the last frames of a death animation. To add a Frame String, select a key frame by clicking on it and then type a word in the Frame String text field. When the animation runs, the frame string is sent to the game code as the tagged key frame passes.

Animation Blending and Weighting

The LithTech animation system supports two kinds of animation blending operations, consecutive and concurrent. The engine automatically blends between all consecutive animations. Additionally, you can create a custom blend between two concurrent animations using Animation Blending Weights.

Consecutive Animation BlendingLithTech blends consecutive animations together by default. At the end of one animation the engine interpolates to the next animation in 200 milliseconds. This value can be changed per animation in ModelEdit.

Concurrent Weighted Animation Blending Use ModelEdit to blend from two to four animations concurrently by specifying Weighted Animation Blending values for nodes in the animations. When the game programmer sets up concurrent animations for the models in the game code, the Weighted Animation Blending can be swapped dynamically to produce new custom animations from existing animations.

Using Weighted Animation Blending

To specify Weighted Animation Blending, open the ModelEdit Model menu and select Edit Weighted Animation Blending. The Weighted Animation Blending dialog box displays the available weight sets, a list of the model's nodes, and buttons to add or remove weight sets. Under the Nodes list is a Current Node Weight text box showing the value of the currently selected nodes. All nodes belong to the weight sets, and for each weight set the nodes can be weighted differently. For example, an upperbody weight set might have all the nodes belonging to the hips and above set to have a weight of one, while the nodes in a lowerbody weight set would have all the node's weights below the hips set to one and all the nodes above the hip node set to zero.

Creating a Weight Set

1.       In the Model menu, select the Edit Weighted Animation Blending option.

2.       In the Weighted Animation Blending dialog box, click Add Set.

3.       In the New Weight Set dialog box, type a name for the new weight set you are creating and then click OK.

4.       In the Weighted Animation Blending dialog box, select the new weight set you created.

5.       In the Nodes list, select one or more nodes and then enter a new value in the Current Node Weight text box.

6.       When you finish assigning weights to the nodes for the weight set, click Close.


Creating a Weighted Animation Blending

1.       In the Animations list, click to select the first animation. Notice that the selected animation appears in the Animation Keyframes area.

2.       Press and hold CTRL while you select a second animation. The second animation appears in the Animation Keyframes area, below the first animation.

3.       In the Animation Keyframes area, click the button that displays the name of the first animation.

4.       In the Select Animation Blending Weight Set dialog box, click the name of the weight set you created and then click OK.

5.       Repeat steps 3 and 4 for each animation.

6.       Click the Play button to see the results of your Weighted Animation Blending.

The order in which the animations are selected makes a difference. The animations linearly interpolate (LERP) per frame from the first to the next using the node's weight value. The formula is the resulting animation equals the first animation plus the difference between the first and the second animation times the second animation's weight value.

RES = FIRST + ((SECOND - FIRST) * SECOND's WEIGHT)

Be aware that when you blend more than two animations, this algorithm is recursive: the result from the previous evaluation becomes the FIRST value, and the SECOND parameter is the next animation in the list that has yet to be evaluated. For example, LERP (LERP (first, second, second-weight), third, third-weight) and so on.

The value of weight can be any numerical value. Typically, you will use values between 0 and 1 since 0 means no change and 1 gives full value to the second node.

If the weight set value is 2, the algorithm will simply add the two animations together. This can also be used to great effect. Generally the added animation should just modify the first, a walk and a run added together would result in a very strange animation.

To add concurrent animations to a model in game code use ILTModel::AddTracker. Be sure there is an Anim Blending Weight set associated with the second animation added in this fashion.

Because of the nature of the algorithm, getting things to look the way you want could be tricky, so as you experiment with various animations, try to make concurrent animations as similar to each other as possible. For example if you want to accentuate a walk, make sure the foot plants occur on the same key frame. If you are doing upper-lower body animations, have the weights at the fusion points ramp from one animation weight set to the other. With enough experimentation, you will develop good intuition as to what works.

Sockets

Sockets are places in models where you can add attachments. Attachments are sub-models that do not deform with the main model. Also, attachments can be changed dynamically in the game. Usually attachments are guns, hats, and sometimes even armor pieces. The socket or attachment sites are normal transformations that are manipulated in the Transform Edit control or from the Sockets list.

To add a socket, from the nodes list pick a node where you want to create a socket. In the Sockets menu, select Add Socket. A socket will appear in the Sockets list. Double-click its name to open the Socket Properties dialog.

You can either browse for or type the name of the .abc file to add as an attachment. You can also change the socket's name, or explicitly change its position and orientation. The attachment .abc file will be kept in the model's data as a reference that can be changed during the game. This allows you to switch models on a socket while the game is going. For example, if a player picks up new power-ups, armor, or even clothing, you can add to it and modify it during the game.

Child Model

Child Model is a term we use to describe animations that are shared across multiple models. A child model is a reference to another data file that contains animations to be used. The only constraint to this construct is that the child model's skeleton has to be organized exactly like the skeleton of the currently loaded model. ModelEdit will signify that an error has occurred if the child model skeleton is not the same as the base model.

Creating Models

This is broad overview of modeling for LithTech. This chapter will cover model creation as it pertains to LithTech in a very abstract term.

Creating models for LithTech is conceptually pretty straightforward: First, use a modeling package to create a polygonal mesh model and "skin" it over a bone hierarchy. Skinning involves weighting each vertex of the mesh to one or more bones. Afterwards, select a texture for the model, apply UV texture coordinates to it, and animate its bones. The resulting model is ready to export.

The geometric center of the model should be at the origin. For human character models, for example, this would be the pelvis. The model can be made up of one or more meshes. Generally, splitting up models helps make UV mapping easier and can create reusable parts such as hands, feet and so on. The UV mapping of a model has to be done in the modeling package.

All textures in LithTech are 32-bit by default and their size must be a power of 2.

Textures and material values are not explicitly assigned in the modeler, except for UVW Mapping. LithTech uses a special mesh naming convention to associate a texture index to a mesh in the engine. This index will later be used in either game code or DEdit to assign a texture name to the models. The mesh name should take the form meshname_zTex#. The "#" represents the texture index and "_zTex" is the key that must be in the name. For example, a piece named "lower_body_zTex0" will be assigned texture map index 0, while "head_zTex1" will have index 1. Texture indexes correspond to the indexes on your model's different meshes. This way, the game programmer or the level designer controls explicit texture assignment for each mesh in a model. For the current release, there can be only two texture maps per model.

All surface material properties defined in the modeling package are ignored in the exporter. Vertex colors, lighting etc are lost in the conversion, except for UVW Mapping.

Use DEdit to convert images into the DTX format required for the game. DEdit can understand and import .PCX or .TGA files. The advantage to using a .TGA file is that since Targa files have a built-in alpha channel, DEdit can automatically generate an alpha mask for the texture without the need to import a second file as your alpha mask. .PCX files require a second file for their alpha mask, adding a second step and a second file to keep track of.

If you want models to share animations, then all models sharing a set of animations should have the exact same hierarchy. This is very important. Differently organized hierarchies cannot share animations. The skeleton offsets should be similar, but do not have to be exact. There are problems using animation from a short character on a tall character, but most things like walks, runs, and general hand movement work fine. The biggest problem is two characters with different shoulder/arm proportions sharing an animation that requires using two hands together, like holding a rifle, or even something like clapping hands. This will almost never work right, but LithTech supports overriding a shared animation on a per-character basis, so it can be worked around. Remember that you cannot scale bones.

An important concept to remember about the .abc file format is that it is a database that contains the model's geometry, bone hierarchy, level of detail information, and mode. The model database can refer to other files, especially if many models share the same set of animations.

All of the models in AVP2 were created to be exported from Softimage 3.7 and 3.9 using our Softimage exporter.

ModelEdit UI Reference

File Menu

Open: Opens a model (.ABC)

Import: Reads data from a model (.abc) into the current open model, such as new animations.

Save: Saves the model

Save As: Saves the model under a different filename

Exit: Quits ModelEdit

Model Menu

Model Info: Shows information about the model such as the amount of memory it uses and the number of triangles it contains.

Command String: Allows control over attributes of the model; See below for details.

Build LOD: Generates LOD information

Rename Node: Renames a node

Generate Vertex Normals: Recalculates the vertex normals based on neighboring polygons

Remove Node: Deletes the selected node

Set Texture: Changes the texture to be displayed on the model in the display window

Set Internal Radius: Sets the radius of the visibility-culling sphere.

Calc Internal Radius: Automatically sets internal radius based on all the animations used by the model. (Use this instead of 'Set Internal Radius for greater accuracy.)

Edit Weights: Dialog creating weight sets of nodes for animation blending.

Animation Menu

Rename: Renames the selected animation

Duplicate: Makes a copy of the selected animation

Dimensions: Changes the dimensions of the selected animation

Reverse: Reverses the time direction of the selected animation

Make Continuous: Causes the selected animation to loop. This adds a length of time at the end of an animation so that it can interpolate back to the first keyframe.

Set Animation Rate: Changes the overall frame rate of the selected animation (or all animations) This does not directly set the animation's frame rate, but instead sets the number of stored keyframes per second. The engine then linearly interpolates to fill in the gaps.

Set Animation Length: Scales the length of the entire animation, making it faster or slower.

Set Animation Interpolation: Creates a dialog to set the interpolation time (in micro seconds) between two animations.

Create Single Frame: Creates a single-frame animation containing the current frame

Translation: Adds a translation to the selected animation

Rotate: Rotates the selected animation

Child Model Menu

Add Child Model: Adds a new child model. Any .abc file with an identical hierarchy to the current model can be used as its child model.

Remove Child Model: Removes the selected child model

Sockets Menu

Sockets are transforms for attachments.

Add Socket: Adds a new socket

Remove Socket: Removes the selected socket

Rename Socket: Renames the selected socket

Piece Menu

Piece Info: Changes material attributes of the piece. The texture index can be changed and the specular attributes of the piece. The specular power represents the size of the reflected light on the surface of the model. The larger the power the larger the light source. The scale attributes represent how matte the surface is. With a value close 0.5 the surface will not reflect very well, but with a value of 1.0 the surface will look very smooth and shiny. ModelEdit will not show the specular highlight, only the engine will.

Merge Pieces: Select a group of pieces in the piece window and use this to combine them into one piece, based on texture map. If you select all the pieces, the result will be 1 piece for each texture map the model uses. Due to some bugs, don't use this on models with LODs. This is mostly very useful for prop objects, which contain lots of pieces.

Options Menu

Lights Follow Camera: When toggled, the red/blue lights move along with the camera

Wireframe: Toggles wireframe rendering mode

Show User Dimensions: Draws a box that shows the size of the selected animation's dimensions graphically. User dimensions define the bounding shape around models for physics.

Show Internal Dimensions: Draws a box the size of the model's dimensions. The internal dimensions are used to determine the clipping state of a model. *The internal dimensions should always contain all of the model geometry as efficiently as possible.

Show Skeleton: Draws the location of the nodes in the model

Show Sockets: Draws the position and orientation of the sockets

Show Attachments: Draws the attached models in relation to their socket (See Command String/SocketModel)

Solid Attachments: Toggles Solid/wireframe mode for any attached models

Show Normals: Draws the vertex normals

Show NormalRef: If supported by the model, displays the vertex normal frame of reference

Profile: Shows performance information in the draw window

New Background Color: Change the color of the model view window.

Change Field of View: Change the camera angle in the model view window.

Model View Window

Mouse motion changes the camera position.

Left mouse rotates the camera around the model.

Right mouse dollies the camera in and out.

Right and left mouse combined pans the camera.

Shift left mouse restores the view.

The Animation Bar

Click to move to the nearest key frame, represented by red lines. Double-click to tag a key frame. Right-click on a frame to see a context menu for the frame.

 

Frame Time: Allows skipping to a given time in the animation

Frame String: Assigns a control string to the specified time in the animation

LOD slider: Changes the displayed LOD of the model

Animation Edit

User Dimensions radio button: When selected, the +/- buttons control the size of the animation's dimensions

Translation radio button: When selected, the +/- buttons control the translation of the animation

X Deletes the animation

# Moves the animation to an index in the list

Up arrow: Moves the animation up in the list

Down arrow: Moves the animation down in the list

Transform Edit

Global: Toggles whether adjustments are node-relative or global

Socket: Specifies that sockets will be adjusted by the adjustment color boxes

Relation: Specifies that nodes will be adjusted

Rotation:Click on the color (Red = X, Green = Y, Blue = Z) and drag left/right to rotate around that axis

Translation:Click on the color and drag left/right to move along that axis

Nodes

If a node name has a check in its check box, the node will be placed relative to its parent, only the rotation will be used from the animation data. Not checking these where needed will cause bone lengths to be transferred from a child model to the parent, causing potentially strange looking scaling of a character

Animations

A checkbox here indicates that an animation is from this model and may therefore be changed/moved/etc.

Command String

The command string is a semicolon-delimited string defining the extra control settings for a model in ModelEdit, the engine, and in the final game. Most commands are game specific.

 

These are commands not ignored by ModelEdit:

Note: A model containing SocketModel directives will cause the attachment model filenames to be stored in the Windows registry, to avoid requiring every model to redefine common attachments.

ModelEditTexture:Specifies a texture filename to use for a texture channel. The command is specified in the form ModelEditTexture Channel Filename. (e.g. ModelEditTexture 0 C:\models\textures\player.dtx)

Setting up a Character

The steps below will walk through the character creation process for Aliens vs. Predator 2. All the characters in AVP2 were created in Softimage. This is the only package for which we have a reliable AVP2 exporter.

  1. All the human characters in AVP2 have the same skeletal hierarchy. This allows animations to be universally shared. Another guideline for sharing animations is to keep their height within a range of about 15%. Having extra tall or short characters will cause strange floating when using a shared animation.
  2. If exporters become available for other animation/modeling packages, the exported skeleton will still need to match the existing AVP2 skeleton in order to share animations. This will require some trial and error experimentation.
  3. If you'd rather use a different skeleton (like for a ponytail...) then you will need to redo all of the animations used by that character.
  4. All characters used in AVP2 were modeled using 1000-1500 triangles.
  5. All texture mapping for AVP2 was done in Softimage. Each character uses two to four texture maps: a 256x256 map for the body and a 128x128 one for the head. These should be saved as 32 bit .tga files. They are converted in DEdit to .dtx files by going to the textures tab and importing the .tga files to AvP2/skins/characters/...
  6. Any piece of model geometry that uses the head texture should be named with the extension '_zTex1', for example head_zTex1. If you don't do this, the head will default to the body texture.
  7. When the skeleton is set up, use a node called 'Eyelid' to control vertices that allow blinking. It is important to name this bone correctly since the game code uses this node to tell what a character is looking at.
  8. Any model that is going to use the AVP2 AI needs to be named in the same form as the characters that shipped with AVP2, such as drone.abc. There is no comprehensive list of appropriate character names, but looking at the file /AvP2/attributes/modelbutes.txt should point you in the right direction.
  9. Textures should be named in the same form as the models. Head textures need the extension '_head', for example, drone_head.dtx.
  10. In addition, DEdit contains a 'body skin extension' and 'head skin extension' that allows any extension to be added to the body name or replace '_head' in the head name.
  11. Characters should be exported to the folder AvP2/models/characters.
  12. After exporting a character, ModelEdit must be used to add several attributes including sockets, weight sets, LODs, user dims, and internal dims. Most of these can be imported from within. Just select File, then Import and select a similar character file, and then check the items you want to import.
  13. Each file must contain 2 animations that determine the models bounding boxes for hit detection. Dims_Default is the standing dimensions and Dims_Crouch is for the crouching dimensions. The X & Z dimensions must be the same and must allow for passage through most openings in a level. For example most characters Dim_Default dimensions are X=15, Y=52, Z=15. The actual dims are double these values. Not setting dims results in a very long bounding box that will remind you that you didn't set them. All animations that come from a child model will use the dims from the child model.

14.   There are specific sockets which AVP2 looks for that appear on all the AVP2 characters. The best way to figure these out is to look at an existing character. The way they are named is self-explanatory. To create an individual socket, select the desired node and go to sockets>Add Socket. Name it so you know what it is.

  1. Sockets are used to place attachments (such as guns, helmets, etc...) on characters. Select Options>Show Attachments and >Show Attachments. A multi colored axis will appear at each socket location. Double click on a socket name in the sockets window (like "right hand"). Browse to the location of attachment abc file and open it. Adjust its position and rotation using the colored buttons in the Transform Edit box, making sure 'socket' is selected first. Any model can be used as an attachment.
  2. AVP2 characters use a lot of weight sets to allow morphing animations for up and down aims with guns and also for blending upper and lower body animations. These can be created individually, but it's a lot easier to just import them from an existing character. If you change skeletons, these will not import properly and will need to be created from scratch.
  3. Most AVP2 characters have 4 levels of detail (LODs). These can often be imported from existing characters, but only from a character that has the same number of pieces. If your new character has more or less pieces than any of the existing AVP2 characters, you can still look at the LOD values of the existing characters and manually copy the values onto the new character.
  4. In Model>Command String, Click the ShadowEnable checkbox. Enter Right_armu_shoulder_node in the first Normal Reference box, and Dims_Default in the second. This defines a source from which the model will be lit by model lights.
  5. Another thing that must usually be done is to turn off the translation information from child models on most of the bones. This is done by checking the box next to each node name in the nodes window, except the first three. The top three should be left blank, since this is where all the translation takes place. Not doing this may result in strangely stretched or squished characters.

20.   All of the above steps are valid for both single and multi player characters. However, multiplayer characters use different animations than the single player ones and thus must be duplicated at this point. Place the copy in /Avp2/Models/Characters/MP. The child model animations are in this directory already.

  1. After adding these animations, the internal radius must be set, and is most easily done by going to Model>Calc Internal Radius. This is a rendering optimization that must be done.
  2. Any animation that is used by game code can be overridden by adding a '*' sign to the beginning of the animation name. Any animation that is named with some obscure code probably falls into this category. Some animations are scripted (called by the level designer rather than the program) and cannot be overridden, but must be either renamed or replaced on the desired character. An example of an override animation is on Femalelabtech.abc, where there is an override for the walk forward animation called *WF_PS1.

23.   Any model can be used as an attachment, but they cannot be animated themselves without specifically being called by the game code. To use an attachment in the game, update the file AvP2/attributes/attachments.txt. Copy and paste any attachment section to the end of the attachment list. Change the number and name to be appropriate for your new attachment. Also change the file paths to point to your attachment file and texture. These can be named however you want, and it's best to keep them in the /Avp2/Models/Attachments and skins/ folder. The attachment must now be added to the character in DEdit.

  1. All AVP2 guns go in the RightHand socket. All hats go on the Helmet socket.

25.   Frame strings are added to provide animation based cues to the game code. For characters, the ones used are 'bute_sounds' for death sounds, 'FOOTSTEP_KEY' for footsteps. These are entered by going to the frame of animation where the incident occurs and typing the appropriate string in the Frame String box. These should usually be placed on the child models when possible so many characters can use them.

  1. The simple animation editing features of ModelEdit can only be used on animations which are native to a model (not from a child model) and are pretty effectively described in the documentation below, with a couple of clarifications.
  2. Use Animation>Set Animation Length to speed up or slow down an animation.
  3. Use Animation>Set Animation Rate to get rid of frames in a really dense animation. This is mostly useful when dealing with motion capture which is at 30 frames/sec. Most animations look fine at 8-10 frames/sec using the linear interpolation of the engine.
  4. Animation>Make Continuous is an easy way to get good cycling animations in some cases. Select an animation and delete the last couple of frames making a note of how much time is being cut by doing this. Then go to Make Continuous and enter the time that was noted above. This may need to be tweaked a little, but on animations that don't have a lot of action, usually this will give a good cycle.

Setting up a Player View (PV) Weapon

The player view (PV) hands, guns and vehicles for Aliens vs. Predator were modeled, UV textured and animated in Softimage. Each weapon PV model was exported from Softimage to an .abc file and could then be opened in ModelEdit for final additions needed for the game code as well as tweaks to the animations. The final thing needed to get player view weapons to work properly in the game are the attributes for the weapons that are outlined in the weapons.txt and the effects defined in the fx.txt.

Modeling

The PV weapon models in AVP2 are somewhere between 1400 - 1800 triangles including the hand models.

Texturing

Each PV weapon has two or more textures associated with it:

1.       For the marines, the textures used for the hands is mHands_White.dtx

2.       The weapons.txt directs the game to the appropriate texture for the hand and weapon texture.

For example      PVSkins0 = "Skins/Weapons/Marine/mknife_pv.dtx"

PVSkins1 = "Skins/Weapons/Marine/mhands_%s_pv.dtx"

3.       Each texture is 256x256. These should be saved as 32 bit .tga files and converted in DEdit to .dtx files by going to the textures tab and importing the tga files to AvP2/Skins/Weapons/(SPECIES) where (SPECIES) = Marine, Predator or Alien.

Chrome/environment mapping can be used on the texture using the alpha channel. In Dedit, in AvP2/Skins/Weapons/, double click on the texture and a new window will appear. Under Texture Format, check off Use 4444 in 16 bit mode. Darker values will use more chrome.

Animating

The exporters will keep the translation and rotation information but not the scaling. It is a good idea to keyframe at least one piece or null object for every frame of the entire animation because fcurve information is not something retained when exporting (the engine will interpolate between keyframes linearly) and the exporter will only export a key for every keyframe in the scene.

·         Note: Some parts of the animations, such as the character or vehicle turning is implemented in the game code.

Exporting

In order for all of the geometry to be exported properly, all the pieces of the model and skeleton need to be part of the same hierarchy. Models should be exported to the folder Avp2/Models/Weapons/(SPECIES).

Animation Naming

The animations for the weapons need to be very specific for the weapons to function properly in the game. Here is a list of the animation names and when this animation plays in the game:

 

·         Idle0: Idle animation played when the object is not being selected, deselected or interacted with in any way. (all AVP2 weapons had Idle1 and Idle2 animations as well which would play sporadically when idling.)

·         Select: the animation played when an pv object is selected    

·         Fire0: the firing animation. Fire1 and Fire2 are alternate animations that will play at random if they are part of the .abc file

·         Deselect: the deselecting animation when putting away a gun/weapon/vehicle or switching to another

·         Reload: the animation played when a weapon or gadget has run out of ammo or when the reload key is hit

 

Those are the most basic animations that would be required. For more complicated items that have two states, such as the PulseRifle in AVP2, these additional animations are required:

 

·         AltFire: the fire animation used in the alternate state of the weapon

·         Fire0_Start: the starting state for a looping animation like in the minigun’s firing

·         Fire0_End: the ending state for a looping animation like in the minigun’s firing

 

 

Using ModelEdit with PV Items

After you export a PV weapon/gadget/vehicle, use ModelEdit to add attributes, such as user dims, internal dims, sockets, command strings, and frame strings.

User Dims

User dims for all weapons in AVP2 are the same: X: 3.0, Y: 3.0, Z: 3.0. Because the models are so small, these dimensions do not need to be exact but not setting dims results in a very long bounding box that will remind you that you didn't set them.

Internal Dims

The internal radius must be set, and is most easily done using the Model menu Calc Internal Radius command. This is a rendering optimization that must be done.

Sockets

Sockets are used to place muzzle flashes on weapons. The socket needs to be named Flash.

Command Strings

Most of the PV models use two command strings to set the model FOV and to set how model lights will light the model that are placed in DEdit. An example would be the ShoulderCannon which has this command string: FOVXOffset 0; FOVYOffset 0; NormalRef door2_zTex0 Select. The NormalRef command string has the name of a piece of the model that handles the model lighting well.

Frame Strings

Frame strings are added to provide animation based cues to the game code. For weapons, the ones used are FIRE_KEY for the firing sound and creation of projectiles or sending out a fire vector depending on the weapon, SOUND_KEY # for any sounds played with other animations (selecting, deselecting, reloading, etc.) and FX_KEY for any effects that are turned on or off during animations (for example the pilot light used on the FlameThrower) These are entered by going to the frame of animation where the incident occurs and typing the appropriate string in the Frame String box.

WEAPONS.TXT Defines All Weapon Properties

The weapons.txt file found in the attributes file defines all weapon and ammo properties: interface artwork, model, skin, position, and much more. For a better explanation, look at the weapons.txt for examples (the weapons.txt also has a brief description for what everything does.)

FX.TXT Defines All Special Effects

The fx.txt file found in the attributes file defines all weapon effect properties: impact effects, muzzle flashes, and other effects like the flame on the lighter. For a better explanation, look at the fx.txt for examples (the weapons.txt also has a brief description for what everything does.)

Positioning PV Models

The PV models are positioned in the engine by using the mpwpos command when you hit the key that has been mapped for 'talk.' From there you can manipulate the model position by using the move keys. When the model is in the desired position use the 'mpwpos' command again and the position for that specific model will be saved to the weapons.txt file.