Character Modding - xavier150/MMVS GitHub Wiki

In-Game Character Import Tool

The in-game character import tool is not yet ready.
Check the vote update Modding Character Tool Update


Character Modding (Code Injection Notes)

Since update v0.4.6, the game supports character modding through code. This page provides basic notes for modders familiar with code and asset injection in Unreal Engine. (If you already know how to inject code and assets into Unreal Engine-based projects.)

To create a custom character mod config, inherit from the following UDataAsset class: CharacterConfig/TagCharacterModConfig.h

UCLASS(BlueprintType)
class TAGGAME_API UTagCharacterModConfig : public UDataAsset
{
	GENERATED_BODY()
	
public:

	//Info
	UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Character - Info")
	FText CharacterName;

	UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Character - Info")
	FText CharacterDescription;

	UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Character - Info")
	UTexture2D* CharacterPicture;


	//Fullbody (TPV) cosmetic actor
	UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Character - Cosmetic Actor")
	TSubclassOf<AActor> CharacterFullbodyCosmeticActor;

	//Fullbody (FPV) cosmetic actor
	UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Character - Cosmetic Actor")
	TSubclassOf<AActor> CharacterFullbodyCosmeticActorFPV;
};

You can assign the config to the player using this code:

APawn* Pawn = UGameplayStatics::GetPlayerPawn();
UTagCharacterConfigComponent* ConfigComponent = Cast<UTagCharacterConfigComponent>(Pawn->GetComponentByClass(UTagCharacterConfigComponent::StaticClass()));
ConfigComponent->AddCharacterModConfig(CharacterModConfig);

image image

I don't know how to do code injection, but you can add details if you want.

Character Modding (Editor and SDK)

The sdk is currently not ready. The following notes are set for later when the SDK is available. Check the vote update Modding Character Tool Update

Character Skeleton

Some tips to keep in mind (Any softwares)

Root bone

Using a root bone help with the retargeting and animation. In Blender you can create a simple bone and name it "root". at the origin of the armature. (Not the pelvis or hips bone)

Character Size

Please use a common human size for the character. If you chracter should be giant or tiny you can scale it in game directly.

Twist bones and multi bones limb

The IK retargeting in Unreal Engine 5.4 produces weird results when a straight limb segment change the number of bones between the source and target skeletons.
This is because the FK phases that will try to curve all bone to match the source animation.

We want the limb to stay straight, so it better to use a single bone per limb segment.
If you use twist bones that not an issue you just have to reparent the bone chain the not include them in the IK Rig chain.

Before:
image image

After:
image image

Animations overwrite

Depending your character you may want to force specific poses or override, you can do that directly in the animation blueprint.

Here for Talas I disable the Tail animation and open the eye lips. image

Blender to Unreal Engine

Before all try to have a clean working file, with correct names and hierarchy. No xxx.001 names, in objects, bones, materials, etc. This will avoid you many problems later.

Download and install the add-on Blender For Unreal Engine.

  1. Select the Armature you want to export.
  2. Open the Tool panel in 3D View (N), enlarge it.
  3. Open Unreal Engine Panel > Object > General.
  4. Set the export Type property to "Export Recursive"
  5. Set the Export Procedure property to "Blender Standard (glTF 2.0) image

More details: Skeletal Meshs ‐ Quick Start

Now in Object -> Misc -> Material Check Import Materials, Import Textures. (I strongly recomand to do that at the first import then uncheck material and textures.)

Note: In most of case you alos need to check Invert Normal Maps. Blender use OpenGL normal maps while Unreal Engine use DirectX normal maps. Invert the green channel fix the issue. (I strongly recomand to always use OpenGL normal maps for all tools)

If your character use different parts (Body, Clothes, Accessories, etc.) you have to use modular skeletal mesh. -> Modular skeletal mesh

The most simple is to use several collections for each part of the character.

  • Body
  • Shoes
  • Hat

Or use several collections for each character mix

  • Body + Clothes + Accessories
  • Body + Accessories
  • etc.

image

Now in the export panel -> Nomenclature Set the value Unreal Import Module to "MMVS_ModsRoot" Set the value Unreal Import Location to "Characters/[CharacterName]_Character/Meshes" (This avoids conflicts with other mods and characters)

