Once I get that upgrade to 36-hour days, I will tackle that. – Mychaeel
Legacy:PlayerController
The player controller class determines what the player sees and how Bot players behave, tying in Bot AI functions to control the player Pawn. This class determines what the player sees when in first person view and in third person view and how the "camera" behaves. It handles things like view shaking and the display of fog. There are also handling functions in there for force-feedback events and support for more console commands than you can shake a stick at.
Contents
- 1 Properties
- 1.1 Player Info
- 1.2 Player Input Control
- 1.3 Player Control Flags
- 1.4 ForceFeedback
- 1.5 VoiceChat
- 1.6 Input Bytes
- 1.7 Input Floats
- 1.8 Vehicle Move Replication
- 1.9 Vehicle Check Radius
- 1.10 Camera
- 1.11 Audio
- 1.12 Fixed Visibility
- 1.13 Screen Flashes
- 1.14 Distance Fog Fading
- 1.15 Remote Pawn ViewTargets
- 1.16 Music
- 1.17 Progess Indicator
- 1.18 Localized Strings
- 1.19 ReplicationInfo
- 1.20 View Shaking
- 1.21 Components ( Inner Classes )
- 1.22 Camera Control for Debugging/Tweaking
- 1.23 TeamBeacon
- 1.24 Demo recording view rotation
- 1.25 Menu
- 2 Structs
- 3 Native Functions
- 4 Native Events
- 5 Events
- 6 Related Topics
- 7 Class Tree
- 8 Discussion
Properties
Player Info
- player Player (const)
Player Input Control
- bool bLookUpStairs (globalconfig)
- look up/down stairs (player)
- bool bSnapToLevel (globalconfig)
- Snap to level eyeheight when not mouselooking
- bool bAlwaysMouseLook (globalconfig)
- bool bKeyboardLook (globalconfig)
- no snapping when true
- bool bCenterView
Player Control Flags
- bool bBehindView
- Outside-the-player view.
- bool bFrozen
- set when game ends or player dies to temporarily prevent player from restarting (until cleared by timer)
- bool bPressedJump
- bool bDoubleJump
- bool bUpdatePosition
- bool bIsTyping
- bool bFixedCamera
- used to fix camera in position (to view animations)
- bool bJumpStatus
- used in net games
- bool bUpdating
- bool bNeverSwitchOnPickup (globalconfig)
- If true, don't automatically switch to picked up weapon
- bool bHideSpectatorBeacons
- bool bZooming
- bool bHideVehicleNoEntryIndicator
- bool bAlwaysLevel (globalconfig)
- bool bSetTurnRot
- bool bCheatFlying
- instantly stop in flying mode
- bool bFreeCamera
- free camera when in behindview mode (for checking out player models and animations)
- bool bZeroRoll
- bool bCameraPositionLocked
- bool bViewBot
- bool UseFixedVisibility
- bool bFreeCam
- In FreeCam mode to adjust the cam rotator
- bool bFreeCamZoom
- In zoom mode
- bool bFreeCamSwivel
- In swivel mode
- bool bBlockCloseCamera
- bool bValidBehindCamera
- bool bForcePrecache
- bool bClientDemo
- bool bAllActorsRelevant (const)
- used by UTTV. DO NOT SET THIS TRUE - it has a huge impact on network performance :
- bool bShortConnectTimeOut
- when true, reduces connect timeout to 15 seconds
- bool bPendingDestroy
- when true, playercontroller is being destroyed
- bool bEnableAmbientShake
- bool bNoVoiceMessages (globalconfig)
- bool bNoTextToSpeechVoiceMessages (globalconfig)
- bool bNoVoiceTaunts (globalconfig)
- bool bNoAutoTaunts (globalconfig)
- bool bAutoTaunt (globalconfig)
- bool bNoMatureLanguage (globalconfig)
- bool bDynamicNetSpeed (globalconfig)
- bool bSmallWeapons (globalconfig)
- bool bWeaponViewShake
- bool bLandingShake (globalconfig)
- bool bAimingHelp (globalconfig)
- bool bEnableStatsTracking (globalconfig)
- bool bOnlySpeakTeamText (globalconfig)
- bool bWasSpeedHack
- bool bIsSpaceFighter
- Hack for spacefighter joystick controls
- bool bWasSaturated (const)
- Used by servers to identify saturated client connections
- float FOVBias
- float DesiredFOV (globalconfig)
- float DefaultFOV (globalconfig)
- float ZoomLevel
- float DesiredZoomLevel
- EDoubleClickDir DoubleClickDir
- Direction of movement key double click (for special moves)
- byte AnnouncerLevel (globalconfig)
- 0=none, 1=no possession announcements, 2=all
- byte AnnouncerVolume (globalconfig)
- 1 to 4
- float TextToSpeechVoiceVolume (globalconfig)
- float MaxResponseTime
- How long server will wait for client move update before setting position
- float WaitDelay
- Delay time until can restart
- Pawn AcknowledgedPawn
- Used in net games so client can acknowledge it possessed a pawn
- HUD myHUD
- heads up display info
- float LastPlaySound
- float LastPlaySpeech
- Pawn TurnTarget
- int EnemyTurnSpeed (config)
- int GroundPitch
- rotator TurnRot180
- vector OldFloor
- Used by PlayerSpider mode - floor for which old rotation was based.
- array<PlayerNameInfo> PlayerNameArray (private, const)
- Security PlayerSecurity
- Used for Cheat Protection
- float LoginDelay
- float NextLoginTime
- float ForcePrecacheTime
- float LastPingUpdate
- float ExactPing
- float OldPing
- float SpectateSpeed
- float DynamicPingThreshold (globalconfig)
- float NextSpeedChange
- float VoiceChangeLimit
- int ClientCap
- AnnouncerQueueManager AnnouncerQueueManager
- Handling Announcer Queueing
- AnnouncerVoice StatusAnnouncer
- AnnouncerVoice RewardAnnouncer
- float LastActiveTime
- used to kick idlers
- Actor CalcViewActor
- optimize PlayerCalcView
- vector CalcViewActorLocation
- vector CalcViewLocation
- rotator CalcViewRotation
- float LastPlayerCalcView
- float LastBroadcastTime
- string LastBroadcastString[4]
- float LastSpeedHackLog
- string PlayerOwnerName
- for savegames
- ClientAdjustment PendingAdjustment
ForceFeedback
- bool bEnablePickupForceFeedback (globalconfig)
- bool bEnableWeaponForceFeedback (globalconfig)
- bool bEnableDamageForceFeedback (globalconfig)
- bool bEnableGUIForceFeedback (globalconfig)
- bForceFeedbackSupported
- true if a device is detected
VoiceChat
- bool bVoiceChatEnabled
- Whether voice chat is enabled on this client
- bool bEnableInitialChatRoom (globalconfig)
- Enables speaking on DefaultActiveChannel upon joining server
- bool bViewingMatineeCinematic
- bool bCustomListener
- bool bAcuteHearing
- Makes playercontroller hear much better (used to magnify hit sounds caused by player)
- bool bMenuBeforeRespawn
- Forces the midgame menu to pop up before player can click to respawn
- bool bSkippedLastUpdate
- bool bLastPressedJump
- byte AutoJoinMask (globalconfig)
- Contains a bit-mask of which channels to auto-join ( 1 - Public, 2 - Local, 4 - Team )
- class<ChatRoomMessage> ChatRoomMessageClass
- array<StoredChatPassword> StoredChatPasswords (globalconfig)
- VoiceChatRoom ActiveRoom
- The chatroom we're currently speaking to
- string LastActiveChannel (globalconfig)
- Stores the currently active channel when switching maps
- string VoiceChatCodec (globalconfig)
- Which voice chat codec to request in internet games (will only be used if it exists on server)
- string VoiceChatLANCodec (globalconfig)
- Which voice chat codec to request in LAN games
- string ChatPassword (globalconfig)
- Password for our personal chat room
- string DefaultActiveChannel (globalconfig)
- Channel we initially want to make active
Input Bytes
- byte bStrafe (input)
- byte bSnapLevel (input)
- byte bLook (input)
- byte bFreeLook (input)
- byte bTurn180 (input)
- byte bTurnToNearest (input)
- byte bXAxis (input)
- byte bYAxis (input)
Input Floats
- float aBaseX (input)
- float aBaseY (input)
- float aBaseZ (input)
- float aMouseX (input)
- float aMouseY (input)
- float aForward (input)
- float aTurn (input)
- float aStrafe (input)
- float aUp (input)
- float aLookUp (input)
Vehicle Move Replication
- float aLastForward
- float aLastStrafe
- float aLastUp
- float NumServerDrives
- float NumSkips
Vehicle Check Radius
- float VehicleCheckRadius
- Radius that is checked for nearby vehicles when pressing use
- bool bSuccessfulUse
- Gives PC a hint that UsedBy was successful
Camera
- int ShowFlags
- int Misc1
- int Misc2
- int RendMap
- float OrthoZoom
- Orthogonal/map view zoom factor.
- Actor ViewTarget (const)
- Controller RealViewTarget (const)
- PlayerController DemoViewer
- float CameraDist
- Multiplier for behindview camera dist
- range CameraDistRange
- vector OldCameraLoc
- Used in behindview calculations
- rotator OldCameraRot
- array<CameraEffect> CameraEffects (transient)
- A stack of camera effects.
Audio
- vector ListenerLocation
- rotator ListenerRotation
Fixed Visibility
- vector FixedLocation
- rotator FixedRotation
- matrix RenderWorldToCamera
Screen Flashes
- vector FlashScale
- vector FlashFog
- float ConstantGlowScale
- vector ConstantGlowFog
- float ScreenFlashScaling (globalconfig)
Distance Fog Fading
- color LastDistanceFogColor
- float LastDistanceFogStart
- float LastDistanceFogEnd
- float CurrentDistanceFogEnd
- float TimeSinceLastFogChange
- int LastZone
Remote Pawn ViewTargets
- rotator TargetViewRotation
- rotator BlendedTargetViewRotation
- float TargetEyeHeight
- vector TargetWeaponViewOffset
Music
- string Song
- EMusicTransition Transition
Move Buffering
For network games, clients save their un-acknowledged moves in order to replay them when they get position updates from the server.
- SavedMove SavedMoves
- buffered moves pending position updates
- SavedMove FreeMoves
- freed moves, available for buffering
- SavedMove PendingMove
- float CurrentTimeStamp
- float LastUpdateTime
- float ServerTimeStamp
- float TimeMargin
- float ClientUpdateTime
- float MaxTimeMargin
- float TimeMarginSlack (globalconfig)
- OBSOLETE
- Weapon OldClientWeapon
- int WeaponUpdate
Progess Indicator
Used by the engine to provide status messages (HUD is responsible for displaying these).
- string ProgressMessage[4]
- color ProgressColor[4]
- float ProgressTimeOut
Localized Strings
- string QuickSaveString (localized)
- string NoPauseMessage (localized)
- string ViewingFrom (localized)
- string OwnCamera (localized)
ReplicationInfo
- GameReplicationInfo GameReplicationInfo
- VoiceChatReplicationInfo VoiceReplicationInfo
- VotingReplicationInfoBase VoteReplicationInfo
Stats Logging
- string StatsUsername (globalconfig)
- string StatsPassword (globalconfig)
- class<LocalMessage> LocalMessageClass
View Shaking
Affects roll, and offsets camera position.
- vector ShakeOffsetRate
- vector ShakeOffset
- current magnitude to offset camera from shake
- vector ShakeOffsetTime
- vector ShakeOffsetMax
- vector ShakeRotRate
- vector ShakeRotMax
- rotator ShakeRot
- vector ShakeRotTime
- float AmbientShakeFalloffStartTime
- float AmbientShakeFalloffTime
- Time taken for shaking to stop after AmbientShakeFalloffStartTime has passed.
- vector AmbientShakeOffsetMag
- float AmbientShakeOffsetFreq
- rotator AmbientShakeRotMag
- float AmbientShakeRotFreq
Components ( Inner Classes )
- CheatManager CheatManager (private, transient)
- Object within playercontroller that manages "cheat" commands
- class<CheatManager> CheatClass
- Class of my CheatManager
- PlayerInput PlayerInput (private, transient)
- Object within playercontroller that manages player input.
- class<PlayerInput> InputClass (config)
- Class of my PlayerInput
- AdminBase AdminManager (private, transient)
- MaplistManagerBase MapHandler (transient)
- Used by AdminBase
- string PlayerChatType
- PlayerChatManager ChatManager
- Manages all chat, speech, and voice messages sent to player
- vector FailedPathStart (const)
Camera Control for Debugging/Tweaking
BehindView Camera Adjustments
- rotator CameraDeltaRotation
- The rotator delta adjustment
- float CameraDeltaRad
- The zoom delta adjustment
- rotator CameraSwivel
- The swivel adjustment
TeamBeacon
- float TeamBeaconMaxDist
- float TeamBeaconPlayerInfoMaxDist
- Texture TeamBeaconTexture
- Texture LinkBeaconTexture
- Texture SpeakingBeaconTexture
- Color TeamBeaconTeamColors[2]
- Color TeamBeaconCustomColor
Demo recording view rotation
- int DemoViewPitch
- int DemoViewYaw
Menu
- string MidGameMenuClass (config)
- Menu that is shown when Escape is pressed
- string DemoMenuClass (config)
- Menu used for demos
- string AdminMenuClass (config)
- Menu that is shown when adminmenu command is used
- string ChatPasswordMenuClass (config)
- Menu that appears when attempting to join a chatroom that has a password
Structs
Voice Chat
;struct StoredChatPassword { var string ChatRoomName; var string ChatRoomPassword; };
Player Names
;struct PlayerNameInfo { var string mInfo; var color mColor; var float mXPos; var float mYPos; };
ClientAdjustPosition
;struct ClientAdjustment { var float TimeStamp; var name newState; var EPhysics newPhysics; var vector NewLoc; var vector NewVel; var actor NewBase; var vector NewFloor; };
Native Functions
native final function SetNetSpeed(int NewSpeed); native final function string GetPlayerIDHash(); native final function string GetPlayerNetworkAddress(); native final function string GetServerNetworkAddress(); native function string ConsoleCommand( string Command, optional bool bWriteToLog ); native final function LevelInfo GetEntryLevel(); native(544) final function ResetKeyboard(); native final private function ResetInput(); native final function SetViewTarget(Actor NewViewTarget); native final function string GetURLProtocol(); native final function string GetDefaultURL(string Option); // Execute a console command in the context of this player, then forward to Actor.ConsoleCommand. native function CopyToClipboard( string Text ); native function string PasteFromClipboard(); native final function bool CheckSpeedHack(float DeltaTime); native(524) final function int FindStairRotation(float DeltaTime);
Native Events
native event ClientTravel( string URL, ETravelType TravelType, bool bItems ); // Validation. private native event ClientValidate(string C); private native event ServerValidationResponse(string R); native event ClientHearSound ( actor Actor, int Id, sound S, vector SoundLocation, vector Parameters, bool Attenuate );
Events
- ClientSetViewTarget ( Actor A )
- InitInputSystem()
- ReceiveLocalizedMessage( class<LocalMessage> Message, optional int Switch, optional PlayerReplicationInfo RelatedPRI_1, optional PlayerReplicationInfo RelatedPRI_2, optional Object OptionalObject ) (simulated)
- ClientMessage( coerce string S, optional name Type )
- TeamMessage( PlayerReplicationInfo PRI, coerce string S, name Type )
- PreClientTravel()
- ProgressCommand( string Cmd, string Msg1, string Msg2 )
- SetProgressMessage( int Index, string S, color C ) (exec)
- SetProgressTime( float T ) (exec)
- TravelPostAccept()
- PlayerTick( float DeltaTime )
- AddCameraEffect( CameraEffect NewEffect, optional bool RemoveExisting )
- RemoveCameraEffect( CameraEffect ExEffect )
- PlayerCalcView( out actor ViewActor, out vector CameraLocation, out rotator CameraRotation )
- ClientOpenMenu( string Menu, optional bool bDisconnect, optional string Msg1, optional string Msg2 )
- ClientReplaceMenu( string Menu, optional bool bDisconnect, optional string Msg1, optional string Msg2 )
- ClientCloseMenu( optional bool bCloseAll, optional bool bCancel )
- StartClientDemoRec() (simulated)
- Called on the client during client-side demo recording.
Related Topics
- Controller Overview – An overview of controllers.
- Customising the Player View – How to put the the player view where you want it.
- Customising the Player Input – How to get the control behaviour you want.
- Creating An Interaction From A PlayerController – Player input and output (HUD display, keyboard input, etc.)
Class Tree
Controller – Parent class. +- AIController – Artificially intelligent agents. +- PlayerController – This class. +- UnrealPlayer – subclass.
Discussion
EntropicLqd: Anyone have any preference on what gets covered in PlayerController? I'll do the third person view and first person view functions. Might spend some time figuring out which events a player controller actually does recieve before the Pawn event. The other thing I've started doing is prefixing the class name with the package it's contained within. I know I find it useful, does anyone else? if not I'll drop it.
Chazums Other than as much as possible / relevant, not really :D . Putting in the package name is useful i think, makes it easier to see where the stuff being looked at is.
EntropicLqd: Hmm, I'll do what I can but I don't want to make the page too long. Thanks to Wormbo for fixing my markup ealier :).
EntropicLqd: I wish Tim Sweeny would take a look at this and add a bit of in depth knowledge. So much of it feels like speculation and almost educated guesswork that it makes me uncomfortable. However, the cool thing about it is that this stuff occurs right at the engine level rather than the UT2K3 game level.
Trystan: "Page too long"? Can you give too much knowledge? :D Perhaps begin with as much knowledge as you can shove in here (because I'm looking forward to it as much as Chazums) and then one of us could refactor it for you? It'd be a good test of our understanding of what you're trying to convey, that's for certain. This is mostly a minor note to let you know that there's another person looking forward to this information. :) (I expect you to work all of Thanksgiving on this! :D)
EntropicLqd: It's a good job I'm working on something so dull that it makes my brain want to crawl out of my head and escape screaming then. Thanksgiving? They don't have that where I come from. Too much knowledge is a very dangerous thing. It's wisdom you can never have enough of.
Trystan: Damn global stuff. Sorry, I'm one of those asinine Americans who think that everyone is like them. Chaz is slowly but surely beating that out of me by refusing to be anything American like. I'll learn sooner or later. :)
Chazums Silly Trystan :D . nice work EntropicLqd you've certainly busy. In referance to the code at the end, could it be that it's used for when a bot replaces a client? My other thought is that its creating a duplicate so that the right stuff is displayed on the spectators screen.
EntropicLqd: If we were a bot taking over a player pawn we'd be in the AIController class. Still, nice theory.
EntropicLqd: Chazums & Trystan - is there anything on this page (or the Customising the Player View page) that doesn't make sense or needs further elaboration? I've kind of lost track a bit here.
Pingz: Shouldn't there be a class outline on this page like for all the other classes? You can then move all this content to a page like 'Explaining the PlayerController' or something.
PsychoSk8r: I'm looking to make a new gametype for UT2004 based on direct control of a katana for combat. Naturally, that would be dependant on precise network replication. Would this be possible? I couldn't quite tell from this, and I have often seen where the game will only do rough interpretations of a players action, so I'm not quite sure if it would work.
GRAFIK: You can ask on the Help Desk.
SuperApe: Yes, there should be a class page here. Controller Overview issues belong at Controller Overview. This page needs Property, Function, Event and State definitions.
OlympusMons: Added properties and structs, might want to check it for typo's :P, straight from the source. Removed Class tree already have one in the super.class so I figured its not needed.
SuperApe: Thanks. :) I tidied up a bit. Of the part of the overview that remains here, should it be moved under the class info?
OlympusMons: Maybe we should add a PlayerController Overview it can be similar to the Controller Overview. This should give us some space to fix this page and bring it up to speed. Ok so I moved the stuff hope you guys dont mind.
SuperApe: The second class path box isn't necessary as they have the same path in UT2003 and UT2004. These event declarations really needed the arguements included. If we add some decs and leave out the args, someone will think it's complete. I'm just afraid no one will think to check it and fix it. I think it took me just about as much time as if I had started from scratch. ;) I couldn't find ServerChangeVoiceChatter() or ServerGetVoiceChatters() in UT200x.
OlympusMons: added part of a class tree for easier navigation and fixed a few typos :)
Xian: Can someone please tell me the difference between GetPlayerNetworkAddress() and GetServerNetworkAddress() please? UT had only the latter, and it was server-side... Also, what are GetURLProtocol(), CheckSpeedHack(), ClientValidate() and ServerValidationResponse() for?
I couldn't find any detailed info on them at all :(
Category:Legacy Class (UT2003)
Category:Legacy Class (UT2004)
Category:Legacy To Do – Move overview info to Controller Overview or Controller and add standard class header and properties/methods descriptions. Update class hierarchy, but for only PlayerController subclasses.