ORK Framework Logo - RPG Editor for Unity
  • Features
  • Showcase
  • Guide
    • Documentation
    • Tutorials
    • API
  • ORK 2
    • Tutorials
    • Plugins
    • API
  • Support
  • Forum
  • Get ORK

2D RPG Quickstart

30
  • START 2D RPG Quickstart
  • 01 Initial Setup
  • 02 Player Setup
  • 03 Music & Scenes
  • 04 UI System Setup
  • 05 UI Boxes
  • 06 Flying Texts
  • 07 Status Values
  • 08 Status Effects
  • 09 First Abilities
  • 10 Fighter Setup
  • 11 First Enemies & Battle AI
  • 12 Battle System Setup
  • 13 Animating Battle Start and End
  • 14 Random Battles
  • 15 Animating Actions
  • 16 Player Battle HUD
  • 17 Elemental Attacks
  • 18 Animating More Actions
  • 19 Inventory & Loot
  • 20 Equipment
  • 21 Loot, Start Equipment & Viewers
  • 22 Magic Abilities
  • 23 Caster Setup
  • 24 More Enemies
  • 25 Start Menu & Save Games
  • 26 Menu Screens
  • 27 Interactions
  • 28 Item Collectors
  • END 2D RPG Quickstart

3D RPG Quickstart

30
  • START 3D RPG Quickstart
  • 01 Initial Setup
  • 02 Player Setup
  • 03 Music & Scenes
  • 04 UI System Setup
  • 05 UI Boxes
  • 06 Flying Texts
  • 07 Status Values
  • 08 Status Effects
  • 09 First Abilities
  • 10 Fighter Setup
  • 11 First Enemies & Battle AI
  • 12 Battle System Setup
  • 13 Animating Battle Start and End
  • 14 Random Battles
  • 15 Animating Actions
  • 16 Player Battle HUD
  • 17 Elemental Attacks
  • 18 Animating More Actions
  • 19 Inventory & Loot
  • 20 Equipment
  • 21 Loot, Start Equipment & Viewers
  • 22 Magic Abilities
  • 23 Caster Setup
  • 24 More Enemies
  • 25 Start Menu & Save Games
  • 26 Menu Screens
  • 27 Interactions
  • 28 Item Collectors
  • END 3D RPG Quickstart

Status System Setup

24
  • START Status System Setup
  • 01 Status Values
  • 02 Status Development
  • 03 Attack/Defence Modifiers
  • 04 Status Effects
  • 05 Formulas
  • 06 Ability & Item Types
  • 07 Abilities Part 1: Attacks
  • 08 Abilities Part 2: Support & Sabotage
  • 09 Abilities Part 3: Elemental Magic
  • 10 Items
  • 11 Equipment Part 1: Slots & Slot Set Templates
  • 12 Equipment Part 2: Weapons
  • 12.5 (Optional) Equipment Part 2.5: Weapons
  • 13 Equipment Part 3: Shields, Armor & Accessories
  • 13.5 (Optional) Equipment Part 3.5: Shields, Armor & Accessories
  • 14 Equipment Part 4: Available Equipment Templates
  • 15 Loot
  • 16 Battle AIs
  • 17 Combatants Part 1: General Settings
  • 18 Combatants Part 2: Players
  • 19 Combatants Part 3: Enemies
  • 20 Combatant Groups
  • END Status System Setup

3D RPG Playground

53
  • START 3D RPG Playground
  • 01 Player Setup
  • 02 Start Menu
  • 03 First Interaction
  • 04 Music
  • 05 Areas
  • 06 Collecting Items
  • 07 Displaying Equipment
  • 08 Combatant Prefabs, Icons & Portraits
  • 09 Combatant Animations
  • 10 Camera Positions
  • ANIM 01 Battle Start/End Schematics
  • ANIM 02 Use, Cast & Camera
  • ANIM 03 Abilities & Items
  • ANIM 04 Physical Attacks
  • ANIM 05 Special Actions
  • BATTLE 01 Battle Menu
  • BATTLE 02 Prepare for Battle
  • TURN 01 Turn Based Setup
  • TURN 02 Turn Order HUD
  • ATB 01 Active Time Setup
  • ATB 02 Cast Times
  • ATB 03 Timebar HUD
  • BATTLE 03 The First Battle
  • BATTLE 04 Hunting Move AI
  • BATTLE 05 Spawning Combatants
  • 11 Save Games
  • MENU 01 UI Boxes
  • MENU 02 Template HUDs
  • MENU 03 Overview Menu
  • MENU 04 Menu Screens
  • 12 Shop
  • BATTLE 06 Random Battles
  • DUNGEON 01 Enter the Dungeon
  • DUNGEON 02 The Trapdoor
  • DUNGEON 03 Enemies on Level 1 & 2
  • DUNGEON 04 Traps on Level 3
  • DUNGEON 05 Going Deeper
  • 13 Bestiary (+MENU+ANIM)
  • QUEST 01 Hunting Quests (+MENU)
  • QUEST 02 Guard NPC
  • QUEST 03 Forest Ruin Cheese
  • QUEST 04 Witch NPC with Cheese
  • QUEST 05 Quest Mark HUDs
  • 14 Research Trees (+MENU)
  • CRAFT 01 Crafting Materials
  • CRAFT 02 Crafting Recipes
  • CRAFT 03 Crafting Menu
  • CRAFT 04 Crafting Proficiency & Critical Crafting
  • CRAFT 05 Materials Loot
  • 15 Changing Choice Dialogue
  • 16 Follow Me!
  • BATTLE 07 Sequence Loot Dialogue

