Reversi
← Back to Overview

Four In A Row - Multiplayer Version

The classic strategy game to play against a friend online.

🎯 About This Game

This project implements the classic Four in a row game as a multiplayer version.

📖 Rules of Four In A Row

Four In A Row is a two-player strategy game played on a vertical 7×6 grid where players compete to align four of their colored discs.

Setup: The game begins with an empty grid. One player uses yellow discs, the other uses red discs.

Gameplay: Players take turns dropping one disc from the top into any of the seven columns. The disc falls straight down, occupying the lowest available space within that column. The first player to form a horizontal, vertical, or diagonal line of four of their own discs wins the game.

Strategy: Players must balance offensive moves (creating their own winning threats) with defensive moves (blocking their opponent's potential wins). Creating multiple simultaneous threats—known as "forks"—often leads to victory since your opponent can only block one threat at a time.

Winning: The game ends when a player successfully connects four discs in a row (horizontally, vertically, or diagonally), or when the grid is completely filled. If the grid fills without any player achieving four in a row, the game is a draw.

Key Insight: Center column control is crucial as it provides the most opportunities for creating winning combinations. The middle column touches the most potential four-in-a-row lines. Corner and edge positions offer fewer connection possibilities.

🎮 How to Play

Initiating Multi-Player: Find yourself a playing partner and agree upon a room name. The person who creates the room determines who starts the game. In following games the start player always alternates.

Starting the Game: The game immediately starts for the server.

Making Moves: Click on or above the column where you want to drop the stone.

Game End: When the game ends, the winner is shown at the top of the screen. After a few second you restart with the color selection process.

⚙️ Technical Details

The game is built entirely in Rust using the Macroquad framework and compiled to WebAssembly. The network part uses dedicated technology:

  • Websockets: The communication is done over websockets to be able to establish connections in all environments.
  • Client Hosted Server: The game host is also running in a browser on the client side.
  • Tokio / Axum Relay Server: Beside the web server, we host a dedicated server based on Tokio/Axum to establish communication between different browsers.