In this tutorial we’ll set up our battle system.
The battle system of this tutorial series will use Turn Based battles in Classic mode, i.e. all combatants select their actions at the start of a battle turn – after all have selected their actions, the actions are used in the order they where selected.
We’ll dive into multiple different settings:
- battle menu
- battle system
- target settings
- battle spots
- battle texts
- battle end (loot dialogue)
Let’s get to it!
Battle Menu #
We’ll start with the battle menu, the player will use it to select actions to perform in battle. You can learn more about battle menus in this documentation.
Battle menus are an optional feature, you can also use other ways to select actions, e.g. control maps or shortcut HUDs.
We’ll only use a limited range of options for our battle menu – the base attack, abilities, items and the defend command.
Open the Makinom editor and navigate to UI > Battle Menus. We’ll change the Default battle menu.
Base Settings #
- UI Box
Select Battle Menu. - Add Back Button
Select Last.
The default back button (defined in UI > UI Settings) will be added to sub-menus of the battle menu as the last option.
Title Settings #
We’ll show the combatant’s name as the title of the root menu, and additional information in sub-menus.
- Show Title
Enable this setting. - Show Sub-Menu Title
Enable this setting.
Sub-menus, e.g. target selection or selecting an item, will show a different title. - Text (Title Content)
Set to: <name> - Text (Sub-Menu Title Content)
Set to: <name>: <contentname>
Options #
- Select Last Target
Enable this setting. - Remember Selection
Enable this setting. - Target Sort Type
Select Screen Position.
This’ll sort targets based on their position on screen, from top left to bottom right corner.
Layout Settings > Content Layout #
The Content Layout settings control how the content of buttons in the battle menu is displayed. The default setup shows icon and name of content (e.g. abilities) and adds information content as additional content with the content ID info.
If you remember our initial UI setup, we already set up a button prefab that uses additional content with the content ID info, so we can stick with the default setup.
User Highlight #
Let’s also highlight the current combatant who’s selecting actions by blinking HUDs of the combatant (we’ll add the HUD later).
Click on Add Highlight to add a user highlight.
You can add different highlights, e.g. changing the color of the combatant’s HUDs or game object, or spawning a cursor prefab on the combatant. We’ll change the HUD color (blinking the HUD’s alpha value).
- Highlight Type
Select Fade HUD Color. - Fade HUD
Select Blink. - Time
Set to 0.5. - Interpolation
Select Linear. - Fade Alpha
Enable this setting. - Fade Red/Green/Blue
Disable these settings. - Start Color
Select a white color with about 3/4 full alpha value (A=0.78 or A=200, depending on your color picker). - End Color
Select a white color with about half alpha value (A=0.58 or A=150, depending on your color picker).
Option 0 #
Now it’s time to add the battle menu options, i.e. which actions are available.
A default option is arleady added for us, let’s change it’s setup.
- Type
Select Attack.
This’ll use the combatant’s base attack. - Use Ability Information
Enable this setting.
This’ll use the content information of the combatant’s base attack ability (including the icon) – this can be useful if combatants have different kind of attacks, e.g. an archer having a ‘Shoot’ attack.
Otherwise we can define the content of the button.
Option 1 #
Click on Add Option to add a new option.
- Type
Select Ability. - Type Display
Select Type.
This’ll list the ability types available to the combatant directly in the base battle menu. - Sort By (Type Sorting)
Select either Name or ID based on your preference.
This handles how the ability types are sorted.
Name sorts them by their name.
ID sorts them by their index in the data list. - Sort By (List Sorting)
Select either Name or ID based on your preference.
This handles how the abilities are sorted.
Option 2 #
Click on Add Option to add a new option.
- Type
Select Item. - Type Display
Select Combined.
All items will be combined under a single button.
You can use a sub menu to display item types, but we’ll not use that (Sub Menu setting). - Sort By (List Sorting)
Select either Name or ID based on your preference.
This handles how the items are sorted. - Text (Button Content)
Set to: Items
Option 3 #
Click on Add Option to add a new option.
- Type
Select Defend.
This’ll use the defend command (reduces damage received by 50% in the default setup). - Use Action Info
Enable this setting.
The content information for special actions like defend, escape, etc. are defined in UI > Battle Texts (we’ll get to that in this tutorial).
That’s it for the battle menu.
Battle System #
We’ll continue with setting up some general settings for the battle system.
Navigate to Battles > Battle System > General Settings. You can learn more about battle systems in this documentation.
Base Settings #
This is where you set up the Default Battle System and Default Battle Menu that’ll be used in the game.
A new project already has a standard setup of all 4 available battle systems added, so we can already make sure the battle system we want to use (Turn Based) is selected (which already is the case.
- Default Battle System
Select Turn Based. - Default Battle Menu
Select Default. - Enemy Counter
Select Letters.
In case multiple enemies of the same combatant are in a battle, they can be counted by adding numbers or letters to their names. - Play Damage Animation
Disable this setting.
This handles if damage animations are played on combatants that are currently in action.
We don’t use damage animations in this tutorial series, but it’s a good idea to have this enabled in your projects, since you usually don’t want damage animations to interrupt a combatant currently performing an action. - Play Victory Animation
Enable this setting.
The winning combatants will automatically play the victory animation type (set up in Base/Control >Animation Types > General Settings).
We don’t use one in this tutorial series, though.
Chances & Factors #
These settings handle the base values for things like defending, counter/block/escape chance and other things.
We keep the default setup, e.g.:
- Base Defend Rate
Set to 50.
Our defend command will reduce incoming damage by 50 %.
Range Settings #
Some features can be limited to only be used by combatants that are within a defined range to the player.
This can be useful to e.g. improve performance in large scenes with many combatants – we don’t need it for our setup, as it either doesn’t use the features or battles taking place in a separate, small battle scene anyway.
You can disable using the ranges (but this isn’t really needed), i.e. those features are used without limitations.
Battle Range #
A combatant must be within this range to the player to be considered part of a battle.
- Use Battle Range
Disable this setting.
AI Range #
A combatant must be within this range to the player to be able to use the battle AI.
- Use AI Range
Disable this setting.
Move AI Range #
A combatant must be within this range to the player to be able to use the move AI. We don’t use it for this tutorial series, but you can learn more about it in this documentation.
- Use Move AI Range
Disable this setting.
Default Use Range #
Using abilities and items can be limited to targets within a defined range to the user. These settings define the default use range for all actions – each ability/item can override it with a custom range.
We’ll not use this for our game, since we only fight in a small battle arena where enemies and the player face off each on their own side of the screen.
Turn Based #
We’ll now set up the settings for our turn based battle system. We already selected it as the default battle system (i.e. unless a battle defines using a different battle system, it’ll use the default system).
Navigate to Battles > Battle System and select the Turn Based battle system.
Base Settings #
The base settings handle the battle system type (which is already correct here), control blocks and battle start/end schematics (we’ll set them up next). You can also optionally use a different battle menu for the battle system.
We only need to change the Control Block Settings for now.
Control Block Settings #
The Player Control Block settings handle blocking the player control. We can already use the default setup for this, but let’s take look at some settings.
- Block Player Control
Select Battle.
The controls are blocked during the whole battle. - Allow In Turn
Select None.
When blocking the controls during the whole battle, you can optionally enable controls during the player’s turn, e.g. to allow running around. - Block in Battle Menu
Enable this setting.
This doesn’t really matter when blocking during the whole battle and not allowing controls in turn.
This’d block the controls while the battle menu is open. - Transfer Player Control
This’ll transfer player controls to the player combatant that’s currently selecting actions – not needed when we block controls.
The Camera Control Block settings handle blocking the camera control. We also stick to the default setup, since we have a fixed camera without using any camera changes in battle.
- Block Camera Control
Select Battle. - Allow In Turn
Select None. - Block in Battle Menu
Enablethis setting.
Turn Based Settings #
These settings handle the majority of the turn based related system.
Battle Mode #
Turn based battles can operate in 3 different modes – we’ll use the Classic mode, selecting actions at the start of a battle turn and performing the actions when all combatants finished selecting them. See the battle system documentation for more details on all available modes.
- Turn Based Mode
Select Classic. - Auto Start Turn
Enable this setting.
All combatants start their new turn at the start of the battle turn instead of when they have their own turn to select actions in the battle order.
E.g. our poison effect will happen at the start of a combatant’s turn, so all poison damage happens before the combatants select their actions, potentially killing some before they might be available as targets. - Auto End Turn
Enable this setting.
A combatant’s turn will automatically end under defined conditions.
The default setup will check if the combatant can still use their base attack, any ability or item. The turn will also end if the remaining actions per turn (see below) reached 0.
We’ll stick with this default setup.
Turn Order Settings #
We’ll use the level of the combatants for the turn order, i.e. higher level will have their turn before lower level combatants. If two combatants have the same level, a secondary check will compare their ATK status value.
You can make this more complex by using a formula instead of a combatant’s level, status value or other defined values.
- Turn Calculation
Select Combatant > Level. - Use Secondary Check
Enable this setting. - Secondary Calculation
Select Combatant > Status Value. - Status Value (Secondary Calculation)
Select ATK.
The rest of the turn based settings can be left to their default setup for our game.
However, notice that you can disable automatically showing the battle menu in the Battle Menu Call settings. E.g. if you don’t want to use a battle menu (or only call it when using an input key) and input actions via control maps or other means, that’s where you can disable the battle menu.
Action Settings #
We’ll take a short look at the action settings, even though we don’t change anything here.
Turn based battles allow to use multiple actions per turn – we’ll stick with 1 action per turn (the default setup). If you want an action to not impact the available actions per turn, set it’s action cost to 0.
Individual abilities and items can optionally override the default action cost.
Action Time Settings #
Want to put a bit more pressure on the player? You can optionally limit the time available to select actions during a combatant’s turn using the Action Time settings.
We’re not using it, though. But you can, if you want. You can display a combatant’s action time via HUDs, e.g. as a value bar or text.
Battle System Settings > Battle Options #
We’ll set up to have defending executed before other actions – so even if the enemy would have their turn first, the player defending would be executed before them.
- Defend First
Enable this setting.
That’s pretty much all we need to do for the turn based battle system.
Target Settings #
Navigate to Battles > Target Settings, this is where target selection related settings are made. You can learn more about target selection in this documentation.
Target Selection #
These settings handle how targets can be selected.
Target Menu #
- Use Target Menu
Enable this setting.
This’ll use the battle menu to select targets (default setup).
Target Highlight > Cursor Settings #
We’ll use a cursor prefab spawned on the target’s game object.
Click on Add Highlight.
- Highlight Type
Select Prefab. - Prefab
Select the Cursor prefab.
You can find it in Assets/Tutorial Assets/Prefabs/. - Local Space
Disable this setting.
Otherwise the offset is within the space of the game object, e.g. having the cursor below our players due to the rotation. - On Child
You can use a child object of a combatant for placement (we don’t use this, though). - Offset
Set to X=0, Y=1, Z=0.
The cursor will be displayed slightly above the combatant’s position. - Use Rotation
Disable this setting.
We don’t want the rotation of the combatant to impact the placement.
Due to how our 2D system is set up, that’d otherwise have the cursor be displayed below player combatants instead of above (since they’ll be turned around).
Mouse/Touch Control #
We want to be able to click on a combatant in the scene to select it as a target.
- Layer Mask
Select only the Combatants layer.
Select Nothing to deselect all layers first, followed by Combatants. - Input Type
Select Both.
Allows using mouse and touch input. - Mouse Button
Set to 0.
Uses the left mouse button click. - Finger Count
Set to 1. - Click Count
Set to 1. - Mode
Select Start.
Battle Spots #
Navigate to Battles > Battle Spots, we’ll adjust how our combatants are placed. You can learn more about battle spots in this documentation.
Our player combatants will be placed at the right side of the screen, while the enemies will be on the left side. The position of battle spots is in local space of the battle arena (i.e. the game object with the Battle component). The battle scenes will spawn the battle in the center of the screen.
Base Settings #
- Use Rotation
Enable this setting.
Combatants being placed on battle spots will use the rotation of the spot, i.e. we’ll use the spots to handle player and enemy combatants looking into each other’s direction. - Place On Ground
Disable this setting.
Since we’re using top down 2D style, we don’t need to find the ground.
Player Spots #
There are already 3 battle spots set up for the player – but we’ll only need two. We’ll also adjust their position and rotation.
Member 0 #
- Spot Position
Set to X=7, Y=0, Z=0. - Set Rotation
Enable this setting. - Rotation
Set to X=0, Y=0, Z=180.
Remember, in our 2D setup the Z-axis defines the looking rotation.
Member 1 #
- Spot Position
Set to X=6, Y=2, Z=0. - Set Rotation
Enable this setting. - Rotation
Set to X=0, Y=0, Z=180.
Member 2 #
Click on Remove to remove this spot.
Ally Spots #
We don’t have ally groups in our game, so you can ignore these settings.
Ally spots would only be used if you have at least 3 different factions in a battle, the player, the enemy and a faction allied to the player.
Enemy Spots #
We’ll set up 4 battle spots for enemies, 3 are already added – we only need to adjust the position, the default rotation (X=0, Y=0, Z=0) is already the correct one.
Member 0 #
- Spot Position
Set to X=-3, Y=0, Z=0.
Member 1 #
- Spot Position
Set to X=-1, Y=3, Z=0.
Member 2 #
- Spot Position
Set to X=-5, Y=2, Z=0.
Member 3 #
Click on Add Enemy Spot.
- Spot Position
Set to X=-7, Y=-1, Z=0.
Battle Texts #
Navigate to Battles > Battle Texts, we’ll set up action info notifications (showing actions used by combatants) and flying texts for status effect changes. You can learn more about battle texts in this documentation.
Text Settings #
The text settings define the content of the target choices that target all combatants (all allies, all enemies, all) as well as the content information for special actions like Defend or Escape.
We can stick with the default setup.
Action Info Notifications #
These notifications use a UI box to show the action of a combatant. We’ll have them displayed at the combatant’s on-screen position.
Click on Add Action Infos.
- Player/Ally/Enemy
Enable these settings.
The action infos will be displayed for all factions – you can use this to set up separate info notifications for them. - UI Box
Select Action Info. - Visibility Time
Set to 1.5. - Display At Combatant
Enable this setting.
The UI box is displayed at the position of the combatant. - Update Info
Enable this setting.
If the combatant already shows an info, it’s content will be updated. - Offset
Set to X=0, Y=-100.
The offset is in screen size (pixels) and not world space, so we’ll display it 100 pixels above the combatant’s position.
You can also use the Child Object settings to define a child object of the combatant for placement.
We’ll change the text that’s displayed for the infos – the default is a longer version, adding user/target information. We just want the combatants to show the name of the action they’re using.
We’ll set this for the Attack Info, Ability Info, Item Info, Defend Info, Escape Info and Counter Info.
- Default Content
Set to: <name>
You can disable using the rest of the infos, but you should at least disable the Death Info and Do Nothing Info.
- Enable
Disable this setting.
All info texts already have a default setup that should be ok for this tutorial – feel free to change them to your liking. There’s a lot, though.
Flying Text Settings > Status Effects #
We’ll now set up the default flying texts for status effects. Individual status effects can optionally override this with their custom flying texts.
Click on Add Flying Text.
- Player/Ally/Enemy
Enable these settings.
Add Flying Text #
We’ll show a flying text when adding a status effect to a combatant.
- Show Add
Enable this setting. - Use Content Icon (Content)
Enable this setting.
The status effect’s icon will be used by the flying text. - Text (Content)
Set to: <name> added - Schematic Asset
Select the FlyingTextMover schematic.
Remove Flying Text #
We’ll show a flying text when removing a status effect from a combatant.
- Show Remove
Enable this setting. - Use Content Icon (Content)
Enable this setting. - Text (Content)
Set to: <name> removed - Schematic Asset
Select the FlyingTextMover schematic.
Battle End #
Navigate to Battles > Battle End, this is where we’ll handle distribution of experience and how the loot dialogue will look like. You can learn more about battle end and loot dialogues in this documentation.
Base Settings #
You can optionally split the experience by the number of player combatants, give experience to all group members even if they didn’t fight and other options.
We’ll stick with the default setup, i.e. all combatants fighting in battle will get the full experience.
Loot Dialogue 0 #
The Simple loot dialogue is added by default, but we still need to set it up to display something.
- Loot Dialogue Type
Select Simple.
This will display a series of dialogues, showing the loot, experience and status changes of level ups.
You can use different loot dialogues for different battle outcomes, by default it’ll be used for all (which we’ll do).
Loot Dialogue Settings #
- Show Battle Gains
Enable this setting.
We’ll list the loot and experience the player gained. - Show Level Up Notification
Enable this setting.
We’ll show status changes of a combatant’s level up.
Battle Gain Notification #
Can be used to list loot and experience. We’ll stick with the default text, but we need to select the UI box to display it.
- UI Box
Select Blue Center.
Level Up Notification #
Handles the UI box and some other settings for level up notifications.
The actual content is defined in the Level Up Texts settings below.
- UI Box
Select Blue Center.
Level Up Texts #
These settings define the content of level up notifications.
We’ll keep the default settings, which’ll list the reached level, status value changes and learned abilities, etc.
Save Changes #
And that’s it!
Save the changes using the Save Settings button at the bottom of the editor.
Next, we’ll set up the battle start and end schematics to load into our battle scene and back.