Goal: Capture the enemy Flag, or successfully sneak your Flag to their back row
(Flag Run). You can also win by cornering the enemy so they have no valid moves.
Deployment: Players secretly arrange 21 pieces on their back three rows (rows 0-2 for Red, rows 6-8 for Blue).
Movement: Pieces move exactly one square up, down, left, or right (no diagonals). Flag cannot move.
Combat Resolution: When a piece moves to an occupied square, combat occurs. Higher rank wins; equal ranks eliminate each other (draw).
Special Pieces: The Spy (defeats all officers except Private), The Flag (cannot move, loses to everything, game ends if captured).
πΊοΈ Board Coordinates
The battlefield is an 8x9 grid. Replays and logs use this coordinate system:
A
B
C
D
E
F
G
H
I
8
8x9 PLAY AREA
7
6
5
4
3
2
1
π Game Modes
VS Client: Pass & play locally on one device. Both players on the same screen.
VS Server: Play locally against the built-in AI opponent (Easy, Medium, Hard, God difficulty levels).
Demo Mode: AI vs AI spectator match. Watch the AI play against itself.
Online (WebRTC): Direct peer-to-peer multiplayer. One player hosts (generates code), the other joins. Host controls Red pieces, Guest controls Blue.
Online (WebServer): Server-based multiplayer. One player hosts a game room and receives a Room ID, the other joins that room. Suitable for slower connections or firewall restrictions. Host controls Red, Player controls Blue.
π Online Play Details
WebRTC (P2P): Direct connection between players. No middleman server. Requires stable connection; may have issues behind strict firewalls. Real-time, low-latency gameplay.
WebServer: Uses a central relay server. More stable and reliable for most players. Works better with firewalls. Good for casual play across different networks. Connection will show Room ID in the menu while active.
Connection Status: Active online connections display a connection info panel in the menu showing your mode and Room ID/Code.
Disconnect Notifications: If a player disconnects (intentionally or accidentally), the remaining player is immediately notified.
Anti-Cheat: Piece ranks are cryptographically verified. The game will detect and reject any attempts to manipulate values.
βοΈ Features
Turn Timer: Optional 30-second move timer. Activate per game to apply pressure and speed up matches.
Saved Formations: Save up to 2 custom piece setups (Formation 1 & 2) to skip the deployment phase in future games.
Game Replay: Automatic game logging. Review match history as text logs or watch visual step-by-step playback with piece animations after a game ends.
Stealth Mode (Hide Pieces): Option to hide your own pieces on the board during pass & play. Useful for streaming or preventing screen cheating in local matches.
Scoreboard & Stats: Detailed tracking across all modes: Total points, Win/Loss records, Win Rate percentage, and current Win Streaks. Separate stats for each game mode (Multi, CPU, WebRTC, WebServer).
Casualties Tracker: Live display of captured pieces during a game. Helps you deduce which enemy pieces remain on the board.
Theme Toggle: Switch between light and dark themes for comfortable play in any lighting.
Game Save/Restore: Save your current game state and resume later (local save only).
βΉοΈ How to Play Online
To Host: Click "Online" β select WebRTC or WebServer β Click "Host Game". You'll get a Room ID/Code to share.
To Join: Click "Online" β select WebRTC or WebServer β Click "Join Game" β Enter the Room ID/Code from your opponent.
Setup Phase: Place your 21 pieces on your back three rows. Both players must complete setup before the game starts.
Connection Info: Once connected, your connection mode and ID display in the menu's π‘ Connected panel.
Disconnect: Click "Disconnect Network" in the menu to exit online play cleanly. Your opponent will be notified.
π Version & Credits
GG-AI Command Elite - The Generals Enhanced Edition Version: 2.0.2 Features: WebRTC Peer-to-Peer & WebServer Online Multiplayer, AI Opponent, Demo Mode, Replay System
βοΈ Original Game Credit: The Generals - An educational war game invented in the Philippines by Sofronio H. Pasola, Jr. in 1970. The game was created with the inspiration of his son, Ronnie Pasola. This enhanced digital implementation builds upon that classic foundation with modern online multiplayer capabilities and AI gameplay.
βοΈ Disclaimer
This is an enhanced implementation of the classic board game The Generals. This implementation includes online multiplayer functionality via WebRTC and WebServer relay. All gameplay, piece mechanics, and rules are faithful to the original game design. Use at your own risk. Online play depends on third-party infrastructure (PeerJS CDN for WebRTC signaling; user-provided WebServer for relay).