Component Overview
The main component responsible for moving the character is the Ultimate Character Locomotion. At a low level this component is responsible for collision detection, slopes, stairs, moving platforms, root motion, etc. Higher level this component is also responsible for the movement types, abilities, and effects system. The Ultimate Character Locomotion component specifies its own gravity allowing for situations like Super Mario Galaxy where the character walks around a spherical planet. The component also has its own time system allowing for the character to slow down while the rest of the world plays at a normal speed.
Movement Types, Abilities, and Effects offer an infinite amount of flexibility with the Ultimate Character Locomotion. Movement Types define how the character moves. Example Movement Types are a First Person Combat Movement Type which moves the character in a first person view or the Top Down Movement Type which allows for movement while the camera is looking down on the character.
The Ability system is an extremely powerful system and allows for the character to perform entirely new functionality without having to make any changes to the Ultimate Character Locomotion component. Abilities can be extremely simple (such as one which plays a random idle animation) or extremely complex (such as climbing over a mountain). The Effect system can be thought of as a lightweight ability and they allow for any effects related to the character such as shaking the camera.
The Ultimate Character Locomotion component receives input from the Ultimate Character Locomotion Handler. If the character is an AI agent or a remote player on the network then the handler component disables itself so the character can move according to the AI or remote player input.
The Ultimate Character Locomotion component is a deterministic kinematic controller. This makes it especially appropriate to use over the network in which case client-side predication and server reconciliation can be used to ensure ultra-smooth movement. If character animations are necessary the Animator Monitor component is used which interacts with Unity’s Animator component.
Any object that the character can interact with (equip, hold, shoot, etc.) are called Character Items. When switching between first and third person perspectives the item’s model is changed. The component responsible for managing this model is called First Person Perspective Item or Third Person Perspective Item depending on the perspective. The First Person Visible Item component is responsible for the movement of the first person item using the powerful spring system. The spring system allows for procedurally generated motion and is responsible for the bobs, sways, and shakes in a first person view.
The components responsible for interaction with items are called Item Actions. Examples include the Shootable Action component, the Melee Action component, or the Shield component. Multiple Item Action components can be added to a single item allowing for a single item to be able to shoot and melee, or shoot a bullet and shoot a projectile, for example. Each Item Action contains a set of modules that can individually add or remove the action functionality.
Items are identified by their Item Definitions. Item Types inherit Item Definitions and are used by the character controller. Item Definitions allow the controller to be integrated with the Ultimate Inventory System. Item Types are a representation of Items and are used by the Inventory and Item Set Manager components. The Inventory is an optional component which stores the amount of Item Types the character has. If no Inventory is added to the character then an unlimited number of Item Types can be used. The Item Set Manager is responsible for ensuring the correct item is equipped. Multiple categories can be specified which allows for cases such as Halo where the grenades can be switched independently from the main weapons.
The Attribute Manager is a versatile component that can be added to the character which describes a set of values that change over time. The Health component uses the Attribute Manager in order to determine the amount of health or shield the character has remaining. The Attribute Manager can be used to describe any character property including stamina, hunger, thirst, etc.
As the character is moving around in the world the Character IK component will position the limbs to prevent clipping with other objects. The Character IK component goes along with the Character Foot Effects component which uses the Surface System to spawn the correct effects for the feet. The Surface System is a generic effect spawning system which can spawn effects (decals, particles, audio, etc.) based on the type of impact. For example, if the character shoots a wood crate some wood particles may fall off of the crate, or if grass is hit then some grass blades may fly into the air. The Surface System goes along with the Decal Manager which is responsible for placing any decals, whether that is bullet holes or foot step effects.
Object Pooling is used to reduce the number of allocations necessary which increases performance. If an event needs to occur in the future the Scheduler is responsible for invoking that event. There is a preset system which for allows component values to be changed at runtime based on the current state. For example, the Zoom state will decrease the camera’s field of view.
The camera is controlled by the Camera Controller and the Camera Controller is responsible for managing the different View Types. The View Type describes how the camera should move and can work with the spring system for movements such as bobs, sways, or recoils. In a third person perspective the Object Fader component is added to the camera’s GameObject which allows for materials to fade based on the camera position (to prevent the camera from looking inside the character). The Aim Assist component allows the camera to target a specified GameObject.