When it done please check to potential problems with the Check Potential Issues button. This will check all common problems and how to fix them. Then if all is clean you can export the character.

  1. In the export panel click on "Export For Unreal Engine"

  2. Copy import script with "Copy import script (Assets)"
    image

  3. In Unreal Engine paste with Ctrl+V in console and press enter.
    image

Materials and Textures

Now in MMVS_ModsRoot/Characters/[CharacterName]_Character/Meshes You can find all the imported assets.

Depending how you setup the materials and textures in Blender it possible the gltf didn't export and import them correctly. You can remove all try to fix in Blender and re-export/import. Or you can fix that manually by exporting the textures from Blender and recreate the materials in Unreal Engine.

If a material use procedural it may better to bake the texture than fully recreate it in Unreal Engine. Check the vote update Modding Character Tool Update

image

Useful tuto: How to bake textures in Blender

When it done move all the materials to MMVS_ModsRoot/Characters/[CharacterName]_Character/Materials All the textures to MMVS_ModsRoot/Characters/[CharacterName]_Character/Textures

Character Animation Blueprint

Create a new "Animations" folder for the character animations in MMVS_ModsRoot/Characters/[CharacterName]_Character/Animations

  • Create a new Animation Blueprint based on "TagModAnimInstance" and name it "ABP_[CharacterName]_CopyPose"

  • Open it and in the AnimGraph add a "Copy Pose from Mesh" node. In the settings check "Use Attached Parent", "Copy Curves" and "Copy Custom Attributes".

  • Add a "MMVS Varitation" Check "Apply Head rescale in FPV" and select the head bone name. This is used to rescale the head at zero when the player switch to FPV mode. (Don't use it if you use a different model for FPV already set without head)

  • Connect "Copy Pose from Mesh" to "MMVS Varitation" and then to "Output Pose".

  • Save and close it.

IK Rig Asset

Note: This step may complicated I will try to automate in future.

IK Rig Setup

  • Go in MMVS_ModsRoot/Characters/[CharacterName]_Character/Animations

  • Create a new "IKRig" asset and name it "[CharacterName]_IKRig"

  • Open it and setup "Full body IK" Solver.

    • Right click on the Hips or Pelvis bone -> "Set Retarget Root".

    • Right click again on the Hips or Pelvis bone -> "Set Root Bone on selected solver". Root Behavior: "Free" Pull Chain Alpha: 0.0

    • Add IK Goals for hands and feet and name it: "LeftHandIK", "RightHandIK", "LeftFootIK", "RightFootIK"

    • Set following settings for each goal:

      • LeftHandIK -> Chain Depth: 2 (Forearm, Upperarm)
      • RightHandIK -> Chain Depth: 2 (Forearm, Upperarm) If plantigrade:
      • LeftFootIK -> Chain Depth: 2 (LowerLeg, UpperLeg)
      • RightFootIK -> Chain Depth: 2 (LowerLeg, UpperLeg) If digitigrade:
      • LeftFootIK -> Chain Depth: 3 (Calf, LowerLeg, UpperLeg)
      • RightFootIK -> Chain Depth: 3 (Calf, LowerLeg, UpperLeg)
    • Add settings for each bone with right click -> "Add settings to selected bone":

    • Pelvis bone: -> Rotation Stiffness: 0.95

    • Shoulder or Clavicle -> Rotation Stiffness: 0.95

    • Forearm -> Set limit on "Free" for the axis that should rotate and set "Locked" for the others. (Most of the time X is the free one)

    • Foot -> Rotation Stiffness: 0.85

    • Calf (If plantigrade) -> Set limit on "Limited" for the axis that should rotate and set "Locked" for the others. (Most of the time X is the free one)

      • Set Min -180, Max 105
    • Ankle (If digitigrade) -> Set limit on "Limited" for the axis that should rotate and set "Locked" for the others. (Most of the time X is the free one)

      • Set Min -110, Max 180
      • Rotation Stiffness: 0.5
    • Lowerleg (If digitigrade) -> Set limit on "Limited" for the axis that should rotate and set "Locked" for the others. (Most of the time X is the free one)

      • Set Min -180, Max 105

    You can adjust the settings to have better results depending on the character skeleton. Don't forget to save.

Ik Retarget Chain Setup

- When all is done Click "Auto Create Retarget Chains"
Add the missing chains if some are not created.
- Set the following chains settings:
	- Root (If exist)
	- Spine
	- Neck
	- Head
	- Tail (If exist)
	- Jaw (If exist)
	- LeftArm -> IK Goal: LeftHandIK
	- RightArm -> IK Goal: RightHandIK
	- LeftLeg -> IK Goal: LeftFootIK
	- RightLeg -> IK Goal: RightFootIK
	- LeftClavicle
	- RightClavicle

	All fingers:
		- LeftThumb
		- LeftIndex
		- LeftMiddle
		- LeftRing
		- LeftPinky
		- RightThumb
		- RightIndex
		- RightMiddle
		- RightRing
		- RightPinky
	All toes:
		- LeftThumbToes
		- LeftIndexToes
		- LeftMiddleToes
		- LeftRingToes
		- LeftPinkyToes
		- RightThumbToes
		- RightIndexToes
		- RightMiddleToes
		- RightRingToes
		- RightPinkyToes
image

You can now save and close the IK Rig asset.

IK Retargeting Asset

Note: I will try to automate this step in future too.

  • Create a new "IKRetargeter" asset and name it "RTG_CobbleTo[CharacterName]"
  • Open it and set Source IK Rig to "Cobble_IKRig"
  • Create a new "IKRetargeter" asset and name it "RTG_TalasTo[CharacterName]"
  • Open it and set Source IK Rig to "Talas_IKRig"

For the both assets do the following: - Set Target IK Rig to "[CharacterName]_IKRig" - In CHain Mapping -> Auto-Map Chains -> Map All (Fuzzy) - In Click LeftLeg chain - Set Blend to Source: 1.0 - Set Static Offset to fit with the character leg position.

Character Actor Blueprint

Create a new "BP" folder for the character blueprint and game logic in MMVS_ModsRoot/Characters/[CharacterName]_Character/BP

  • Create a new Blueprint Class based on "Actor" and name it "B_[CharacterName]"

  • Create a new Blueprint Class based this time on "B_[CharacterName]" and name it "B_[CharacterName]_FPV"

  • Open "B_[CharacterName]" and add your character main Skeletal Mesh Component.

  • In the Details panel set the Anim Class to "ABP_[CharacterName]_CopyPose"

Character Mod Init

  • Go in MMVS_ModsRoot/Characters/[CharacterName]_Character

  • Right click -> Miscellaneous -> Data Asset select "TagModInit" as the class.

  • Name it "ModInit_[CharacterName]" Here you created the mod init that will be used to detect and load game mods.

  • Create a new Data Asset, this time select "TagGameModDataAsset" as the class.

  • Name it "Mod_[CharacterName]" Here you created your mod, you can add Title, Description, Author, Version, etc.

  • Create a new Data Asset, and select "TagCharacterModConfig" as the class.

  • Name it "CMC_[CharacterName]ForCobble"

  • Redo it and name it "CMC_[CharacterName]ForTalas" Here you created the two character configuration for your mod, one to replace Cobble and one for Talas. Here you can set the character name, description, picture, etc.

  • Open "ModInit_[CharacterName]" in Game Mods add a new entry and set: "Mod_[CharacterName]"

  • Close and save Open "Mod_[CharacterName]" in Character Mod Configs add two new entries and set:

  • "CMC_[CharacterName]ForCobble"

  • "CMC_[CharacterName]ForTalas"

  • Close and save

  • Open "CMC_[CharacterName]ForCobble" and set:

    • Config Tags: Add "Character.Cobble"
    • Character Fullbody Cosmetic Actor: "B_[CharacterName]"
    • Character Fullbody Cosmetic Actor FPV: "B_[CharacterName]_FPV"
    • Cosmetic Set Method: "Retarget Cosmetic Set"
    • IK Retargeting Asset: "RTG_CobbleTo[CharacterName]"
    • Addditional Modifications Tags: Add "Modding.Character.DisableDigestiveThreads", "Modding.Character.DisableFootThreads" and "Modding.Character.DisableSweatDrop".
  • Close and save

  • Do the same for "CMC_[CharacterName]ForTalas" but use "Character.Talas" and "RTG_TalasTo[CharacterName]"

Build mod package

Now you have to build the mod package to be able to use it in game. This step it not ready yet possible for the moment.

⚠️ **GitHub.com Fallback** ⚠️