Character Controller Requirements |
This article discusses the requirements of a 3D character controller for games.
This topic contains the following sections:
A character controller should support following functions:
Teleport: The first requirement is teleport because the character controller must be set to its initial position. A teleport sets the character to a new position. It doesn't matter where it was previously and if there are obstacles between the old and new position.
Recover from penetrations: Trusting Murphy's Law we can safely assume that each teleport brings the character into a position where it penetrates other objects. So it is good if the character controller has the ability to find a valid, non-penetrating position near the desired position.
Move: This is the basic operation that moves the character from its current position to its new position with a method that is often called "collide and slide" or "bump and slide". The character should stop before obstacles and slide along the obstacles to get as near to the desired position as possible without penetrating other solid objects.
Jump, Gravity: The player should be able to jump. There should be a restricted maneuverability (jump height and direction) while in the air. When the character does not touch the ground it should fall due to gravity.
Slope Limit: The character should slide up and down inclined planes. There should be an inclination limit. Steep planes cannot be climbed. If slope limits are not supported, the level designer must place invisible walls to stop the player. (Even if slope limits are supported invisible walls are probably a good idea. Players will find all glitches.)
Step Up and Step Height Limit: The character should automatically step onto/over small obstacles. Stairs should also be no problem. There must be a limit for the maximal step height. If stepping up is not supported, the collision objects of stairs must be inclined planes.
Step Down: Stepping down sounds superfluous because the character will fall automatically - but stepping down is essential. In real life humans walking down stairs do not step into the air and let themselves fall down, they bend their knees and actively step down to touch the ground. If stepping down is not supported, a character moving down stairs or inclined planes will not move down smoothly. Instead it will bounce down on short ballistic curves and look very silly.
Modes: The character controller should support different operation modes, depending on whether collisions and gravity are enabled:
Theoretically there is a fourth mode:
Collision Filtering: It must be possible to define with which objects the character will collide and which are ignored.
Advanced Functions: The above functions cover the basics. A lot of other functions are desirable:
Avoid penetrations: The character should not penetrate solid objects. But: A small amount of penetration should be allowed for stability reasons.
Avoid tunneling: Fast moving characters should not "tunnel" through thin or fast moving objects. That means, all collisions must be detected.
Avoid jitter: The character controller should not jitter when running into a limit, e.g. when running against a steep plane or into a sharp corner.
Avoid getting stuck: The character should not get into situations where it cannot move anymore. A situation where a character controller might get stuck, looks like this:
Many games have auto-unstuck features to move the character to a safe position once he gets stuck.
Limit the maximal velocity: The maximal velocity or movement per frame must be limited to avoid glitches.
To test our character controller implementations we have use an obstacle course. In the course we test the following: