Playing real-time multiplayer Tic-Tac-Toe
Tic-Tac-Toe must be one of the most well-known games in the world. It seems like a simple game to learn, but don’t let that fool you. It’s a game of wit and strategy. In this recipe, we will re-create Tic-Tac-Toe as a real-time multiplayer online game. Let the games begin!
How to do it…
To build this online game, we are going to use Angular and NestJS to handle all WebSocket events, since both frameworks have first-class support for RxJS. We will use NestJS to handle the server side of handling a player’s moves, and Angular as a client app for showing the 3x3 grid for the game, handling user interaction, and sending WebSocket events to our API.
We will also need to follow the instructions for creating a NestJS WebSocket gateway and connecting to WebSocket from the client app described in steps 1 and 2 of the Crafting a modern chat application recipe.
Step 1 – Handling multiplayer
Whenever...