3D Action RPG

20
  • START 3D Action RPG
  • 01 Status System Setup
  • 02 Player Setup
  • 03 Player Weapon
  • 04 Player Attacks
  • 05 Enemy: Chomper
  • 06 Chomper Attack
  • 07 Hit & Death
  • 08 HUDs
  • 09 Rolling on the Floor
  • 10 Enemy: Spitter
  • 11 Spit Attack
  • 12 Potion
  • 13 Grenade
  • 14 Item HUD
  • 15 Enemy: Grenadier
  • 16 Grenadier Melee Attacks
  • 17 Grenadier Flamethrower
  • 18 Item Drops
  • END 3D Action RPG

2D Grid Battle RPG

17
  • START 2D Grid Battle RPG
  • 01 Player Setup
  • 02 Prefab & Music Setup
  • 03 Randomizing Combatants
  • 04 UI Setup
  • 05 Battle Start, End & Phase Schematics
  • 06 Battle System Setup
  • 07 Battle Grid Setup
  • 08 Grid Move
  • 09 Forest Battle Grid
  • 10 Battle AI
  • 11 Ability Ranges
  • 12 Death & Use Schematics
  • 13 Attack Schematic
  • 14 Shoot Schematics
  • 15 Battle Selection Interaction
  • END 2D Grid Battle RPG

Schematics

10
  • Simple Start Schematic
  • Battle Start Schematic
  • Battle End Schematic
  • Moving to Target and Back
  • Animating a Base Attack
  • Animating a Magic Ability
  • Animating Target Selection
  • Grid Movement
  • Open and Close UI Animations
  • Flying Text Mover

UI Setups

16
  • Unity UI: Initial Setup
  • Unity UI: TextMesh Pro Setup
  • Unity UI: UI Box
  • Unity UI: Flying Text
  • Unity UI: Dragging Notification
  • Unity UI: Canvas with Screen Space Camera
  • Unity UI: Interaction HUD
  • Unity UI: Simple Player HUD
  • Unity UI: Quest HUD
  • Unity UI: Battle Actions HUD
  • Unity UI: Shortcuts HUD
  • Unity UI: Currency HUD
  • Unity UI: Tooltip HUD
  • Unity UI: Control HUD
  • Unity UI: Attack Modifiers
  • Unity UI: Defence Modifiers

Gameplay Bits

13
  • 2.5D Setup
  • Body Part Weakpoint
  • Click Attack
  • Combining Input Origins
  • Combining Status Value Flying Texts
  • Fun With Flying Text
  • HUD Effects With Conditional Schematics
  • Inventory Containers
  • Local Multiplayer
  • Multi Interaction Controllers
  • Target Selection Lines
  • World Space HUD
  • World Space Dialogue
  • Home
  • Guide
  • Tutorials
  • 2D Grid Battle RPG
  • 09 Forest Battle Grid
View Categories

09 Forest Battle Grid

In this tutorial we’ll set up a battle grid in the forest battle scene.

It’s finally time to set up an actual battle grid! This is done by using a Battle Grid component, which lets you generate a grid and change it to your needs, e.g. paint new cell types.

We’ll set up:

  • a battle grid in the forest battle scene
  • a battle in the forest battle scene
  • camera border

Let’s get to it!

Adding a Battle Grid #

Open the Forest Battle 1 scene (Assets/Scenes/).

Use the scene hierarchy context menu (ORK Framework > Battle > Battle Grid) or the scene wizard to add a Battle Grid to the scene.

Transform #

We’ll place the battle grid in the upper left corner of the scene.

  • Position
    Set to X=-19.5, Y=14.5, Z=0.

