Advanced Models SDK

Notes for larger mods

Relevance

This page is relevant to:
Programmers working on larger mods who want to use AMS components and/or skeletal models

Skeletal animation bugs and known issues

When an actor's mesh is set to a skeletal mesh, if that mesh has a default animation set (linked to it by MESH DEFAULTANIM) and the actor's current animation set is None, the new mesh's animation set is loaded. If an animation set is already loaded, it is preserved.

This often isn't what you want. Consider this code (to use it, you'll need Burnt Kona's Riot Girl 2 and Epic's Bonus Pack 4):

class MutatingModel extends TBoss;
#exec OBJ LOAD FILE=..\System\SkeletalChars.u
#exec OBJ LOAD FILE=..\System\RiotGirl.u

exec function SwapMyMesh()
{
    if(Mesh==SkeletalMesh'RiotGirl.Riot')
    {
        Mesh=SkeletalMesh'SkeletalChars.WarMachineBoss';
    }
    else
    {
        Mesh=SkeletalMesh'RiotGirl.Riot';
    }
}

It looks as if it should work, right? It doesn't. When you first type SwapMyMesh at the console, your mesh changes to Riot Girl. No problem. However, when you type it again, your mesh changes to Warboss, leaving your animations set to Riot Girl's. The Riot Girl and Warboss skeletons are different shapes and use different bone names, so the animations don't match and the Warboss looks rather weird. Change the == to != so you get Warboss first, and Riot Girl looks even worse...

There are two solutions to this. One is to clear the animations immediately before you load the new mesh, like this:

    if(Mesh==SkeletalMesh'RiotGirl.Riot')
    {
        SkelAnim=None;
        Mesh=SkeletalMesh'SkeletalChars.WarMachineBoss';
    }
    else
    {
        SkelAnim=None;
        Mesh=SkeletalMesh'RiotGirl.Riot';
    }

This is what AMS does, since it seems to work for any model.

If you know in advance which models you'll be using, you can also set the animations yourself after you load the mesh.

    if(Mesh==SkeletalMesh'RiotGirl.Riot')
    {
        Mesh=SkeletalMesh'SkeletalChars.WarMachineBoss';
        LinkSkelAnim(Animation'SkeletalChars.SoldierAnim');
    }
    else
    {
        Mesh=SkeletalMesh'RiotGirl.Riot';
        LinkSkelAnim(Animation'RiotGirl.RiotAnim');
    }

Stuff you can only do with skeletal models

You could probably even use LinkSkelAnim() to load animation sets dynamically depending on the situation. For example, in some hypothetical military mod where the animations vary depending on the soldier's weapon, you could try this:

function SwitchMyWeapon()
{
   if(Weapon == None || Weapon.IsA('MyMod_Knife'))
       LinkSkelAnim(Animation'MyModSoldier.SoldierKnife');
   else if(Weapon.IsA('MyMod_Rifle') || Weapon.IsA('MyMod_SMG') || Weapon.IsA('MyMod_Shotgun'))
       LinkSkelAnim(Animation'MyModSoldier.Soldier2Handed');
   else if(Weapon.IsA('MyMod_Grenade') || Weapon.IsA('MyMod_Bomb'))
       LinkSkelAnim(Animation'MyModSoldier.SoldierThrow');
   else
       LinkSkelAnim(Animation'MyModSoldier.SoldierPistol');
}

Each animation set could then have one run animation, one walk animation, and so on, with the model's hands in the appropriate position for the weapon. Of course, this is only suitable in a mod environment where you can be sure that all models used share a single skeleton.

The Advanced Model Support skeletons

The standard Epic skeletal animations are only suitable if your mod only uses the normal Epic animation sequences, or has additional code to cope with models lacking your extra sequences.

There are two ways to use these animations: either link your mod to Advanced Model Support, or re-import the skeletons into your mod. Linking your mod to Advanced Model Support is easier and reduces your mod's size by about 1MB per animation set. Simply link to EpicUTPS2MaleAnimation or EpicUTPS2FemaleAnimation as usual, and set your UMOD requirements to include the product "AdvancedModelSupport", version 102.

If you re-import the skeletons, your mod will be a couple of megabytes larger, but won't depend on AMS, which may be a good thing for big mods like Infiltration and TacOps. The original skeletal animations are available from EpicKnights in two versions - one is the original as supplied to me by James Green, and one is a hex-edited version which uses more standard animation names (the female one has been significantly changed, as the original's death animations are unusually named). I recommend the hex-edited version for most circumstances (this is the version AMS uses). Each compressed PSA is just over 1 MB.

(temporary note: EpicKnights don't have the original versions yet because I'm only on 56k at the moment and uploading them is rather difficult; however, they do have the edited versions)

Advanced Model Support scripts

You may incorporate parts of the AMS scripts in your mod, subject to the following conditions:

Advanced Model Support original code copyright (c) 2001 Simon McVittie:

This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software.

Permission is granted to anyone to use this software or its derivatives for any purpose other than that of cheating in multiplayer games, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions:

  1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
  2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
  3. Altered versions must avoid the use of clashing package or class names in order to maintain network compatibility. Adding a common, unique prefix to class names, such as MyMod_GenericPlayer or just MyModPlayer, is recommended.
  4. This notice may not be removed or altered from any source distribution.

Elements are copyright (c) Epic Games, Inc. and may be only be used in accordance with Epic's intellectual property policy, in the same way as the rest of the Unreal Tournament source code.

Most of the useful code is in GenericPlayer.uc and GenericSkinInfo.uc. GenericBot.uc doesn't do a lot (it mostly calls the matching player class's functions) and most of the other classes are just provided for symmetry with Tournament(Player/Male/Female).

To get the source, run ucc batchexport on the AMS U file, like this:

E:\Games\UnrealTournament\System>ucc batchexport AdvancedModelSupport.u class uc ..\MyProject\AMSSourceCode

Back to index


AMSDK compiled by Simon `Psychic_313' McVittie, http://www.pseudorandom.co.uk
This page by Simon McVittie