FPS Characters
Overview
In NeoFPS, a first person character is split into two parts: the character and a controller. If a character dies then the controller persists and can be attached to a new character. Controllers can also be persisted between scenes if the game design requires.
Characters
An FPS character ties together all the systems of NeoFPS into a single unit. Characters implement the ICharacter interface, which means you are free to define your own implementations of the character without being fixed to a specific base class.
A typical character hierarchy is as follows:
The root object is the most complex, containing the majority of components for the character:
- The ICharacter component
- Capsule Collider
- Rigidbody
- NeoCharacterController
- MotionController
- AimController
- Inventory
- Interaction handler
- Character audio handler
- Input behaviours
The player camera root is another object with a number of components:
There are also a number of damage handlers in the hierarchy for detecing incoming damage. These can be very simple, or more complex such as hit boxes on an animated character skeleton.
Controller
The FPS controller is persistent and can be attached to one character at any time. This system helps decouple the characters' mechanical implementation from their behaviour. In a multiplayer game there would be multiple player controllers or there could be a mix of player and AI controllers if bots were required. It also helps data such as stats persist between character deaths.