Make sure to be exact with that position, or the grid cells won’t match up with the tiles.

Battle Grid Generation #

We’ll now set up how our grid should be generated. We’re creating a grid with a size of 40×30 (40 columns, 30 rows), which matches the size of the tilemap.

Grid generation uses raycasts to find positions for the cells, the individual raycasts are positioned based on the game object’s position and the cell size and offset we set up in Battles > Battle Grid Settings. With our setup, the cells should be 1 world unit away from each other, matching the size of the tilemap’s tiles.

We’ll also make use of the level’s setup – placing walkable cells on positions where we hit the Default layer (the Ground tilemap is on that layer, using a Tilemap Collider 2D set up as trigger) and blocked cells on positions where we hit the Blocked layer (the Blocking tilemap is on that layer, also using a Tilemap Collider 2D).

  • Rows
    Set to 30.
  • Columns
    Set to 40.
  • Position Anchor
    Select Upper Left.
    I.e. our grid’s game object is the upper left corner of the grid, where the first cell (row/column 0/0) will be placed.
  • Cell Type
    Select Ground.
    This is the grid cell type that’s used for regularly hit positions.
  • Empty Cell Type
    Select Blocked.
    Usually this is used for positions that didn’t hit anything, but we’ll set it up to use a separate raycast on a different layer (hitting the Blocked layer).

The Raycast Settings handle which layers are used for our position raycasts when generating the grid.

  • Layer Mask
    Select only the Default layer.
    First select Nothing, then select Default.
  • Use Empty Layer Mask
    Enable this setting.
    We’ll raycast using a different layer mask for using the empty cell type (i.e. our blocked cells).
  • Empty Layer Mask
    Slect only the Blocked layer.
    First select Nothing, then select Blocked.

Alright, we’re ready to generate our grid!

Click on Generate Grid.

You don’t see much change, but you’ll notice that there now are a lot of new child objects under the Battle Grid game object – each is one cell of the grid.

Grid Setup #

Now, let’s turn on showing the grid in our scene view.

  • Show Grid (Editor)
    Enable this setting.
    This’ll show a handle for each cell.
  • Show Prefabs (Editor)
    Enable this setting.
    This’ll show the prefabs of the cell types on each cell.
  • Show Deployment Info (Editor)
    Enable this setting.
    This’ll show labels on deployment cells for who can deploy there.

Your scene will now look like this.

Now it’s time to do some grid painting, we want to change/add the following things.

  • player deployment cells in the upper left area of the grid
  • enemy deployment cells spread across the grid
  • slower movement (Ground Slow) in the brown area in the grid’s center

The Grid Setup in the inspector has the Mode setting, which lets you change the current grid editing mode:

  • Select
    Select individual cells.
  • Move
    Move cells (game objects).
  • Rotate
    Rotate cells (game objects).
  • Paint
    Paint grid cell types on cells.
  • Connections
    Change connections between cells.
    This can e.g. be used to block movement from one cell to another, e.g. allowing jumping down from a ledge, but not moving up.
    You can also connect far away cells, making teleports across the grid.

We’ll change to the Paint mode. You can paint on cells using the left mouse button – holding it down let’s you keep painting while moving the mouse.

You can select 2 cell types, one for regular painting and one for holding shift while painting. Additionally, you can pick a cell’s cell type for painting by holding down CTRL when clicking (and shift + CTRL for the shit cell type).

The Brush Size is measured in cell size, so 1 is the size of 1 cell, 2 the size of 2 cells, etc.

  • Mode
    Select Paint.
  • Cell Type
    Select Player Spawn.
  • Shift Cell Type
    Select Ground.
    In case we need to correct some mistakes.

When switching to Paint mode, you might notice that the cell handles switch to grey – while painting, your currently selected cell type for painting impacts the color of the handles. Cells that have the selected cell type (or shift cell type while holding shift) will be colored blue, otherwise grey. This makes it easy to see what we already painted.

Paint Player Spawn #

Now, we’ll paint a few cells for player placement using the Player Spawn grid cell type, we’ll let the player spawn in the small area in the upper left corner of the scene, where we also placed the Battle Grid.

The P label marks these cells as player deployment cells.

Paint Enemy Spawn #

Change to the Enemy Spawn cell type.

  • Cell Type
    Select Enemy Spawn.

Paint a few cells in the lower right corner of the scene.

The E label marks these cells as enemydeployment cells.

Paint Ground Slow #

Change to the Ground Slow cell type.

  • Cell Type
    Select Ground Slow.

Paint the brown area.

Placing Combatants #

We have our player and enemy deployment cells – these are used for the combatants that are coming into battle, e.g. from enemies defined in a Battle component.

