Entity
So let's start our tutorial with creating a Building. First, we need to arrange the folders:
- Create a Building folder in a related Buildings directory. For the main repo the example is Content\Buildings\FactionName\Building
- Create the proper sub-folders (Animations, Materials, Meshes, Textures, UI).
- Assume we've just received all needed assets from our modelers and placed it by drag-n-drop to their respective folders.
First we need to create the configuration. Every entity - unit, building, lair, etc. must have a config. It is the place where we store all data like health, damage, Static Meshes (SM), etc. Basically, it is just a Data Asset inherited from RTSEntityConfig or otherRTS***Config classes. Inherited means you have to pick this class when you create the asset/blueprint and you get the search field (second screenshot below).
You can create data assets by right-clicking in the file explorer in the Unreal Editor and navigating to the Miscellaneous tab > Data Asset.
Type "building" in the search bar and pick RTSBuildingConfig. Press Select, the Data Asset will be created, and you’ll be prompted to rename it.
Our EC files should always use the naming convention EC_[InsertName]. For the sake of this tutorial, we’ll use EC_BuildingTutorial
During development some fields or sections in this config may be changed / moved / removed. As such, the screenshots below may be outdated at the time you read this.
We’re now ready to open our Data Asset and set up the building. We’ll be going through all the (sub)sections that the asset is composed of:
- Building
- Type
- Health
- Construction
- Abilities
- UI
- Vision
- Experience
Building
Start Construction After Spawn
This defines whether a building starts its build phase when spawned, or is spawned “finished” immediately. For the normal RTS building scenario, you should check this box.
Producible Units
In this section, you can add unit EC’s to your building. The building will then be able to produce these units per the data provided in their Data Assets.
Spawn Relative/Rendezvous
This section allows you to define the spawn location for your produced units. The Spawn Relative Location is the initial spawn position, while the Rendezvous Location is the position the units will move towards when they are spawned. More info on how to define these values in this guide.
Building Meshes
In this section we will be bringing the building to life! We’ll be adding Skeletal Meshes (SK) and/or Static Meshes (SM) to make the building functional. The files needed for this section should be available in the Meshes folder of your building.
Mesh L1 - Mesh L2 - Mesh L3
Those are the standard meshes for each level of the building. Currently, we’re only making the level 3 appearances, so we’ll insert the same meshes for all three levels. Almost always, this will be the Idle (_Idl) file. NOTE: In order for the building to be producible, you NEED to at least add a Static Mesh to the Mesh L1, even when the proper Skeletal for appearance is available, as can be seen in the picture below. The L1 Static Mesh is used to define the collision when you are selecting a spot to build the building in-game.
Mesh Damaged 1 - Mesh Damaged 2 - Mesh Destructed
In this section you’ll define the destruction phases of the building. The assets will be named _D1 and _D2 accordingly. The Destructed phase is where a building is destroyed. This asset is named _Dest.
Mesh Collision
While the SM under Mesh L1 defines the collision check for the build phase, the Mesh Collision will define the collision once a building is completed. Currently, there are no scenarios where the collision differs between the two, so the same Collision file is used. If you do not have a Static Mesh or its collision isn’t set up, follow this guide to generate it.
Building Animations
This section works almost identical from the Building Meshes section. The main differences are that unlike in Mesh L1 from Building Meshes, there are no exceptions attached to Anim L1 in Building Animations. Also, the naming conventions work the same. For each state, you have the option to choose between Animation Assets or Materials. Sometimes our artists will opt for just a change in material in parts of the destruction phase to adjust only the appearance, instead of also including a new animation. You’ll know this as either an Animation asset or Material asset will be present with the correct naming convention, like _D1.
As such, we’ll be needing the files in the Animations folder or Materials folder of your building, depending on the assets made by our artist.
Decal
Decals are materials that are projected as textures on surfaces, in this case on the ground. It’s important the Rotation is set to Y -90 to make the Decal horizontal and thus be able to project it. Other than that, we’ll not go into more details on gathering these values. They should be provided by the artist via a Blueprint that functions as reference. If we do not set a Decal, a green placeholder Decal will be projected.
You’ll need the _Fund material found in the Materials folder of your building.
Type
Entity Class
Point out what class of entity to spawn. We are working on making a list that describes all classes, for now we focus on the ProductionBuilding class, used for producing units.
Is Neutral
This defines whether the entity will be “neutral”, like wild creeps (wargs and trolls on the map). Those will attack any player, they don’t pick sides. Do not check this for Entities intended to be used by players. (Neutral entities are part of team 66).
Health
Current Health
This is the health value that an entity spawns with. Almost in any case this should be equal to Maximum Health. Setting this value lower will mean the entity starts out damaged.
Maximum Health - The Maximum Health that an entity spawns with.
Current Armor - Currently armor should not be utilized for buildings and as such be left on “Default”.
Default Armor - The default armor the entity spawn with, if Current Armor is set to Default.
Heavy Armor - An upgraded armor state for the entity. Currently we do not utilize this for buildings, and this will remain the case for most buildings in the future.
Construction
Resources Cost - The resources it costs to build the entity.
Command Points Cost - The command points required to build the entity. For buildings, this is always left on 0.
Time Of Production - The time the building production process takes, from when the Porter starts it. The building animation also properly adapts its speed according to this time.
Abilities
Abilities - These are abilities handled by the Gameplay Ability System (GAS). Currently, these are not used for buildings.
UI
UIName - The name the entity will display in the UI.
UIDescription - The description the UI will display in the description box.
UILevel Requirement - The level requirement that will be displayed in the description box. This does not apply to buildings, but in any case is just visual. Leave it at 0 to not display.
UICurrent Level - Should be set by CurrentLevel from the Experience category.
UIMax Level - Should be set by MaximumLevel from the Experience category.
UIHealth - Should be set by MaximumHealth from the Experience category.
UIDamage - The attack damage shown in the description box. This does not apply to buildings, leave it at 0 to not display.
UICost - Should be set by ResourcesCost from the Construction category.
UIShortcut - Visual representation for the hotkey of this entity. We currently do not have this functionality build. Leave it empty.
UICommand Points - Should be set by CommandPointsCost from the Construction category.
UIPurchase Level - Should be set by CurrentLevel from the Experience category.
UIIs Passive Ability - This is used for the description box for abilities. Buildings do not utilize it, leave it unchecked.
Portrait - The portrait that will be displayed in the bottom right Palantir Menu when the entity is selected.
Icon - The button icon that will be displayed for this entity. In a building’s case, in the builder bar (doesn’t show up yet).
Vision
Sight Radius - Radius in which the actor reveals areas covered by fog of war, in cm.
Experience
Current Experience - The experience the actor will spawn with. Almost always should be left at 0.
Current Level - The level the actor will spawn in. For a ProductionBuilding the general BFME use case is to start at level 1.
Maximum Level - The maximum level the actor can get. For ProductionBuilding the general BFME use case is level 3.
Experience Points for Each Level
The experience points required for the entity to level up to the next level, customized per level. For buildings, this is only used for resource buildings, they gather experience through producing resources. ProductionBuildings in might level up via manually purchasing the level-up upgrade. If setting this up, please notice that the Array starts at 0, and this means level 1. So, Array 0 is the experience required from level 1 to 2, Array 1 is the experience required from level 2 to 3, etc. This means the size should always be MaximumLevel -1.
Calculation: [0] = 5 exp is the required exp to reach level 1.
[1] = 10 exp is the required exp to reach level 2.
And so on.
Bounty - Experience given to units (other actors) when the actor dies.
Splash Radius - Distance between our dying actor and the furthest enemy getting the experience bounty.
Production Experience - Experience given to a production building when units spawn from it. This value is not meant for buildings, leave it at 0.