The optimal class for your chess game


A pawn is the representation of what a player or AI is controlling in the game. It can be a human, a vehicle or really anything. In multiplayer each pawn is replicated to the other clients so everyone can shoot each other. A commonly used sub-class of pawn is Character that have a SkeletalMesh and a component for human style movement. If the pawn is the body then the Controller object is the mind that choose how the pawn should act. There are two types of controllers, the PlayerController and the AIController.

  • Spawned By: GameMode spawns the pawn in SpawnDefaultPawn.

  • Access C++:

    • PlayerController->GetPawn when PC posses a pawn.

    • GetWorld->GetPawnIterator() to loop across all pawns.


When a player joins a game a PlayerController is created. It is a non-physical actor that can ‘Possess’ a Pawn to let the input of the player control it. What is controlled may change while the game is play. In a shooter it can possess a soldier and when the player gets in a car it can switch the PlayerController to instead posses the car. The soldier character can be taken over by a simple AIController when the player drive around.

In multiplayer games the PlayerController exist on the owning client and the server. For information that need to be shared with other clients there is the PlayerState, listed below. Things such as menus need to be handled in the PlayerController. There will be time when the PlayerController is not controlling any Pawn, example if the soldier dies.

  • Spawning: Created by GameMode::Login when player joins game.

  • Access C++:

    • Pawn->GetController()

    • PlayerState->GetOwner()

    • GetWorld()->GetPlayerControllerIterator()


A AIController is like the playercontroller but use a AI in form of a Behavior Trees to decide what the pawn should do.

  • Spawning: Can be spawned automatically if desired by setting the variable “Auto Possess AI” in the Pawn class. Set AI Controller Class to the class to use.

  • Access C++: Pawn->GetController

  • Access BP: GetAIController


Each player in the game has it's own player state. They exist on and is synced to all clients.

  • Access C++:

  • Pawn->PlayerState

  • PlayerController->PlayerState

  • GameState->PlayerArray