However, we can also directly place combatants on cells, so let’s add 2 combatants and deploy them directly on cells.

Switch to Select mode.

  • Mode
    Select Select.

Select a cell in the center of the area left of the brown area.

Grid Cell Settings #

We now have an individual cell selected, which allows us to change settings of that cell. We’ll add a custom deployment setup for the cell.

  • Own Deployment
    Enable this setting.
  • Deployment Type
    Select Combatant.
    We can define a combatant to deploy here.
  • Faction
    Select Enemies.
  • Combatant
    Select Rogue.

Select another cell in the upper right corner of the scene.

  • Own Deployment
    Enable this setting.
  • Deployment Type
    Select Combatant.
  • Faction
    Select Enemies.
  • Combatant
    Select Ranger.

Our finished grid will look like this.

Adding the Battle #

We’ll now add a battle to the scene.

You can either use the scene hierarchy context menu (ORK Framework > Battle > Battle (None)) or the Makinom scene wizard (Create Game Object > Battle (None)) to create a ready-to-use battle. We’re using the None variant because we don’t want to start the battle by entering a trigger, we’ll set it up to automatically start when we load into the scene.

Add the battle in the player spawning area – remember, our battle start schematic will use the battle as camera target, and that’s the area we want to show when starting the battle.

Battle Component #

We’ll not use a scene ID, this allows us to fight this battle multiple times if we want.

  • Use Scene ID
    Disable this setting.

Battle Settings #

The default setup is already what we need, it’ll use the default battle system (we selected the Phase battle system) and uses the nearest grid (if there is one).

  • Grid Use Type
    Select Nearest Grid.

Combatant Settings #

This is where you can add combatants or combatant groups that’ll be part of the battle. We’ll add multiple individual combatants and want all of them to be in the battle.

  • All Groups/Combatants
    Enable this setting.
    All individual combatants or groups we add will be in the battle.
    Otherwise, one of them will be selected randomly.
  • Use Faction Groups
    Enable this setting.
    All individually added combatants or groups will join a combined group (based on their factions).

Click on Add Combatant/Group to add a combatant.

  • Faction
    Select Enemies.
  • Use Group
    Disable this setting.
    We’ll use a defined, single combatant.
  • Combatant
    Select Warrior.

Copy the Combatant 0 setup.

  • Combatant
    Select Rogue.

Copy the Combatant 1 setup.

  • Combatant
    Select Ranger.

That should be enough combatants – since we already placed 2 on the grid, that makes a total of 5 enemies.

Start Settings #

Currently, the battle has no start setup enabled, i.e. it’ll not start.

We want to automatically start it when loading into the scene – we can easily set that up with the quick setup buttons.

Click on the Autostart button.

Add Camera Border #

Like in the Town scene, there already is a Camera Border game object covering the whole tilemap with it’s Box Collider 2D set up.

All we need to do is add a Camera Border component to it of them using the component menu.

And we’re done with the forest battle scene setup.

Don’t forget to save the scene.

Testing #

Yes, we can already test the grid a bit.

Hit play in the Forest Battle 1 scene, the battle will start automatically (if not, add a short Start Delay in the Start Settings > Auto settings of the Battle component, e.g. 0.1 second).

You can place your combatants and move around … but the enemy can’t. Not yet.

 

Next, we’ll update the battle AI to use grid move.

Share This Article :
  • Facebook
  • X
  • LinkedIn
  • Pinterest
Table of Contents
  • Adding a Battle Grid
    • Transform
    • Battle Grid Generation
    • Grid Setup
      • Paint Player Spawn
      • Paint Enemy Spawn
      • Paint Ground Slow
    • Placing Combatants
      • Grid Cell Settings
  • Adding the Battle
    • Battle Component
      • Battle Settings
      • Combatant Settings
      • Start Settings
  • Add Camera Border
  • Testing
Sitemap
  • Features
  • Showcase
  • Guide
    • Documentation
    • Tutorials
    • API
  • ORK 2 Hub
    • Tutorials
    • Plugins
    • API
  • Support
  • Forum
  • Get ORK
  • Contact
  • Blog
  • Makinom
  • gamingislove.com
Categories
  • News (69)
  • ORK 2 (137)
    • Tutorial (137)
      • Game tutorial (50)
      • Gameplay (32)
      • How-to (55)
  • Release (151)
Search

© 2015 Gaming is Love e.U.

Disclosure: This site may contain affiliate links, which means I may receive a commission if you click a link and purchase something that I have recommended. While clicking these links won’t cost you any money, they will help me fund my development projects while recommending great assets!