All Questions

Community

TheKmank

Board Game Creation

Hey, just wondering if there are any plans to add a tutorial around implimenting turn based board games like chess or checkers. If not, what would be the best way to go about learning what I would need for such a system?

  • Nathan Lovato replied

    No, we don't have plans to make an example of traditional board games. However, you'll find two series in 2D Secrets that show how to make turn-based games:

    The principles are similar, so you can follow probably the TRPG movement series and apply what you learned to a new project.

    When it comes to classic games like chess, the challenge really lies in coding artificial intelligence. Managing the board and pawn movement takes little time in comparison.

    The way I'd code movement in a game like chess is like so:

    1. I'd define the movement pattern of every pawn type in the pawn's class. For example, the tower can move horizontally or vertically, so the rule is to iterate in 4 directions until you reach the edges of the board.

    2. When a player selects a pawn, you run the board through that rule and handle collisions, producing an array of cells the player can move the unit.

    3. Following the principles in the TRPG series, you can then display these cells using a tilemap or another method (depending on the level of interactivity and visual feedback you need, sprites might be better).

    Anyway, I'd recommend experimenting and trying to create that kind of game yourself, one mechanic at a time. Starting with the simplest possible board game to get results quickly.

    Good luck!

  • TheKmank replied

    Thanks for the tips!