| Home Page | Recent Changes

Controller

UT2003 :: Object >> Actor >> Controller (Package: Engine)

This class is a handle to a pawn. Pawns are the physical player characters, the controller is the, well, controlling entity moving it around. There are two subclasses from this class, both are important: AIController and PlayerController. Controller Overview covers this in more depth.

From this class, you can control everything from godmode to the pawn that you are focusing on to the adrenaline it has.

Notes

  • Adrenaline is here, not in the pawn class.
  • There is a linked list set up of the controllers, allowing you to move to the next controller in the list. The beginning of the list is in Level.ControllerList, and the link is the nextController field.

Properties

Main

PlayerReplicationInfo PlayerReplicationInfo
The PlayerReplicationInfo for this controller.
Pawn Pawn
The Pawn that this entity is controlling.
int PlayerNum (const)
The player number - per-match player number.
float SightCounter
Used to keep track of when to check player visibility.
float FovAngle
X field of view angle in degrees, usually 90.
float Handedness (globalconfig)
-1 for left, 0 for center, 1 for right, 2 for hidden
bool bIsPlayer
Pawn is a player or a player-bot.
bool bGodMode
cheat - when true, can't be killed or hurt

AI

bool bLOSflag (const)
used for alternating LineOfSight traces
bool bAdvancedTactics
serpentine movement between pathnodes
bool bCanOpenDoors
(maybe used for matinees?)
bool bCanDoSpecial
True if this controller can handle doors and triggers that must be shot – checked by Pawn.ShootSpecial().
bool bAdjusting
adjusting around obstacle
bool bPreparingMove
set true while pawn sets up for a latent move
bool bControlAnimations
take control of animations from pawn (don't let pawn play animations based on notifications)
bool bEnemyInfoValid
false when change enemy, true when LastSeenPos etc updated
bool bNotifyApex
event NotifyJumpApex() when at apex of jump
bool bUsePlayerHearing
No clue
bool bJumpOverWall
true when jumping to clear obstacle
bool bEnemyAcquired
Used to get notification when a bot sees someone
bool bSoaking
Pause and focus the camera on this bot if it encounters a problem
bool bHuntPlayer
hunting player
bool bAllowedToTranslocate
bool bAllowedToImpactJump
bool bAdrenalineEnabled
Interesting property - may be useful for a couple of mods?

Input

byte bRun, bDuck, bFire, bAltFire (input)
These are input flags which are set in your User.ini. It seems that the engine is also checking bFire to automagically trigger the fire event, see Firing Projectile Weapons.
vector AdjustLoc
location to move to while adjusting around obstacle
Controller nextController (const)
chained Controller list
float Stimulus
Strength of stimulus - Set when stimulus happens

Navigation

float MoveTimer
Used in matinee and in AI pathing
Actor MoveTarget
Actor being moved toward
vector Destination
Location being moved toward
vector FocalPoint
Location being looked at
Actor Focus
Actor being looked at
Mover PendingMover
A Mover the Pawn is waiting for to complete its move
Actor GoalList[4]
Used by navigation AI - list of intermediate goals
NavigationPoint home
Set when begin play, used for retreating and attitude checks
float MinHitWall
Minimum HitNormal dot Velocity.Normal to get a HitWall event from the physics. Note that this should be greater than -1.f ( ex. -0.5f > -1.f ) to enable HitWall notifications.

Pingz: Someone double check my facts on MinHitWall and remove this comment.

float RespawnPredictionTime
How far ahead to predict respawns when looking for inventory
int AcquisitionYawRate
How fast to move on the z axis to aquire a new target (??)

Enemy Info

Pawn Enemy
Pawn of my enemy
Actor Target
Actor being shot at; usually the enemy
vector LastSeenPos
enemy position when I last saw enemy (auto updated if EnemyNotVisible() enabled)
vector LastSeeingPos
position where I last saw enemy (auto updated if EnemyNotVisible enabled)
float LastSeenTime
Time I saw the last enemy (auto updated if EnemyNotVisible enabled)
string VoiceType
for speech
float OldMessageTime
to limit frequency of voice messages

Functions

(incomplete)

FinishRotation() (native, final, latent)
Waits until the controller has finished rotating(?)
GetHumanReadableName()
Returns the name of the player associated with this controller.
native(529) final function AddController();

It looks like this native function helps management of a Level's ControllerList - a linked list of all the Controllers present. The only time it is ever called is in Controller's PreBeginPlay() event. To offer further evidence, RemoveController() is only ever called in the Destroy() event.

//Navigation functions - return the next path toward the goal
native(518) final function Actor FindPathTo(vector aPoint);
native(517) final function Actor FindPathToward(actor anActor, optional bool bWeightDetours);
native final function Actor FindPathToIntercept(Pawn P, Actor RouteGoal, optional bool bWeightDetours);
native final function Actor FindPathTowardNearest(class<NavigationPoint> GoalClass, optional bool bWeightDetours);
native(525) final function NavigationPoint FindRandomDest();

These functions would mainly be useful for AI programming, but pathfinding functions can always be useful in other areas.

/* PawnDied()
 unpossess a pawn (because pawn was killed)
 */
function PawnDied(Pawn P)

Usually invoked by Pawns in the Dying state.

OlympusMons: Added these here, some of it is duplicated should this be inline with the normal standard or are native functions done differently?? If they are documented the same as the standard functions I'll fix this up. Maybe these should be listed somewhere else, although they arnt globals they do cover all controller subclasses, except maybe GUIController's

// Latent Movement.
//Note that MoveTo sets the actor's Destination, and MoveToward sets the actor's MoveTarget. 
//Actor will rotate towards destination unless the optional ViewFocus is specified.
native(500) final latent function MoveTo( vector NewDestination, optional Actor ViewFocus, optional bool bShouldWalk);
native(502) final latent function MoveToward(actor NewTarget, optional Actor ViewFocus, optional float DestinationOffset, optional bool bUseStrafing, optional bool bShouldWalk);
native(508) final latent function FinishRotation();
// native AI functions
// LineOfSightTo() returns true if any of several points of Other is visible (origin, top, bottom)
native(514) final function bool LineOfSightTo(actor Other);

// CanSee() similar to line of sight, but also takes into account Pawn's peripheral vision
native(533) final function bool CanSee(Pawn Other);

//Navigation functions - return the next path toward the goal
native(518) final function Actor FindPathTo(vector aPoint);
native(517) final function Actor FindPathToward(actor anActor, optional bool bWeightDetours);
native final function Actor FindPathToIntercept(Pawn P, Actor RouteGoal, optional bool bWeightDetours);
native final function Actor FindPathTowardNearest(class<NavigationPoint> GoalClass, optional bool bWeightDetours);
native(525) final function NavigationPoint FindRandomDest();

native(523) final function vector EAdjustJump(float BaseZ, float XYSpeed);

//Reachable returns whether direct path from Actor to aPoint is traversable using the current locomotion method
native(521) final function bool pointReachable(vector aPoint);
native(520) final function bool actorReachable(actor anActor);

/* PickWallAdjust()
Check if could jump up over obstruction (only if there is a knee height obstruction)
If so, start jump, and return current destination
Else, try to step around - return a destination 90 degrees right or left depending on traces out and floor checks*/
native(526) final function bool PickWallAdjust(vector HitNormal);

/* WaitForLanding()
latent function returns when pawn is on ground (no longer falling)*/
native(527) final latent function WaitForLanding();

native(540) final function actor FindBestInventoryPath(out float MinWeight);
native final function actor FindBestSuperPickup(float MaxDist); // find nearest super pickup (base has bDelayedSpawn=true)

native(529) final function AddController();
native(530) final function RemoveController();

// Pick best pawn target
native(531) final function pawn PickTarget(out float bestAim, out float bestDist, vector FireDir, vector projStart, float MaxRange);
native(534) final function actor PickAnyTarget(out float bestAim, out float bestDist, vector FireDir, vector projStart);

native final function bool InLatentExecution(int LatentActionNumber); //returns true if controller currently performing latent action specified by LatentActionNumber
// Force end to sleep
native function StopWaiting();
native function EndClimbLadder();

native final function bool CanMakePathTo(Actor A); // assumes valid CurrentPath, tries to see if CurrentPath can be combine with path to N

Events

(incomplete)

Event MayFall() //return true if allowed to fall - called by engine when pawn is about to fall

But this comment seems to be incorrect, after searching more classes I found:

/* MayFall() called by engine physics if walking and bCanJump, and
    is about to go off a ledge.  Pawn has opportunity (by setting 
    bCanJump to false) to avoid fall*/

I'm still unable to findout how to use this for players.

Controller Class Hierarchy

 Engine.Controller 
    +- Engine.AIController
    |   +- Gameplay.ScriptedController
    |   |   +- Unrealgame.Bot
    |   |   |   +- XGame.xBot
    |   |   |       +- SkarrjPack.InvasionBot? (Epic Bonuspack & UT2004)
    |   |   +- SkarrjPack.MonsterController (Epic Bonuspack & UT2004)
    |   |   +- Gameplay.ScriptedTriggerController?
    |   +- UnrealGame.TurretController? (UT2004)
    |       +- UT2k4AssaultFull.LinkTurretController?
    |       +- Onslaught.ONSTurretController?
    |       +- UnrealGame.SentinelController?
    |           +- UT2k4Assault.ASSentinelController?
    +- Engine.PlayerController
        +- Engine.Camera
        +- Engine.MessengingSpectator?
        |   +- xWebAdmin.UTServerAdminSpectator?
        +- UnrealGame.UnrealPlayer
            +- UnrealGame.CinematicPlayer?
            +- UnrealGame.DemoRecSpectator?
            +- xGame.xPlayer
                +- UT2004s.utvSpectator? (UT2004)

Related Pages

Discussion

Chemos: This page really needed to be written, and I am compiling information at the moment. I will finish all this up in a bit. (First page BTW) *phew* Typing that many "controller"s is getting quite annoying.

SuperApe: Updated Controller Class heirarchy. Added To Do Category link.

OlympusMons: Just wondering if all the classtree's should contain the package names as well, maybe they all shouldnt, either is fine I think.

SuperApe: I'm sure it's useful in some instances, but ideally the class pages have the package name. It could be fine without them, IMHO.

EricBlade: PickWallAdjust() claims to return a destination, but it returns bool, and it's one parameter is not declared as "out" .. where does it put the destination?

Wormbo: How about Controller.AdjustLoc?


Category Class (UT2003)

Category Class (UT2004)

Category To Do – Tidy up. Move some concept info from PlayerController. Move overview info to Controller Overview.

The Unreal Engine Documentation Site

Wiki Community

Topic Categories

Recent Changes

Offline Wiki

Unreal Engine

Console Commands

Terminology

FAQs

Help Desk

Mapping Topics

Mapping Lessons

UnrealEd Interface

UnrealScript Topics

UnrealScript Lessons

Making Mods

Class Tree

Modeling Topics

Chongqing Page

Log In