Skip to content

English

ABoy edited this page Dec 8, 2024 · 33 revisions

Welcome to the Miracle Heroes Mod Development Wiki!

The Mod development tutorial includes:

Preface

《Miracle Heroes》is developed using Unreal Engine 5.4.4. In the Mod project, we have opened up 70% of the content, allowing players to access and create mods according to their needs.

Steam

Installation Environment

Download the Unreal Engine (version 5.4.4) from EPIC.

Download the Mod project on Steam.
(If the ModKit is not visible, you may need to enable tools in the categories section by checking the relevant option.)

Double-click AnimalBrothers.uproject to open the Mod project.

You can also download ModKit through SteamCMD. Specific steps: https://steamcommunity.com/app/3095600/discussions/0/594008672803430311/

Mod Introduction

How to Create a Mod?

  1. First, create a new plugin and name your GameFeature (it's best not to duplicate names with other mods, preferably consistent with the Mod name).

image

  1. You can find the newly created plugin in the Plugins directory and set its initial state to Active. All resources used by the Mod should be placed in this plugin directory afterward.

image

  1. Congratulations, your first Mod plugin has been successfully created!

How to Define New Items?

All items in the game are based on BP_ToolBase (/Game/Blueprints/Items/Tools/BP_ToolBase).

  1. Create a new Actor in the plugin directory that inherits from BP_ToolBase.
  1. Configure the item's attributes:
    • NeedSpawnActor: Indicates whether the Actor needs to be generated in the world. For items that only add attributes, keep this false unless your item has special functions.
    • AddAttribute: The attribute influenced by the item.
    • NeedAddWorldAttribute: Whether the item will affect world attributes.
    • WorldAddAttribute: World attributes to be influenced.
    • ItemAttTag: The tag of the item (heroes configured with this tag are more likely to find this item). image
    • ItemInfoConfig.ItemName: The name of the item.
    • ItemInfoConfig.ItemSubtitle: The tag of the item (like: item | unique) (just a label with no functionality).
    • ItemInfoConfig.ItemDescription: Detailed explanation of the item.
    • ItemInfoConfig.ItemTag: The unique tag of the item.
    • ItemInfoConfig.ItemLevel: The level of the item (0-3).
    • ItemInfoConfig.ItemValue: The base price of the item.
    • ItemInfoConfig.MaxStacking: Maximum stack size of the item.
    • ItemInfoConfig.Icon: Icon of the item.
    • ItemInfoConfig.UpdateItems: Other items the item can be combined with to create a new one (currently only for weapons and equipment). image

How to Define New Weapons?

All weapons in the game are based on BP_WeaponBase (/Game/Blueprints/Items/Weapons/BP_WeaponBase).

There are separate base classes for melee and ranged weapons (most cases inherit from these two classes).

  • Melee Weapons: BP_WeaponMelee (/Game/Blueprints/Items/Weapons/BP_WeaponMelee).
  • Ranged Weapons: BP_WeaponRemoteBase (/Game/Blueprints/Items/Weapons/BP_WeaponRemoteBase). image

Define Melee Weapons

  • CharacteAddTag: Affected by player attribute additions (e.g., 100% melee damage as in the image).
  • CharacterAddRangeMultip: Percentage of player attack range addition.
  • AttackRangeMin: Minimum attack range.
  • Entrys: Synergy.
  • WeaponDefaultAttribute: Default attributes of the weapon.
  • WeaponAddAttribute: Bonus to player's attributes.
  • TraceRadius: Damage detection radius.
  • StartDamageSocket: Damage detection start socket.
  • EndDamageSocket: Damage detection end socket.
  • TraceNum: Detection density.
  • AttackMode: Attack mode.
  • SwingingAttack: Swiping attack configuration.
  • ThornAttack: Piercing attack configuration.
  • SmashingAttack: Smashing attack configuration.
  • ItemInfoConfig.NextLevelActor: Next level weapon.
  • ItemInfoConfig.UpdateItems: Items required for an upgrade.

Define Ranged Weapons

  • Rotation Speed: Weapon rotation speed.
  • AimSpeed: Weapon aiming speed.
  • Start Shoot: Immediately triggers shooting (does not use Montage to control shooting, commonly used for firearms).
  • ShootNum: Number of shootings (if 0, indicates no need to reload, can shoot continuously).
  • CoolingDuration: Reload cooling time.
  • ShootMontage: Shooting animation.
  • ReloadMontage: Reload animation.
  • Arrow: Arrow class.
  • ArrowSocket: Socket where arrows are generated.
  • ShowArrowClass: Generated arrows (for display purposes).

Projectile Configuration:

  • AmmunitionObjectPool: Bullet object pool.
  • Destroy Time: Bullet destruction time.
  • Trace Radius: Bullet damage detection radius.
  • Speed: Bullet flight speed. image

Add the Item (Weapon) to the Card Pool

Create a new Component and add the following logic. image In GameFeature, add the following configuration. image

How to Define New Heroes?

All heroes inherit from BP_MainCharacter (/Game/Blueprints/Character/Main/BP_MainCharacter).

BP_MainCharacter_WithSkill is the base class for heroes with active skills.

Define Hero Attributes

  1. Create a new Actor in the plugin directory that inherits from BP_MainCharacter.

  2. Define the hero's attributes:

    • HeroDetails.HeroName: Hero's name.
    • HeroDetails.briefintroduction: Hero title.
    • HeroDetails.HeroStory: Hero's story.
    • HeroDetails.HeroIcon: Hero icon.
    • HeroDetails.HeroDetails: Detailed description of the hero (abilities).
    • HeroDetails.StartSelectWeapon: Weapons the hero can choose initially.
    • HeroDetails.StartHas: Items or weapons the hero starts with.
    • HeroDetails.Level: Hero difficulty (currently doesn't affect anything).
    • HeroAddAttributes: Attributes the hero initially possesses.
    • HeroAddWorldAttributes: World attributes affected by the hero.
    • AddPercentageAttributes: Percentage additions affecting the hero.
    • UpgradeAddAttribute: Attributes increased upon hero upgrade.
    • Vampire Max Add Health Setting: Maximum health drained per second.
    • DefaultSpeed: Default movement speed.
    • MaxWeapons: Maximum number of weapons.
    • NotAddWeaponAndToolTags: Tags for weapons or items that cannot be found.
    • Add Tool Probability By Attribute: Probability of finding items influenced by attributes.
    • Add Tool Probability By ItemTag: Probability of finding items influenced by tags.
    • Add Weapon Probability By Entry: Probability of finding weapons influenced by synergy.
    • Add Weapon Probability By ItemTag: Probability of finding weapons influenced by tags. image

Note that the attribute ID of the hero must be regenerated, otherwise in multiplayer games, the hero cannot be initialized image

Add Hero to Selection List?

Create a new Component and add the following logic. image

In GameFeature, add the following configuration (add to BP_CreateManager). image

How to Add New Levels?

New levels should start by copying ExampleLevel (/Game/Level/ExampleLevel) into the plugin directory.

PostProcessVolume: Must add Post label (otherwise the graphics settings system cannot recognize it).

BP_WorldManager: Manages the level

  • DifficultyBonus: World attributes influenced by the level.
  • Enemy Max Num: Maximum number of monsters allowed in the level.
  • BGMSounds: Random background music.

BP_CheckKillBox: Players or monsters falling onto this box will be processed (e.g., players sent to spawn, monsters destroyed).

Add Level to Selection List?

Create a new Component and add the following logic. image Level Configuration Information:

  • LevelName: Name of the level.
  • LevelDetail: Detailed introduction of the level.
  • LevelIcon: Icon of the level.
  • Difficulty: Level difficulty (0-5) (just for display).
  • LevelPath: Level path (e.g., /ExampleMod/NewLevel/NewLevel).
  • LevelSetttings: Level difficulty settings (can be obtained from previous difficulties, like DT_TempleLevelSettings_00).
  • LevelRowName: ID recorded after the level is cleared (format must be: name_number, e.g., NewLevel_0).
  • CheckLock: Confirm whether the level is unlocked by pre-clearance (leave empty for no unlocking requirement; if required, add LevelRowName).
  • Endless: Whether it is an endless level.

In GameFeature, add the following configuration (add to BP_CreateManager). image

How to Add New Mutations?

All mutations inherit from BP_AlienationBase (/Game/Blueprints/Datas/Alienation/BP_AlienationBase).

BP_AlienationLevelNum is mutated based on the number of waves. Mutation attribute configuration:

  • EndLevel: Duration of the mutation's wave.
  • AlienationData.Name: Name of the mutation.
  • AlienationData.ICON: Icon of the mutation.
  • AlienationData.Detail: Detailed description of the mutation.
  • AlienationData.Actor: Actor generated by the mutation (fill with Actor itself).
  • AlienationData.OnlyMultiple: Whether the mutation only appears in multiplayer mode.
  • AlienationData.AddAttribute: Attributes added by the mutation.
  • AlienationData.WorldAddAttribute: World attributes added by the mutation.
  • AlienationData.ID: ID of the mutation (a new ID needs to be generated). image

Mutations will call init upon being generated or loaded.

image

Add Mutation to Random List

Create a new Component and add the following logic.

image

In GameFeature, add the following configuration (add to BP_WorldManager).

image

How to Add New Enemies?

All enemies inherit from BP_EnemyBase (/Game/Blueprints/Character/Enemy/BP_EnemyBase).

There are different types of enemies:

  • BP_Enemy_MoveToCharacter: Moves towards the player.
  • BP_Enemy_Out: Avoids the player.
  • BP_Enemy_Shoot: Shoots the player from a distance.
  • BP_Enemy_Sprint: Charges the player.
  1. Create an Actor in the plugin directory that inherits from one of these types.

  2. Create a new object pool for the enemy. image image

  3. Copy the previous monster data table,Configure enemy generation in DT_TempleLevelSettings_00. image

  • EnemyPool: Enemy object pool.
  • StatTime: Time when enemies start spawning.
  • EndTime: Time when enemies stop spawning.
  • SpawnInterval: Spawn interval.
  • SpawnNumLine: Spawn curve to control the number of spawns (changes the number of spawns over time).
  • SpawnType: Spawn type (clustered or distributed).
  • AttributeBonus: Adjustment of monster attributes (e.g., 50% health adjustment). image

Define Enemy Attributes

  • GetMoney: Drops money.
  • GetEXP: Drops experience.
  • Probabilityofdroppeditems: Probability of dropping items.
  • DefaultSpeed: Default movement speed.
  • AnimSpeed: Animation playback speed (ensures character movement animation matches actual movement).
  • IsBoss: Is it a boss?
  • CanMove: Can it move?
  • DefaultAttribute: Initial attributes of the enemy.
  • LevelNumAddAttribute: Attribute growth per wave.
  • EnemyDetails.EnemyName: Enemy name.
  • EnemyDetails.EnemyIcon: Enemy icon.
  • EnemyDetails.EnemyDetails: Detailed introduction of the enemy.
  • EnemyDetails.EnemyType: Type of the enemy.
  • CheckAttackCharacterTime: Re-target player at regular intervals.
  • MoveRandomRadius: Random move radius.
  • AttackRange: Attack range. image

Wave Configuration

  • LevelDuration: Duration of the wave.
  • EnemySettings: Enemy configuration for the wave.
  • SelectMutation: Whether to select mutations for the wave.
  • LevelSpawnClass: Actors spawned during this wave (currently for spawning bosses, can serve other purposes).
  • LevelTipMessage: Message displayed before the wave begins. image

How to Test Mods in the Editor?

Set the Mod status to Active to activate it. image

In the game, you can press Alt+Shift+O to open the test menu

image

Begin Mod Packaging

  1. Click to open the packaging interface. image

  2. Before creating a Mod, you need to fill in some basic information:

    • GameFeatureName: Name of the GameFeature.
    • ModName: Name of the Mod.
    • Version: Version number of the Mod.
    • Author: Author of the Mod.
    • ModIntroduction: Detailed information about the Mod.
    • IsOnline: Whether the Mod supports online play. image
  3. Click CookMod and wait for completion, then click PackageMod.

The Mod files will be saved in the \AnimalBrothers\Saved\Mods directory.

Share Mod

Upload to Steam Workshop

Before uploading, please ensure that the Steam client is open and open UGC.exe to upload items image

image

Upload attribute instructions:

  • FileID: Steam's item ID. Set to empty to create a new Mod; to update a Mod, fill in the existing ID.
  • ItemPreviewIMG: Preview image of the Steam Mod.(Jpg or PNG of 512X512 is less than 1MB)
  • Visibility: Whether the Mod is publicly visible.
  • ItemTags: Tags for the Mod (separated by commas).
  • To make the Mod visible, you must agree to the Workshop terms. image

Other Ways to Install Mods

Copy the Mod files to the game's Mod directory (AnimalBrothers\Content\Paks\Mods\).

Restart the game to see the Mod.

Attributes Overview

Content/Blueprints/Datas/ : File Location

  • DT_CharacterAtt: Player character attributes
  • DT_EnemyAtt: Enemy attributes
  • DT_WeaponAtt: Weapon attributes
  • DT_WorldAtt: World attributes

Lifecycle in the Game

Content/Blueprints/Manager/ : File Location

  • BP_WorldManager: Manages the start and end of waves

  • BP_CreateManager: Pre-game creation manager

  • BP_SpawnEnemyTimer: Enemy spawner

  • BP_SpawnRandom: Boss and leader generator

  • BP_CheckKillBox: Manages characters falling out of the map

  • BP_Inventory: Player's inventory, can be overridden and customized

  • BP_ToolSysteam: Player refresh and synthesis system, can be overridden and customized

    • For reference, see the BP_Warrior_Tribe hero.

In-Game Interfaces

  • BPI_World: Enables the execution of custom code during the game lifecycle

image

image

Project Directory Structure

image

  • Content/
    • Blueprints/

      • Character/
        • Enemy/: Definitions for all enemies
        • Main/: Definitions for all heroes
      • Items/: Definitions for all items
        • Armors/: Equipment items
        • Tools/: Usable items
        • Weapons/: Weapon items
      • UMG/: All UI elements
      • Interface/: Definitions for all interfaces
    • EditorTools/: Data tables are written into actors via WBP_CreateActor

      • Data/: All item data
        • DT_ArmorInfo: Equipment data table
        • DT_EnemyInfoTable: Enemy data table
        • DT_HeroInfo: Hero data table
        • DT_ToolInfo: Tool data table
        • DT_WeaponInfo: Weapon data table
    • Level/: Map files

      • LevelSettings/: Map enemy spawn configurations
        • Temple/: Endless enemy spawn definitions for difficulty levels 0-5

FAQ

Cannot Package Correctly

If the project cannot package correctly, ensure the plugin is enabled in the project. If the issue persists, try deleting the Saved folder.

Cannot Find the Created Mod?

Ensure the plugin is enabled. image

Note that Mod will only package the contents of the plugin directory

Note that Mods only package the content in the plugin directory, so any modifications made to the content in the project file will not take effect

How to add GamePlayTag correctly?

  1. Create a new data table in the plugin directory, inheriting from GameplayTagTableRow

image

  1. Add data tables in project settings

image

How to debug mods. View running logs?

Switch Steam to the ModDebug branch. This branch is packaged using the beta version, and the logs can be seen in the directory

image