Skip to main content

Starting a Game

BeeHex offers multiple ways to play depending on your preferences.

Game Modes

Navigate to /game_mode to access the game setup interface:

Normal

Play online against other players with optional matchmaking

Offline

Local games on the same device without internet

Ranked

Competitive games that affect your MMR and leaderboard position

Configuring Your Game

1

Select Game Type

Choose between:
  • Normal: Casual online matches
  • Hors-Ligne: Local offline games
Ranked mode is only available for online games, not offline matches.
2

Set Time Limit

Choose the time limit per move (in seconds). Available options are defined in the game configuration.Current default: 0 seconds (untimed games)
3

Choose Board Size

Select from three board sizes:
  • 5×5: Quick games, ideal for beginners
  • 7×7: Standard competitive size
  • 9×9: Advanced games with more strategic depth
4

Matchmaking Option

Select how to find opponents:
  • “Chercher une partie”: Join matchmaking queue to find random opponents
  • “Partie privée”: Create/join a private room with a custom code
5

Start Playing

Click the “Jouer” button to begin. The system will:
  • Connect to the game server via WebSocket
  • Search for an opponent (or create a private room)
  • Initialize the game board when both players are ready

Game Interface

Once your game starts, you’ll see:

Hexagonal Board

The main game board displays:
  • Gray hexagons: Empty cells where you can place pieces
  • Red pieces: Player 1’s moves (connecting top to bottom)
  • Blue pieces: Player 2’s moves (connecting left to right)
  • Loading spinner: Appears while connecting to game server

Player Information

The side panel shows:
  • Player names (yours and your opponent’s)
  • Timer displays (format: "X:XX")
  • Current turn indicator
For online games, player names are fetched from the database. Local games display “Joueur 1” and “Joueur 2” as defaults.

Making Moves

Online Games

1

Wait for Your Turn

The game instance tracks whose turn it is based on the turn number:
  • Odd turns: First player (Red)
  • Even turns: Second player (Blue)
2

Click a Valid Cell

Click any gray (empty) hexagon on the board. The system validates:
  • Is it your turn?
  • Is the cell empty?
  • Is the game still in progress?
3

Move Transmitted

When you click a valid cell:
  1. Your client sends a PLAY_MOVE packet via WebSocket
  2. The server validates and broadcasts the move
  3. Both players’ boards update in real-time
  4. The turn counter increments
You can only make moves during your turn. Clicking on occupied cells or during your opponent’s turn has no effect.

Local/Offline Games

Offline games use a local handler instead of WebSocket:
  • No internet connection required
  • Moves are validated and processed instantly
  • Both players take turns on the same device
  • Game state is maintained locally in browser memory

Winning the Game

Victory Conditions

A player wins by creating an unbroken chain of their pieces connecting their two board edges:
  • Red player (Player 1): Must connect top edge to bottom edge
  • Blue player (Player 2): Must connect left edge to right edge
The chain doesn’t need to be straight—it just needs to be continuous through adjacent hexagons of your color.

Game End Sequence

When the game ends:
  1. Server detects victory by checking for complete paths
  2. Game status updates:
    • FIRST_PLAYER_WIN (status: 1)
    • SECOND_PLAYER_WIN (status: 2)
  3. Victory alert appears:
    • “Victoire” (Victory) with trophy icon if you won
    • “Défaite” (Defeat) with X icon if you lost
  4. Game transitions to review mode automatically
  5. Move history is saved for later analysis

Game States

The game client manages four distinct states:
LOADING → PLAYING → REVIEWING

         RECONNECTING (if connection drops)

Loading State

  • Establishing WebSocket connection
  • Fetching game data from server
  • Displaying loading spinner
  • Initializing game board

Playing State

  • Active game in progress
  • Players can make moves
  • Real-time updates via WebSocket
  • Turn-based gameplay

Reconnecting State

  • Connection to server lost
  • Attempting to reconnect automatically
  • Game state preserved locally
  • Resumes when connection restored
If your connection drops during a game, the client automatically attempts to reconnect and rejoin the game in progress.

Reviewing State

  • Game has ended
  • Full move history available
  • Analysis tools enabled
  • Move slider for stepping through game

Game URL System

BeeHex uses special URL formats to identify game types:

Online Games

/hex/o_[gameId]
Example: /hex/o_abc123def456
  • Connects to multiplayer server
  • Fetches game from database
  • Real-time synchronization

Local Games

/hex/l_[timeLimit]_[boardSize]
Example: /hex/l_0_5
  • Offline gameplay (0 second time limit, 5×5 board)
  • No server connection required
  • Local state management

Game Review from Moves

/hex/m_[timeLimit]_[boardSize]_[moves]
Example: /hex/m_0_5_0-6-12-18
  • Replay specific game sequences
  • Moves encoded as board position numbers
  • Automatically enters review mode

Connection Management

WebSocket Connection

Online games use persistent WebSocket connections:
// Connection established to game server
WebsocketHandlercallbacks for:
  - gameFoundCallback: Opponent found
  - joinGameCallback: Game started
  - movePlayedCallback: Move received
  - gameEndCallback: Game finished
  - connectionEndedCallback: Connection lost

Connection Recovery

If your connection drops during an active game:
  1. Game state changes to RECONNECTING
  2. Client automatically attempts to reconnect
  3. On successful reconnection, rejoins the same game
  4. Game continues from current position

Private Rooms

For playing with friends, see the Private Rooms guide for detailed instructions on creating and joining custom games.

Game History

After each online game:
  • Match is saved to database
  • Full move sequence recorded
  • MMR changes calculated (for ranked games)
  • Accessible via /history page
Click on any game in your history to review it move-by-move with the analysis board.

Quick Start Summary

Quick Local Game

Visit /hex/l_0_5 to instantly start a 5×5 offline game

Find Online Match

Go to /game_mode, select settings, click “Jouer”

Next Steps

Private Rooms

Learn how to play with friends using room codes

Ranking System

Understand how MMR and ranks work