Creating your own pieces

This tutorial will show you how to create your own pieces. We will use the following board,

with these rules:

One turn per player.

Al blue ones moves first, then red.

You can move anywhere.

You can’t capture enemy pieces.

You can’t win or lose.

1Make a new empty GameObject. Add a SpriteRenderer, and set the sprite to whatever image you want. Add a GridGamePiece component. Finally, you make this GameObject a prefab.

2Create another empty GameObject, and give it the same name as the piece created in the previous step with _Logic or _Setting added so that you know they are related. Add a Grid Game Piece Setting component, and fill in the settings. For these examples all pieces have an Id of “piece” (they will have the same rules), and there is one player for each color and shape. Set the piece prefab to the prefab you made in the previous step.

Add a Open Space Move Rule component so that players can move pieces to any open position on the board.

Make this GameObject a Prefab too.

You can also add more piece rules. The default ones can be found by clicking on Add Component and then Gamelogic|Stragegy|Piece Rules. You can also create your own piece rules.

3To add the piece to the board, you need to configure two components on the GameBoard. On the Grid Game Rules component, add all the logical piece prefabs to the Pieces field in any order you want.

On the GridGameManager, add the pieces as you want to position them on the grid in the initial configuration.

Remember that the Piece ID and the Player ID are set on the *_Logical prefab of the piece.