March
07
2016

A grand new feature for ORK Framework’s battle system is in development: Grid Battles.

The new grid battles will be available in all battle system types when using a Battle component (i.e. also when started from the auto battle settings of a combatant, e.g. spawned by a Combatant Spawner). Grid battles allow creating a very tactical battle system in your game – best suited for Turn Based or Phase battles.

When using a battle grid in a battle, the combatants will be placed on the grid and be able to move around on it. Things like move ranges, use ranges or affect ranges can all be defined by individual grid shapes (e.g. a line of 3 cells in front of the user) and will be highlighted on the grid (e.g. showing which cells are available to move to).

Released in ORK Framework 2.8.0

Grid battles have been officially released in ORK 2.8.0 – see the release notes for details.

The Grid Prefabs contain some prefabs that can be used for the grid cell types – please enable Use Prefab Rotation when using these prefabs, since the prefabs already have the correct rotation set up.

Download Grid Prefabs

The implementation of this feature is possible thanks to this group buy proposal – please use this thread to give feedback to the grid battle feature!

Grid Types

There are 2 different types of grids available – square and hexagonal grids. The overall grid settings are defined in Battle System > Battle Grid Settings in the ORK Framework editor.

Grid Cell Types

Grid cell types are used to set up cells in the scene, they’re defined in Battle System > Grid Cell Types in the ORK Framework editor.

Cell types define the prefab and movement costs of grid cells. When a combatant moves on or over a grid cell, the move points of the combatant will be reduced by the cell’s movement costs.

Optionally, a grid cell type can be blocked, not allowing movement on it at all.

Square Grids

Square grids create a chessboard like grid in the scene. A cell in the grid has 4 edges and 4 corners, i.e. 4 possible directions.

news_grid_battles1

Movement is possible horizontally and vertically, but not diagonally. A cell can have up to 4 neighbouring fields – left, right, top and bottom.

Hexagonal Grids

Hexagonal grids create a more complex grid in the scene. There are different types of hexagonal grids available – in general, every 2nd row or column in the grid will be offset. A cell in the grid has 6 edges and 6 corners, i.e. 6 directions.

A cell can have up to 6 neighouring cells, depending on the used type, movement is availalble diagonally and either horizontally or vertically.

Horizontal Even

horizontal even hexagonal grid uses hexagonal cells with a pointy top. Every even row is offset, i.e. row 0 (1st row), row 2, row 4, etc.

news_grid_battles2

Being horizontally aligned, movement is available horizontally and diagonally.

Horizontal Odd

horizontal odd hexagonal grid uses cells with a pointy top. Every odd row is offset, i.e. row 1, row 3, row 5, etc.

news_grid_battles3

Being horizontally aligned, movement is available horizontally and diagonally.

Vertical Even

vertical even hexagonal grid uses cells with a flat top. Every even column is offset, i.e. column 0 (1st column), column 2, column 4, etc.

news_grid_battles4

Being vertically aligned, movement is available vertically and diagonally.

Vertical Odd

vertical odd hexagonal grid uses cells with a flat top. Every odd column is offset, i.e. column 1, column 3, column 5, etc.

news_grid_battles5

Being vertically aligned, movement is available vertically and diagonally.

Grid Scene Setup

For a battle to use a battle grid, it must first be set up in the scene. This is done using the new Battle Grid component.

Grid Creation

This component offers settings for the creation of the actual grid. You’ll be able to define the size (rows and columns) of the grid, as well as where the grid will be created (e.g. the component’s game object being the center or upper left corner of the grid).

The actual grid is created through raycasting at the cell positions – each cell is an individual game object (parented to the grid’s game object) and can be individually moved, rotated and scaled as needed.

The grid will be created using a default cell type and an empty cell type (used if the raycast didn’t hit anything). Optionally, a blocked cell type can be used, automatically setting a cell to be blocked when the ground’s slope exceeds a defined limit. It’s also optionally possible, to use the slope of the hit position for the rotation of the individual cells, aligning the cells (and the cell prefabs that will be spawned on them) with the ground.

Grid Manipulation

After the grid has been created, you’re able to change it to your needs. There are 4 modes available – select, move, rotate and paint.

When the game object with the Battle Grid component or one of the grid cells is selected, the grid can optionally be displayed, each cell is represented by a blue circle in the scene view (and optionally the cell type’s prefab).

Please note that the grid will only be displayed if the grid or a cell is selected and the grid display options are enabled in the inspector.

Select

Allows selecting the individual cells. The cell type of a selected cell can be changed.

news_grid_battles6

Since the grid cells are game objects, you can use the usual ways of manipulating/changing it.

Move

Allows moving the individual cells. It’s recommended to use this mainly for changing the height of the cell (i.e. Y-axis of the position).

news_grid_battles7

Using this to swap cells or rearranging will result in unexpected behaviour in battles, since highlighting, ranges and movement will still rely on the row/column index of the cells.

Rotate

Allows rotating the individual cells.

news_grid_battles8

This can be used to further adjust a cell’s alignment with the ground.

Paint

Allows painting cell types on the grid. You can paint a selected cell type directly on the cells in the scene view by holding down the left mouse button and dragging the mouse over the cells you want to paint on.

news_grid_battles9

You can change the size of the used brush (measured in cell size).