1. Home
  2. Docs
  3. Xandra Character Creator
  4. In-Game Player Character Creator

In-Game Player Character Creator

Difficulty: Advanced

While the XANDRA Character Creator is a utility for creating blueprint characters in the Editor, this demo instead re-purposes the system for creating a player character directly within a game such as a RPG. It provides some basic blueprints that can be used as a starting point for doing this, but the rest is up to you.

The demo contains two scenes:

  • 1. Lvl_CharacterCreator_InGame is the scene where the player creates their character.
  • 2. Lvl_DemoGame is a level which loads the newly created character from the save file.

To run the demo from the start, run Lvl_CharacterCreator_InGame. When you’ve created a character, click Play. The blueprints will save your character, load the next scene, and then load your character from the save file.

You’ll need to do additional blueprint work to adapt this to your game’s save file format if you already have one.

As a quick summary of how this is set up:

  • If you open Lvl Demo Game and click Window -> World settings you will see that the Game Mode Override is set to BP DemoGameMode.
  • BP DemoGameMode defines the default Pawn as BP DemoPlayerPawn
  • BP Demo Player Pawn loads the save game in LoadConfigFromGameSave to make the character appearance into what the player created when the game is loaded.
  • It also has some useful methods to change the character appearance in runtime – see the events in the Event Graph.
    • To see this example, open BP_DemoPlayerPawn and look at the input events for keyboard button presses.
    • Pressing J and K is an example that changes the body type
    • Pressing I is an example that changes the ‘Full outfit’ (i.e. a dress)
    • Pressing L is an example that changes the hairstyle
    • Pressing P is an example that changes the hair color.
    • The row name here must exactly match the row name in the Data Table for the wardrobe item being set.
    • These examples also save the appearance to the example Save Game.
    • Press O is a different type of example that directly sets the mesh to something that does not exist in wardrobe items.
    • This might be useful for changing things like the Player’s clothing without changing their save file appearance, for example, or if you otherwise want to make changes to the character appearance that do not save to the Save Game.
  • If you place the BP_UISpawner_InGame blueprint into a scene, it will spawn the in-game character creator including the cameras at the location where you have placed that blueprint. The CameraManager is a variable in WBP_UI_Common if you need to change the camera’s location directly during runtime.
  • Inside the BP_DemoSaveGame blueprint, the CharacterAppearanceConfig variable stores a map of string field names to values that represents the appearance of the character. This is the data that is used to save and load the character appearance.
  • In the WBP_UI_Common blueprint the method Load Character in Demo Level has a variable ‘Demo Level Name’ that changes which level is loaded when you’re using the in-game character creator demo.