O'Reilly logo

Unreal Engine Game Development Blueprints by Nicola Valcasara

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Writing our Blueprints

Now, we need to add some logic to this project. In order to achieve the tic-tac-toe mechanics and develop speaking, we need to do the following:

  • Handle a turn-based mechanic
  • Know when someone wins
  • Show the state of the game
  • Store a winning counter for each player
  • Handle the restart

Turn-based mechanics

Open PuzzleBlock and PuzzleBlockGrid Blueprints as we are going to frequently switch between them.

First of all, we need to know which player has to move: the X or the O. In order to achieve this, also since this is a two-player game, we can use a simple Boolean variable that is stored on the PuzzleBlock grid class and grant it accessibility through the single block class.

Go to the grid class and add a new variable, call it IsX, and ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required