Search public documentation:
There are several elements of the gameplay that are common to virtually any project created with Unreal Engine 3 or Unreal Development Kit. Customizing these elements allows for creating games that are completely unique and look and behave exactly as desired. No two projects are alike, and while Unreal Engine does provide a default implementation of these elements, it is highly likely that each of them will need to be modified a great deal to adhere to the game's design. A Basic Game Quick Start is provided to help familiarize yourself with creating your own custom gameplay classes and getting your project up and running. It details the creation of an empty game framework (though it implements a third-person perspective) that can then be customized to your needs, whether you are designing for mobile or PC.
The gametype is responsible for the rules of the game. It constitutes the game's framework and is essentially the basis for any game made with Unreal Engine 3. In games such as Unreal Tournament 3, the concept of gametypes is quite obvious. There are several gametypes to choose from directly from the menu, such as Deathmatch, Capture the Flag, etc. In other games, the concept of a gametype may be much less evident. Take a single player platformer game, for example. There is no explicit gametype the player ever sees; however, there are definitely game rules and conditions on which the current "level" is considered complete. There may be a time limit imposed on the player and the level is complete when the player reaches a certain point or defeats a "boss" character. These are the types of elements the gametype would specify and keep track of. A more complex case would be that of a dungeon crawler type game. In the main world, there would be an overarching gametype that would keep track of the game progress and conditions. Within each dungeon there could be a gametype specific to that dungeon, allowing each dungeon to be completely unique and have its own set of rules and objectives. GameInfo The gametype of a game is controlled by the GameInfo class. A new subclass of this class is created for each gametype the game is to include. A game may have any number of gametypes, though only one will be in use at any given time. A GameInfo actor is instantiated when the level is initialized for gameplay UGameEngine::LoadMap(). This gametype will be used for the duration of the level unless otherwise specified. This class is generally responsible for things such as:
- Determining where the player spawns.
- Giving the appropriate inventory items to the player.
- Setting a time limit.
- Recording scores/kills for the players
- Resetting the level if necessary
- Checking for end game conditions
Each player in an Unreal Engine game is comprised of several systems all working together. These systems control the look and behavior of the player as well as how the world is viewed and how the input from the person playing the game is interpreted into actions in the game. PlayerController Players and other entities in Unreal Engine 3 are generally controlled by Controllers. The Controller is the brains of the entity, determining how the entity should behave. Players have their own special Controller, the PlayerController, which has the ability to take input from the person playing the game and convert that to actions. Pawn Whereas the PlayerController constitutes the brains of the player, the Pawn is the physical representation, or body, of the player or other entities in the game. The Pawn takes commands from the Controller and carries them out. This is where animation and damage and other physical-related aspects of the player are handled. For more information about the player system, Controllers and Pawns, and creating custom players and characters, see the Characters Technical Guide page. Camera The player's view into the world is handled by the camera system and the Camera class. This class specifies a location and rotation from which to render the world to the viewport. It is, in essence, the eyes of the player. Using a custom Camera class, or even a completely custom camera system, entirely new and unique types of views can be created. For instance, the default view is a first-person perspective where the player itself is not visible. It is as if the person playing the game is viewing directly from the eyes of the player in the game. With a custom Camera class, this view can easily be changed to be offset away from the player in the game, allowing the person playing to view their in-game character along with the world. Other views, such as top-down, side-scrolling, and isometric perspectives are all easily achievable with this system. Input The PlayerController has the ability to take the input from the player and convert it to actions in the game. This input comes from an Input class, specifically the PlayerInput class. This class is responsible for taking button or key presses from a controller or keyboard or mouse and converts them into usable data. This data is then available to the PlayerController to do with as it sees fit. Input is closely related to the camera system and the way the player views the game, as different perspectives usually require specific methods of controlling the player. They are separate systems, but modifying the camera perspective in any major way will most certainly require modifying the way the player input is used to control the player. For complete details on the camera system, Camera class, and creating custom camera perspectives and player controls, see the Camera Technical Guide page.
Heads Up Display (HUD) refers to the status and information overlaid on the screen during gameplay. The purpose of the HUD is to inform the player of the current state of the game, i.e. the score, their health, the amount of time remaining, etc. The HUD is usually non-interactive, meaning the player does not click on elements of the HUD, though this becomes a gray area in certain types of games where the HUD and user interfaces are hard to separate. User Interfaces (UIs) refer to menus and other interactive elements. These elements are usually drawn overlaid on the screen much like the HUD, but in certain circumstances they could be part of the game world itself rendered onto a surface in the world. The most obvious examples of UIs are the main menu displayed when the game starts up or the pause menu shown when the player pauses the game. However, other UIs may be displayed during play. These could be used to show dialog between characters in the game or in more complex situations, such as in an RTS or RPG, they may be integral to the game play itself allowing the player to choose weapons, armor, units to build, etc. HUD The HUD class is the base class for displaying elements overlaid on the screen. Every player in the game has their own instance of the HUD which draws to their individual viewport. The type, or class, of HUD to use is specified by the gametype being used. For more information on the HUD class and creating custom HUDs, visit the HUD Technical Guide page. There are two main methods the HUD class can use to display elements on the screen: Canvas drawing or Scaleform GFx movies. Canvas The Canvas class contains all the functionality needed to draw text and images to the screen (or other surfaces through ScriptedTextures). Each time through the draw loop a new Canvas is assigned to the HUD and can be used to draw the necessary elements to the screen. For details on the Canvas class and using it to draw to the screen, see the Canvas technical Guide. Scaleform The Scaleform GFx integration in Unreal Engine 3 enables the use of motion graphics built in Adobe Flash Professional to be used as HUDs and UIs in-game. It consists of a collection of classes representing the movie, movie player, and the individual objects contained within the movie. Movie players can be created in a custom HUD allowing complete control over which movies are shown in the game. For more information about Scaleform and its integration into Unreal Engine 3, see the Scaleform page. The technical side of the Scaleform system is detailed in the Scaleform Technical Guide.