Cogito, ergo sum

Legacy:Defining SpeciesTypes

From Unreal Wiki, The Unreal Engine Documentation Site
Jump to: navigation, search

This page describes how to use the Object >> SpeciesType class to implement different species with different characteristics in UT2003.

These characteristics can be e.g.:

  • the ground speed of a pawn
  • the jump height of a pawn
  • the acceleration when running
  • change the damage done to a pawn (like a species having an armoured skin)
  • change the damage that this pawn does to others (like a species having a nasty punch)

First, lets start with an overview of the classes that contribute to the species-system (they are explained in more detail later):

SpeciesType 
This class and its subclasses define the species and their individual characteristics. UT2003 e.g. comes with several build-in species like SPECIES_Alien, SPECIES_Bot, SPECIES_Human (where the humans have some sub-species, namely SPECIES_Egypt, SPECIES_Merc and SPECIES_Night), and SPECIES_Jugg. You can easily expand these to form your own species with their own characteristics. See SpeciesType
xPawn 
xPawn has the member Species of type SpeciesType to define the Species that this xPawn is of.
MutSpeciesStats 
Is a mutator that activates the species-system ingame.
SpeciesGameRules 
Are species-specific game rules activated by the MutSpeciesStats.
UPL File files 
define player-models, including their assigned species.

These classes (resp.files) are explained in more detail now.

xPawn

  • has the member Species of type SpeciesType that defines its Species. This member's default property is set in the defaultproperties.
defaultproperties
{ 
  ...
  Species=class'SPECIES_Jugg'
  ...
}

Its real value is determined at runtime in the function xPawn.Setup that uses the class xUtil to find the player record that is defined for a character name:

rec = class'xUtil'.static.FindPlayerRecord("Gorge");

This function is native, that is, it is implemented in the C/C++ core and its sourcecode is not accessible, but I assume it just searches all .upl files and returns the player record who's DefaultName matches the given character name.

.upl

The .upl files define the characters, i.e. how they look (Mesh, Skin), what portrait they have in the player selection menu, their favorite weapon (in case its a bot) and of course their species type. I guess since you can set the sex of an character in the .upl file that this also defines the voice of that character. .upl files are located in the UT2003/System directory and look like this:

[Public]
Player=(DefaultName="Diva",Mesh=HumanFemaleA.EgyptFemaleA,species=xGame.SPECIES_Egypt,BodySkin=PlayerSkins.EgyptFemaleABodyA,FaceSkin=PlayerSkins.EgyptFemaleAHeadA,Portrait=PlayerPictures.cEgyptFemaleAA,Text=XPlayers.EgyptFemaleAA,Sex=Female,Menu="SP",Aggressiveness=+0.4,CombatStyle=+0.4,FavoriteWeapon=xWeapons.RocketLauncher,bJumpy=1,StrafingAbility=+0.5)
Player=(DefaultName="Scarab",Mesh=HumanMaleA.EgyptMaleA,species=xGame.SPECIES_Egypt,BodySkin=PlayerSkins.EgyptMaleABodyA,FaceSkin=PlayerSkins.EgyptMaleAHeadA,Portrait=PlayerPictures.cEgyptMaleAA,Text=XPlayers.EgyptMaleAA,Sex=Male,Menu="SP",Tactics=1.0,FavoriteWeapon=xWeapons.LinkGun,CombatStyle=-0.1,StrafingAbility=+0.4,Accuracy=-0.4)
...

MutSpeciesStat

  • activates the SpeciesGameRules to use the species-specific damage system.
  • modifies xPawns to species-specific attributes like GroundSpeed, WaterSpeed, Jump-Height etc. in ModifyPawn.

You should use this Mutator if you want the species-system to be activated.

SpeciesGameRules

  • modifies damage done to an xPawn, depending on the species of that pawn (SpeciesGameRules.ModifyReceivedDamage)
  • modifies damage done to an xPawn, depending on the species of the instigator (SpeciesGameRules.ModifyImpartedDamage)

You could create your own species game rules that extend these game rules and define more sophisticated species-related stuff.